Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions modules/bitgo/test/v2/unit/internal/tssUtils/eddsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,82 @@ describe('TSS Utils:', async function () {

nockedCreateTx.isDone().should.be.true();
});

it('should include execMode in request body when specified', async function () {
const nockedCreateTx = await nockCreateTxRequest({
walletId: wallet.id(),
requestBody: {
apiVersion: 'lite',
execMode: 'EXEC_UNSPECIFIED',
intent: {
intentType: 'payment',
recipients: [
{
address: {
address: 'recipient',
},
amount: {
value: '10000',
symbol: 'tsol',
},
},
],
},
},
response: {},
});

await tssUtils.prebuildTxWithIntent({
reqId,
recipients: [
{
address: 'recipient',
amount: '10000',
},
],
intentType: 'payment',
execMode: 'EXEC_UNSPECIFIED',
});

nockedCreateTx.isDone().should.be.true();
});

it('should not include execMode in request body when not specified', async function () {
const nockedCreateTx = await nockCreateTxRequest({
walletId: wallet.id(),
requestBody: {
apiVersion: 'lite',
intent: {
intentType: 'payment',
recipients: [
{
address: {
address: 'recipient',
},
amount: {
value: '10000',
symbol: 'tsol',
},
},
],
},
},
response: {},
});

await tssUtils.prebuildTxWithIntent({
reqId,
recipients: [
{
address: 'recipient',
amount: '10000',
},
],
intentType: 'payment',
});

nockedCreateTx.isDone().should.be.true();
});
});

describe('delete SignatureShare:', async function () {
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/utils/tss/baseTSSUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export default class BaseTssUtils<KeyShare> extends MpcUtils implements ITssUtil
},
apiVersion: apiVersion,
preview,
...(params.execMode !== undefined && { execMode: params.execMode }),
};

const reqTracer = params.reqId || new RequestTracer();
Expand Down
7 changes: 7 additions & 0 deletions modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AShare, DShare, SShare } from '../../tss/ecdsa/types';
import { MessageStandardType } from '../messageTypes';

export type TxRequestVersion = 'full' | 'lite';
export type TxRequestExecMode = 'EXEC_TRY' | 'EXEC_UNSPECIFIED';
export interface HopParams {
paymentId?: string;
userReqSig?: string;
Expand Down Expand Up @@ -354,6 +355,12 @@ export interface PrebuildTransactionWithIntentOptions extends IntentOptionsBase
feeToken?: string;
/** Canton-specific params for the cantonCommand intent. */
cantonCommandParams?: CantonCommandParams;
/**
* Controls transaction execution mode on the server side.
* Use 'EXEC_UNSPECIFIED' to defer execution (e.g. Figure Markets exchange flow).
* Defaults to 'EXEC_TRY' when omitted.
*/
execMode?: TxRequestExecMode;
}
export interface IntentRecipient {
address: {
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/wallet/BuildParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const BuildParams = t.exact(
feeToken: t.unknown,
// Bridging parameters for cross-chain operations (e.g., BTC to sBTC)
bridgingParams: t.unknown,
execMode: t.unknown,
}),
])
);
Expand Down
5 changes: 5 additions & 0 deletions modules/sdk-core/src/bitgo/wallet/iWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ export interface PrebuildTransactionOptions {
* Parameters for executing DAML commands on Canton.
*/
cantonCommandParams?: CantonCommandParams;
/**
* Controls transaction execution mode. Use 'EXEC_UNSPECIFIED' to defer
* execution (e.g. Figure Markets exchange flow). Defaults to 'EXEC_TRY'.
*/
execMode?: 'EXEC_TRY' | 'EXEC_UNSPECIFIED';
}

export interface PrebuildAndSignTransactionOptions extends PrebuildTransactionOptions, WalletSignTransactionOptions {
Expand Down
17 changes: 17 additions & 0 deletions modules/sdk-core/src/bitgo/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4153,6 +4153,7 @@ export class Wallet implements IWallet {
unspents: params.unspents,
senderAddress: params.senderAddress,
isTestTransaction: params.isTestTransaction,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4170,6 +4171,7 @@ export class Wallet implements IWallet {
feeToken: params.feeToken,
unspents: params.unspents,
sequenceId: params.sequenceId,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4183,6 +4185,7 @@ export class Wallet implements IWallet {
recipients: params.recipients || [],
enableTokens: params.enableTokens,
memo: params.memo,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4195,6 +4198,7 @@ export class Wallet implements IWallet {
intentType: 'closeAssociatedTokenAccount',
recipients: params.recipients || [],
memo: params.memo,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4210,6 +4214,7 @@ export class Wallet implements IWallet {
receiveAddress: params.receiveAddress,
feeOptions,
feeToken: params.feeToken,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4225,6 +4230,7 @@ export class Wallet implements IWallet {
receiveAddress: params.receiveAddress,
feeOptions,
feeToken: params.feeToken,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4237,6 +4243,7 @@ export class Wallet implements IWallet {
intentType: 'tokenApproval',
tokenName: params.tokenName,
feeToken: params.feeToken,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4248,6 +4255,7 @@ export class Wallet implements IWallet {
reqId,
intentType: 'createAccount',
recipients: params.recipients || [],
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4260,6 +4268,7 @@ export class Wallet implements IWallet {
intentType: 'transferAccept',
txRequestId: params.txRequestId,
sequenceId: params.txRequestId,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4273,6 +4282,7 @@ export class Wallet implements IWallet {
intentType: 'transferReject',
txRequestId: params.txRequestId,
sequenceId: params.txRequestId,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4286,6 +4296,7 @@ export class Wallet implements IWallet {
intentType: 'transferOfferWithdrawn',
transferOfferId: params.transferOfferId,
sequenceId: params.transferOfferId,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4303,6 +4314,7 @@ export class Wallet implements IWallet {
cantonCommandParams: params.cantonCommandParams,
sequenceId: params.sequenceId,
comment: params.comment,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4323,6 +4335,7 @@ export class Wallet implements IWallet {
nonce: params.nonce,
memo: params.memo,
feeOptions,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4339,6 +4352,7 @@ export class Wallet implements IWallet {
nonce: params.nonce,
feeOptions,
feeToken: params.feeToken,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4355,6 +4369,7 @@ export class Wallet implements IWallet {
nonce: params.nonce,
feeOptions,
feeToken: params.feeToken,
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4368,6 +4383,7 @@ export class Wallet implements IWallet {
sequenceId: params.sequenceId,
comment: params.comment,
recipients: params.recipients || [],
execMode: params.execMode,
},
apiVersion,
params.preview
Expand All @@ -4381,6 +4397,7 @@ export class Wallet implements IWallet {
sequenceId: params.sequenceId,
comment: params.comment,
recipients: params.recipients || [],
execMode: params.execMode,
},
apiVersion,
params.preview
Expand Down
Loading