From 6465106c20341881a5ee8fd4aecded9b72290eef Mon Sep 17 00:00:00 2001 From: Hrishikesh Jain Date: Wed, 25 Nov 2026 20:40:46 +0530 Subject: [PATCH] feat(sdk-core): add canton end-investor offboarding and invite-cancel intents Pass-through plumbing for the two new DTCC intents (public-types #504), mirroring the existing onboarding intents exactly: - cantonEndInvestorOffboarding: requires endInvestorPartyId (mirrors the offer intent); the prepared transaction is built server-side by WP/IMS, which discovers the Daml existingContracts lists from the ACS. - cantonEndInvestorOnboardingCancel: requires txRequestId referencing the stored pending offer (mirrors accept/reject); unlike those it is signed by the participant's wallet. No new TransactionType and nothing in sdk-coin-canton: WP wraps IMS-prepared transactions in the SDK CantonCommandBuilder, so decode, explain, verify and signing already handle these as CantonCommand. Hooks were bypassed for this commit (husky shim absent in a worktree installed with --ignore-scripts); prettier and eslint were run manually on the changed files instead. TICKET: CHALO-2278 Co-Authored-By: Claude Fable 5 --- modules/sdk-core/src/bitgo/utils/mpcUtils.ts | 7 +++++ .../sdk-core/src/bitgo/utils/tss/baseTypes.ts | 4 +-- .../src/bitgo/utils/tss/recipientUtils.ts | 2 ++ modules/sdk-core/src/bitgo/wallet/iWallet.ts | 2 +- modules/sdk-core/src/bitgo/wallet/wallet.ts | 30 +++++++++++++++++++ .../unit/bitgo/utils/tss/recipientUtils.ts | 4 +++ 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/modules/sdk-core/src/bitgo/utils/mpcUtils.ts b/modules/sdk-core/src/bitgo/utils/mpcUtils.ts index d7c4c5c42c..bc408f52e8 100644 --- a/modules/sdk-core/src/bitgo/utils/mpcUtils.ts +++ b/modules/sdk-core/src/bitgo/utils/mpcUtils.ts @@ -146,6 +146,7 @@ export abstract class MpcUtils { 'allocationAllocate', 'cantonEndInvestorOnboardingAccept', 'cantonEndInvestorOnboardingReject', + 'cantonEndInvestorOnboardingCancel', ].includes(params.intentType) && baseCoin.getFamily() === 'canton' ) { @@ -156,6 +157,10 @@ export abstract class MpcUtils { assert(params.endInvestorPartyId, `'endInvestorPartyId' is required parameter for ${params.intentType} intent`); } + if (params.intentType === 'cantonEndInvestorOffboarding') { + assert(params.endInvestorPartyId, `'endInvestorPartyId' is required parameter for ${params.intentType} intent`); + } + if (params.intentType === 'cantonEndInvestorOnboardingReject') { assert(params.reason, `'reason' is required parameter for ${params.intentType} intent`); } @@ -232,6 +237,8 @@ export abstract class MpcUtils { 'cantonBroadridgeStandingDelegation', 'cantonEndInvestorOnboardingAccept', 'cantonEndInvestorOnboardingReject', + 'cantonEndInvestorOnboardingCancel', + 'cantonEndInvestorOffboarding', 'cantonParticipantOnboardingRequest', 'defi-approve', 'defi-deposit', diff --git a/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts b/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts index 1bdca39d15..ace673e20c 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts @@ -431,7 +431,7 @@ export interface PrebuildTransactionWithIntentOptions extends IntentOptionsBase wrapParams?: WrapIntentParams; /** ERC-7984 unwrap (unshield) fields flattened onto the WP intent. */ unwrapParams?: UnwrapIntentParams; - /** Canton party ID of the end investor to onboard (cantonEndInvestorOnboardingOffer intent). */ + /** Canton party ID of the end investor to onboard or offboard (cantonEndInvestorOnboardingOffer / cantonEndInvestorOffboarding intents). */ endInvestorPartyId?: string; /** Reason for rejecting the onboarding offer (cantonEndInvestorOnboardingReject intent). */ reason?: string; @@ -549,7 +549,7 @@ export interface PopulatedIntent extends PopulatedIntentBase, DefiIntentFields { cantonCommandParams?: CantonCommandParams; /** External settlement executor party ID (cantonBroadridgeStandingDelegation intent). */ executorPartyId?: string; - /** Canton party ID of the end investor to onboard (cantonEndInvestorOnboardingOffer intent). */ + /** Canton party ID of the end investor to onboard or offboard (cantonEndInvestorOnboardingOffer / cantonEndInvestorOffboarding intents). */ endInvestorPartyId?: string; /** Reason for rejecting the onboarding offer (cantonEndInvestorOnboardingReject intent). */ reason?: string; diff --git a/modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts b/modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts index 1c108b891e..4986d302ea 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts @@ -87,6 +87,8 @@ export const NO_RECIPIENT_TX_TYPES = new Set([ 'cantonEndInvestorOnboardingOffer', 'cantonEndInvestorOnboardingAccept', 'cantonEndInvestorOnboardingReject', + 'cantonEndInvestorOnboardingCancel', + 'cantonEndInvestorOffboarding', 'cantonParticipantOnboardingRequest', 'pledge', diff --git a/modules/sdk-core/src/bitgo/wallet/iWallet.ts b/modules/sdk-core/src/bitgo/wallet/iWallet.ts index 5873640691..9e5cd7875e 100644 --- a/modules/sdk-core/src/bitgo/wallet/iWallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/iWallet.ts @@ -355,7 +355,7 @@ export interface PrebuildTransactionOptions { cantonCommandParams?: CantonCommandParams; /** External settlement executor party ID (cantonBroadridgeStandingDelegation intent). */ executorPartyId?: string; - /** Canton party ID of the end investor to onboard (cantonEndInvestorOnboardingOffer intent). */ + /** Canton party ID of the end investor to onboard or offboard (cantonEndInvestorOnboardingOffer / cantonEndInvestorOffboarding intents). */ endInvestorPartyId?: string; /** Reason for rejecting the onboarding offer (cantonEndInvestorOnboardingReject intent). */ reason?: string; diff --git a/modules/sdk-core/src/bitgo/wallet/wallet.ts b/modules/sdk-core/src/bitgo/wallet/wallet.ts index 6b4e129b2a..6062b6b1b8 100644 --- a/modules/sdk-core/src/bitgo/wallet/wallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/wallet.ts @@ -4918,6 +4918,36 @@ export class Wallet implements IWallet { ); break; } + case 'cantonEndInvestorOnboardingCancel': { + txRequest = await this.tssUtils!.prebuildTxWithIntent( + { + reqId, + intentType: 'cantonEndInvestorOnboardingCancel', + txRequestId: params.txRequestId, + sequenceId: params.txRequestId, + }, + apiVersion, + params.preview + ); + break; + } + case 'cantonEndInvestorOffboarding': { + if (!params.endInvestorPartyId) { + throw new Error('endInvestorPartyId is required for cantonEndInvestorOffboarding intent'); + } + txRequest = await this.tssUtils!.prebuildTxWithIntent( + { + reqId, + intentType: 'cantonEndInvestorOffboarding', + endInvestorPartyId: params.endInvestorPartyId, + comment: params.comment, + sequenceId: params.sequenceId, + }, + apiVersion, + params.preview + ); + break; + } case 'cantonParticipantOnboardingRequest': { if ( !params.operator || diff --git a/modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts b/modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts index e1d7bfba64..e3d07d830d 100644 --- a/modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts +++ b/modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts @@ -67,6 +67,8 @@ describe('recipientUtils', function () { 'cantonEndInvestorOnboardingOffer', 'cantonEndInvestorOnboardingAccept', 'cantonEndInvestorOnboardingReject', + 'cantonEndInvestorOnboardingCancel', + 'cantonEndInvestorOffboarding', 'cantonParticipantOnboardingRequest', 'pledge', // Avalanche / Flare cross-chain atomic imports @@ -316,6 +318,8 @@ describe('recipientUtils', function () { 'cantonEndInvestorOnboardingOffer', 'cantonEndInvestorOnboardingAccept', 'cantonEndInvestorOnboardingReject', + 'cantonEndInvestorOnboardingCancel', + 'cantonEndInvestorOffboarding', 'cantonParticipantOnboardingRequest', 'cantonBroadridgeStandingDelegation', ];