Skip to content

Commit

Permalink
Merge pull request #4344 from BitGo/PX-3270-wallet-share
Browse files Browse the repository at this point in the history
feat(sdk-core): Add support for wallet shares without admin approvals
  • Loading branch information
sarthak96 authored Mar 13, 2024
2 parents 387b99a + 734478d commit ebc1b16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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 @@ -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 {
Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions modules/sdk-core/src/bitgo/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ebc1b16

Please sign in to comment.