@dfns/sdk 0.8.13 → 0.8.14-beta-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.
@@ -4,6 +4,10 @@ import * as T from './types';
4
4
  export declare class DelegatedWalletsClient {
5
5
  private apiOptions;
6
6
  constructor(apiOptions: DfnsDelegatedApiClientOptions);
7
+ abortTransactionInit(request: T.AbortTransactionRequest): Promise<UserActionChallengeResponse>;
8
+ abortTransactionComplete(request: T.AbortTransactionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.AbortTransactionResponse>;
9
+ abortTransferInit(request: T.AbortTransferRequest): Promise<UserActionChallengeResponse>;
10
+ abortTransferComplete(request: T.AbortTransferRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.AbortTransferResponse>;
7
11
  acceptOfferInit(request: T.AcceptOfferRequest): Promise<UserActionChallengeResponse>;
8
12
  acceptOfferComplete(request: T.AcceptOfferRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.AcceptOfferResponse>;
9
13
  activateWalletInit(request: T.ActivateWalletRequest): Promise<UserActionChallengeResponse>;
@@ -8,6 +8,60 @@ class DelegatedWalletsClient {
8
8
  constructor(apiOptions) {
9
9
  this.apiOptions = apiOptions;
10
10
  }
11
+ async abortTransactionInit(request) {
12
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/transactions/:transactionId/abort', {
13
+ path: request ?? {},
14
+ query: {},
15
+ });
16
+ const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
17
+ userActionHttpMethod: 'PUT',
18
+ userActionHttpPath: path,
19
+ userActionPayload: JSON.stringify({}),
20
+ userActionServerKind: 'Api',
21
+ }, this.apiOptions);
22
+ return challenge;
23
+ }
24
+ async abortTransactionComplete(request, signedChallenge) {
25
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/transactions/:transactionId/abort', {
26
+ path: request ?? {},
27
+ query: {},
28
+ });
29
+ const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
30
+ const response = await (0, fetch_1.simpleFetch)(path, {
31
+ method: 'PUT',
32
+ body: {},
33
+ headers: { 'x-dfns-useraction': userAction },
34
+ apiOptions: this.apiOptions,
35
+ });
36
+ return response.json();
37
+ }
38
+ async abortTransferInit(request) {
39
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/transfers/:transferId/abort', {
40
+ path: request ?? {},
41
+ query: {},
42
+ });
43
+ const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
44
+ userActionHttpMethod: 'PUT',
45
+ userActionHttpPath: path,
46
+ userActionPayload: JSON.stringify({}),
47
+ userActionServerKind: 'Api',
48
+ }, this.apiOptions);
49
+ return challenge;
50
+ }
51
+ async abortTransferComplete(request, signedChallenge) {
52
+ const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/transfers/:transferId/abort', {
53
+ path: request ?? {},
54
+ query: {},
55
+ });
56
+ const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
57
+ const response = await (0, fetch_1.simpleFetch)(path, {
58
+ method: 'PUT',
59
+ body: {},
60
+ headers: { 'x-dfns-useraction': userAction },
61
+ apiOptions: this.apiOptions,
62
+ });
63
+ return response.json();
64
+ }
11
65
  async acceptOfferInit(request) {
12
66
  const path = (0, url_1.buildPathAndQuery)('/wallets/:walletId/offers/:offerId/accept', {
13
67
  path: request ?? {},