Skip to content

Commit a2b9ebd

Browse files
committed
feat(sdk-core): make wallet passphrase optioanl for prepareAllocation
TICKET: WCN-217
1 parent fc02b6b commit a2b9ebd

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

modules/sdk-core/src/bitgo/trading/network/network.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class TradingNetwork implements ITradingNetwork {
109109

110110
/**
111111
* Prepare an allocation for submission
112-
* @param {string} walletPassphrase ofc wallet passphrase
112+
* @param {string} walletPassphrase ofc wallet passphrase - required only when signing via user key
113113
* @param {string} connectionId connection to whom to make the allocation or deallocation
114114
* @param {string=} clientExternalId one time generated uuid v4
115115
* @param {string} currency currency for which the allocation should be made. e.g. btc / tbtc
@@ -130,10 +130,7 @@ export class TradingNetwork implements ITradingNetwork {
130130
}
131131

132132
const payload = JSON.stringify(body);
133-
134-
const prv = await this.wallet.getPrv({ walletPassphrase });
135-
const signedBuffer: Buffer = await this.wallet.baseCoin.signMessage({ prv }, payload);
136-
const signature = signedBuffer.toString('hex');
133+
const signature = await this.wallet.toTradingAccount().signPayload({ payload, walletPassphrase });
137134

138135
return {
139136
...body,

modules/sdk-core/src/bitgo/trading/network/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export type GetNetworkAllocationByIdResponse = {
125125
};
126126

127127
export type PrepareNetworkAllocationParams = Omit<CreateNetworkAllocationParams, 'payload' | 'signature'> & {
128-
walletPassphrase: string;
128+
walletPassphrase?: string;
129129
clientExternalId?: string;
130130
nonce?: string;
131131
};

0 commit comments

Comments
 (0)