From 734478de791832ee95c1d52dedead30634260e02 Mon Sep 17 00:00:00 2001 From: Sarthak Panda Date: Tue, 12 Mar 2024 17:07:41 +0530 Subject: [PATCH] feat(sdk-core): add support for wallet shares without admin approvals Ticket: PX-3270 --- modules/sdk-core/src/bitgo/wallet/iWallet.ts | 5 +++++ modules/sdk-core/src/bitgo/wallet/wallet.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/sdk-core/src/bitgo/wallet/iWallet.ts b/modules/sdk-core/src/bitgo/wallet/iWallet.ts index a4ce4b1a0c..475d27664d 100644 --- a/modules/sdk-core/src/bitgo/wallet/iWallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/iWallet.ts @@ -452,6 +452,7 @@ export interface CreateShareOptions { * A falsy value is expected to throw an API error if an empty or undefined `keychain` is provided. */ skipKeychain?: boolean; + disableAdminApproval?: boolean; } export interface ShareWalletOptions { @@ -465,6 +466,10 @@ export interface ShareWalletOptions { */ skipKeychain?: boolean; disableEmail?: boolean; + /** + * If true, skips admin approval for the share, it will become active immediately. + */ + disableAdminApproval?: boolean; } export interface RemoveUserOptions { diff --git a/modules/sdk-core/src/bitgo/wallet/wallet.ts b/modules/sdk-core/src/bitgo/wallet/wallet.ts index 0a7aa69c2f..f3b511b8c0 100644 --- a/modules/sdk-core/src/bitgo/wallet/wallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/wallet.ts @@ -1481,6 +1481,10 @@ export class Wallet implements IWallet { throw new Error('Expected disableEmail to be a boolean.'); } + if (params.disableAdminApproval !== undefined && !_.isBoolean(params.disableAdminApproval)) { + throw new Error('Expected disableAdminApproval to be a boolean.'); + } + if (!_.isString(params.email)) { throw new Error('missing required string parameter email'); } @@ -1537,6 +1541,7 @@ export class Wallet implements IWallet { disableEmail: params.disableEmail, skipKeychain: Object.keys(sharedKeychain ?? {}).length === 0, keychain: Object.keys(sharedKeychain ?? {}).length === 0 ? undefined : sharedKeychain, + disableAdminApproval: params.disableAdminApproval, }; return await this.createShare(options);