@dfns/sdk 0.1.0-beta.8 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,4 +27,6 @@ export declare class DelegatedWalletsClient {
27
27
  importWalletComplete(request: T.ImportWalletRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ImportWalletResponse>;
28
28
  exportWalletInit(request: T.ExportWalletRequest): Promise<UserActionChallengeResponse>;
29
29
  exportWalletComplete(request: T.ExportWalletRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ExportWalletResponse>;
30
+ delegateWalletInit(request: T.DelegateWalletRequest): Promise<UserActionChallengeResponse>;
31
+ delegateWalletComplete(request: T.DelegateWalletRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.DelegateWalletResponse>;
30
32
  }
@@ -299,5 +299,32 @@ class DelegatedWalletsClient {
299
299
  });
300
300
  return response.json();
301
301
  }
302
+ async delegateWalletInit(request) {
303
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/delegate', {
304
+ path: { walletId: request.walletId },
305
+ query: {},
306
+ });
307
+ const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
308
+ userActionHttpMethod: 'POST',
309
+ userActionHttpPath: path,
310
+ userActionPayload: JSON.stringify(request.body),
311
+ userActionServerKind: 'Api',
312
+ }, this.apiOptions);
313
+ return challenge;
314
+ }
315
+ async delegateWalletComplete(request, signedChallenge) {
316
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/delegate', {
317
+ path: { walletId: request.walletId },
318
+ query: {},
319
+ });
320
+ const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
321
+ const response = await (0, fetch_1.simpleFetch)(path, {
322
+ method: 'POST',
323
+ body: request.body,
324
+ headers: { 'x-dfns-useraction': userAction },
325
+ apiOptions: this.apiOptions,
326
+ });
327
+ return response.json();
328
+ }
302
329
  }
303
330
  exports.DelegatedWalletsClient = DelegatedWalletsClient;
@@ -20,4 +20,5 @@ export declare class WalletsClient {
20
20
  listSignatures(request: T.ListSignaturesRequest): Promise<T.ListSignaturesResponse>;
21
21
  importWallet(request: T.ImportWalletRequest): Promise<T.ImportWalletResponse>;
22
22
  exportWallet(request: T.ExportWalletRequest): Promise<T.ExportWalletResponse>;
23
+ delegateWallet(request: T.DelegateWalletRequest): Promise<T.DelegateWalletResponse>;
23
24
  }
@@ -208,5 +208,17 @@ class WalletsClient {
208
208
  });
209
209
  return response.json();
210
210
  }
211
+ async delegateWallet(request) {
212
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/delegate', {
213
+ path: { walletId: request.walletId },
214
+ query: {},
215
+ });
216
+ const response = await (0, fetch_1.userActionFetch)(path, {
217
+ method: 'POST',
218
+ body: request.body,
219
+ apiOptions: this.apiOptions,
220
+ });
221
+ return response.json();
222
+ }
211
223
  }
212
224
  exports.WalletsClient = WalletsClient;
@@ -94,3 +94,8 @@ export type ExportWalletRequest = {
94
94
  body: Wallets.ExportWalletBody;
95
95
  };
96
96
  export type ExportWalletResponse = Wallets.ExportedSigningKey;
97
+ export type DelegateWalletRequest = {
98
+ walletId: Foundations.EntityId;
99
+ body: Wallets.DelegateWalletBody;
100
+ };
101
+ export type DelegateWalletResponse = Wallets.DelegateWalletResult;
@@ -1,5 +1,5 @@
1
1
  import { BadRequestError, EntityNotFoundError, ForbiddenError, UnauthorizedError } from '../Foundations';
2
- import { ExportedSigningKey, PaginatedEventHistory, PaginatedSignatureList, PaginatedTransactionList, PaginatedTransferList, PaginatedWalletList, SignatureRequest, TransactionRequest, TransferRequest, Wallet, WalletAssets, WalletNfts } from './types';
2
+ import { DelegateWalletResult, ExportedSigningKey, PaginatedEventHistory, PaginatedSignatureList, PaginatedTransactionList, PaginatedTransferList, PaginatedWalletList, SignatureRequest, TransactionRequest, TransferRequest, Wallet, WalletAssets, WalletNfts } from './types';
3
3
  export type CreateWalletSuccess = Wallet;
4
4
  export type CreateWalletError = {
5
5
  error: BadRequestError | ForbiddenError | UnauthorizedError | ForbiddenError | BadRequestError | EntityNotFoundError;
@@ -85,3 +85,8 @@ export type ExportWalletError = {
85
85
  error: BadRequestError | ForbiddenError | UnauthorizedError | ForbiddenError | BadRequestError | EntityNotFoundError;
86
86
  };
87
87
  export type ExportWalletResponse = ExportWalletSuccess | ExportWalletError;
88
+ export type DelegateWalletSuccess = DelegateWalletResult;
89
+ export type DelegateWalletError = {
90
+ error: BadRequestError | ForbiddenError | UnauthorizedError | ForbiddenError | BadRequestError | EntityNotFoundError;
91
+ };
92
+ export type DelegateWalletResponse = DelegateWalletSuccess | DelegateWalletError;
@@ -309,6 +309,10 @@ export type ExportedSigningKey = {
309
309
  */
310
310
  encryptedKeyShares: EncryptedKeyShare[];
311
311
  };
312
+ export type DelegateWalletResult = {
313
+ walletId: EntityId;
314
+ status: string;
315
+ };
312
316
  export type CreateWalletBody = {
313
317
  network: BlockchainNetwork;
314
318
  externalId?: string;
@@ -335,6 +339,12 @@ export type ExportWalletBody = {
335
339
  */
336
340
  supportedSchemes: SupportedExportScheme[];
337
341
  };
342
+ export type DelegateWalletBody = {
343
+ /**
344
+ * Encryption public key that will be used by signers to encrypt the exported wallet key shares. The purpose of encrypting key shares is to have them extra-safe and not usable in any place in the system until they are safely returned back to the client issuing the export command.
345
+ */
346
+ userId: EntityId;
347
+ };
338
348
  export type TransferAssetBody = TransferNativeAsset | TransferErc20Asset | TransferErc721Asset;
339
349
  export type BroadcastTransactionBody = BroadcastTransaction | BroadcastEvmTransaction | BroadcastEip1559Transaction | BroadcastEvmLegacyTransaction | BroadcastPsbt;
340
350
  export type GenerateSignatureBody = SignHash | SignMessage | SignTransaction | SignEip712TypedData | SignPsbt;
@@ -412,8 +422,11 @@ export declare enum SignatureStatus {
412
422
  export declare enum BlockchainNetwork {
413
423
  ArbitrumOne = "ArbitrumOne",
414
424
  ArbitrumGoerli = "ArbitrumGoerli",
425
+ ArbitrumSepolia = "ArbitrumSepolia",
415
426
  AvalancheC = "AvalancheC",
416
427
  AvalancheCFuji = "AvalancheCFuji",
428
+ Base = "Base",
429
+ BaseGoerli = "BaseGoerli",
417
430
  Bitcoin = "Bitcoin",
418
431
  BitcoinTestnet3 = "BitcoinTestnet3",
419
432
  Bsc = "Bsc",
@@ -148,10 +148,16 @@ var BlockchainNetwork;
148
148
  BlockchainNetwork["ArbitrumOne"] = "ArbitrumOne";
149
149
  // FIXME: Missing documentation for ArbitrumGoerli
150
150
  BlockchainNetwork["ArbitrumGoerli"] = "ArbitrumGoerli";
151
+ // FIXME: Missing documentation for ArbitrumSepolia
152
+ BlockchainNetwork["ArbitrumSepolia"] = "ArbitrumSepolia";
151
153
  // FIXME: Missing documentation for AvalancheC
152
154
  BlockchainNetwork["AvalancheC"] = "AvalancheC";
153
155
  // FIXME: Missing documentation for AvalancheCFuji
154
156
  BlockchainNetwork["AvalancheCFuji"] = "AvalancheCFuji";
157
+ // FIXME: Missing documentation for Base
158
+ BlockchainNetwork["Base"] = "Base";
159
+ // FIXME: Missing documentation for BaseGoerli
160
+ BlockchainNetwork["BaseGoerli"] = "BaseGoerli";
155
161
  // FIXME: Missing documentation for Bitcoin
156
162
  BlockchainNetwork["Bitcoin"] = "Bitcoin";
157
163
  // FIXME: Missing documentation for BitcoinTestnet3
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@dfns/sdk",
3
- "version": "0.1.0-beta.8",
3
+ "version": "0.1.1",
4
+ "dependencies": {
5
+ "buffer": "6.0.3",
6
+ "cross-fetch": "3.1.6",
7
+ "uuid": "9.0.0"
8
+ },
4
9
  "main": "./index.js",
5
- "type": "commonjs"
10
+ "types": "./index.d.ts"
6
11
  }