@frak-labs/nexus-sdk 0.0.14 → 0.0.16

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.
Files changed (50) hide show
  1. package/README.md +4 -4
  2. package/dist/FrakContext-LbQht1ep.d.cts +10 -0
  3. package/dist/FrakContext-LbQht1ep.d.ts +10 -0
  4. package/dist/bundle/bundle.js +21 -0
  5. package/dist/chunk-A3XYA7S7.cjs +114 -0
  6. package/dist/{chunk-5LZQXBFJ.js → chunk-AHUMDUJC.js} +12 -196
  7. package/dist/chunk-D77BTQYS.js +210 -0
  8. package/dist/chunk-DAGCBEBQ.cjs +243 -0
  9. package/dist/chunk-FO2GFD5C.cjs +210 -0
  10. package/dist/chunk-FYMOOHMT.js +254 -0
  11. package/dist/chunk-HY6YATLS.js +53 -0
  12. package/dist/chunk-J655X6YR.cjs +254 -0
  13. package/dist/chunk-TIKEZMSD.js +114 -0
  14. package/dist/chunk-UFJ7W6CQ.cjs +53 -0
  15. package/dist/{client-DJd7-ajw.d.ts → client-ALy_TEwJ.d.ts} +34 -11
  16. package/dist/{client-DXITs1Kf.d.cts → client-DaEox5q4.d.cts} +34 -11
  17. package/dist/core/actions/index.cjs +11 -3
  18. package/dist/core/actions/index.d.cts +28 -5
  19. package/dist/core/actions/index.d.ts +28 -5
  20. package/dist/core/actions/index.js +10 -2
  21. package/dist/core/index.cjs +15 -4
  22. package/dist/core/index.d.cts +98 -4
  23. package/dist/core/index.d.ts +98 -4
  24. package/dist/core/index.js +15 -4
  25. package/dist/core/interactions/index.cjs +3 -4
  26. package/dist/core/interactions/index.d.cts +27 -15
  27. package/dist/core/interactions/index.d.ts +27 -15
  28. package/dist/core/interactions/index.js +8 -9
  29. package/dist/{error-C4Zm5nQe.d.cts → error-Dflr3G5x.d.cts} +1 -1
  30. package/dist/{error-C4Zm5nQe.d.ts → error-Dflr3G5x.d.ts} +1 -1
  31. package/dist/react/index.cjs +79 -155
  32. package/dist/react/index.d.cts +4 -5
  33. package/dist/react/index.d.ts +4 -5
  34. package/dist/react/index.js +78 -154
  35. package/dist/{sendTransaction-fLvpfqaQ.d.ts → sendTransaction-BOd-pvXr.d.ts} +2 -2
  36. package/dist/{sendTransaction-C19oCc6X.d.cts → sendTransaction-MhdJPTWd.d.cts} +2 -2
  37. package/package.json +6 -6
  38. package/dist/chunk-22T2NHQK.js +0 -22
  39. package/dist/chunk-5SGDBU5S.cjs +0 -427
  40. package/dist/chunk-AANA3LEO.cjs +0 -22
  41. package/dist/chunk-ETV4XYOV.cjs +0 -7
  42. package/dist/chunk-IH3QWPWT.js +0 -72
  43. package/dist/chunk-PKBMQBKP.js +0 -7
  44. package/dist/chunk-PURWUKEM.cjs +0 -72
  45. package/dist/chunk-S223FMEJ.js +0 -86
  46. package/dist/chunk-UOEVM7TR.cjs +0 -86
  47. package/dist/index.cjs +0 -1
  48. package/dist/index.d.cts +0 -2
  49. package/dist/index.d.ts +0 -2
  50. package/dist/index.js +0 -0
@@ -1,7 +1,9 @@
1
- import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-DJd7-ajw.js';
2
- export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-DJd7-ajw.js';
1
+ import { N as NexusWalletSdkConfig, a as NexusClient } from '../client-ALy_TEwJ.js';
2
+ export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, n as FinalActionType, F as FinalModalStepType, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, b as ModalRpcMetadata, c as ModalRpcStepsInput, d as ModalRpcStepsResultType, e as ModalStepMetadata, M as ModalStepTypes, m as OpenInteractionSessionModalStepType, l as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, j as SendTransactionModalStepType, k as SendTransactionReturnType, i as SendTransactionTxType, f as SiweAuthenticateModalStepType, h as SiweAuthenticateReturnType, g as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType } from '../client-ALy_TEwJ.js';
3
+ import { Address } from '../abi.js';
4
+ import { F as FrakContext } from '../FrakContext-LbQht1ep.js';
3
5
  export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
4
- export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.js';
6
+ export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.js';
5
7
  import 'viem';
6
8
  import 'viem/chains';
7
9
  import 'viem/siwe';
@@ -46,12 +48,71 @@ declare function createIframe({ walletBaseUrl, }: {
46
48
  * @param data The params to encode
47
49
  */
48
50
  declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
51
+ /**
52
+ * Compress json data
53
+ * @param data
54
+ */
55
+ declare function compressJson(data: unknown): Promise<string>;
49
56
 
50
57
  /**
51
58
  * Decompress the given string
52
59
  * @param compressedData The params to encode
53
60
  */
54
61
  declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
62
+ /**
63
+ * Decompress json data
64
+ * @param data
65
+ */
66
+ declare function decompressJson<T>(data: string): Promise<T | null>;
67
+
68
+ /**
69
+ * Parse the current Nexus context in the given url
70
+ * @param url
71
+ */
72
+ declare function parse({ url }: {
73
+ url: string;
74
+ }): Promise<Readonly<{
75
+ r: Address;
76
+ }> | null>;
77
+ /**
78
+ * Populate the current url with the given Nexus context
79
+ */
80
+ declare function update({ url, context, }: {
81
+ url?: string;
82
+ context: Partial<FrakContext>;
83
+ }): Promise<string | null | undefined>;
84
+ /**
85
+ * Remove Nexus context from current url
86
+ */
87
+ declare function remove(url: string): string;
88
+ /**
89
+ * Replace the current url with the given Nexus context
90
+ * @param url
91
+ * @param context
92
+ */
93
+ declare function replaceUrl({ url, context, }: {
94
+ url?: string;
95
+ context: Partial<FrakContext>;
96
+ }): Promise<void>;
97
+ /**
98
+ * Export our frak context "class"
99
+ */
100
+ declare const FrakContextManager: {
101
+ parse: typeof parse;
102
+ update: typeof update;
103
+ remove: typeof remove;
104
+ replaceUrl: typeof replaceUrl;
105
+ };
106
+
107
+ declare class Deferred<T> {
108
+ private readonly _promise;
109
+ private _resolve;
110
+ private _reject;
111
+ constructor();
112
+ get promise(): Promise<T>;
113
+ resolve: (value: T | PromiseLike<T>) => void;
114
+ reject: (reason?: unknown) => void;
115
+ }
55
116
 
56
117
  /**
57
118
  * The keys for each product types
@@ -63,11 +124,44 @@ type ProductTypesKey = keyof typeof productTypes;
63
124
  declare const productTypes: {
64
125
  dapp: number;
65
126
  press: number;
127
+ webshop: number;
66
128
  referral: number;
129
+ purchase: number;
67
130
  };
68
131
  /**
69
132
  * Bitmask for each product types
70
133
  */
71
134
  declare const productTypesMask: Record<ProductTypesKey, bigint>;
72
135
 
73
- export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
136
+ /**
137
+ * The keys for each interaction types
138
+ */
139
+ type InteractionTypesKey = {
140
+ [K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
141
+ }[keyof typeof interactionTypes];
142
+ /**
143
+ * Each interactions types according to the product types
144
+ */
145
+ declare const interactionTypes: {
146
+ readonly press: {
147
+ readonly openArticle: "0xc0a24ffb";
148
+ readonly readArticle: "0xd5bd0fbe";
149
+ };
150
+ readonly dapp: {
151
+ readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
152
+ readonly callableVerifiableStorageUpdate: "0xa07da986";
153
+ };
154
+ readonly webshop: {
155
+ readonly open: "0xb311798f";
156
+ };
157
+ readonly referral: {
158
+ readonly referred: "0x010cc3b9";
159
+ readonly createLink: "0xb2c0f17c";
160
+ };
161
+ readonly purchase: {
162
+ readonly started: "0xd87e90c3";
163
+ readonly completed: "0x8403aeb4";
164
+ };
165
+ };
166
+
167
+ export { type CompressedData, Deferred, FrakContextManager, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes, productTypes, productTypesMask };
@@ -1,23 +1,34 @@
1
1
  import {
2
+ createIFrameNexusClient
3
+ } from "../chunk-AHUMDUJC.js";
4
+ import {
5
+ Deferred,
6
+ FrakContextManager,
2
7
  FrakRpcError,
3
8
  RpcErrorCodes,
4
- createIFrameNexusClient,
9
+ compressJson,
5
10
  createIframe,
6
11
  decompressDataAndCheckHash,
12
+ decompressJson,
7
13
  hashAndCompressData
8
- } from "../chunk-5LZQXBFJ.js";
14
+ } from "../chunk-FYMOOHMT.js";
9
15
  import {
16
+ interactionTypes,
10
17
  productTypes,
11
18
  productTypesMask
12
- } from "../chunk-22T2NHQK.js";
13
- import "../chunk-PKBMQBKP.js";
19
+ } from "../chunk-HY6YATLS.js";
14
20
  export {
21
+ Deferred,
22
+ FrakContextManager,
15
23
  FrakRpcError,
16
24
  RpcErrorCodes,
25
+ compressJson,
17
26
  createIFrameNexusClient,
18
27
  createIframe,
19
28
  decompressDataAndCheckHash,
29
+ decompressJson,
20
30
  hashAndCompressData,
31
+ interactionTypes,
21
32
  productTypes,
22
33
  productTypesMask
23
34
  };
@@ -3,12 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkPURWUKEMcjs = require('../../chunk-PURWUKEM.cjs');
7
- require('../../chunk-AANA3LEO.cjs');
8
- require('../../chunk-ETV4XYOV.cjs');
6
+ var _chunkA3XYA7S7cjs = require('../../chunk-A3XYA7S7.cjs');
7
+ require('../../chunk-UFJ7W6CQ.cjs');
9
8
 
10
9
 
11
10
 
12
11
 
13
12
 
14
- exports.PressActionsSelector = _chunkPURWUKEMcjs.PressActionsSelector; exports.PressInteractionEncoder = _chunkPURWUKEMcjs.PressInteractionEncoder; exports.ReferralActionsSelector = _chunkPURWUKEMcjs.ReferralActionsSelector; exports.ReferralInteractionEncoder = _chunkPURWUKEMcjs.ReferralInteractionEncoder;
13
+ exports.PressInteractionEncoder = _chunkA3XYA7S7cjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunkA3XYA7S7cjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunkA3XYA7S7cjs.ReferralInteractionEncoder; exports.WebShopInteractionEncoder = _chunkA3XYA7S7cjs.WebShopInteractionEncoder;
@@ -1,13 +1,6 @@
1
1
  import { Hex, Address } from 'viem';
2
2
  import { P as PreparedInteraction } from '../../interaction-BngPoHA0.cjs';
3
3
 
4
- /**
5
- * All the press interactions actions
6
- */
7
- declare const PressActionsSelector: {
8
- readonly OpenArticle: "0xc0a24ffb";
9
- readonly ReadArticle: "0xd5bd0fbe";
10
- };
11
4
  /**
12
5
  * Encode an open article interaction
13
6
  * @param articleId
@@ -27,13 +20,6 @@ declare const PressInteractionEncoder: {
27
20
  readArticle: typeof readArticle;
28
21
  };
29
22
 
30
- /**
31
- * All the referral interactions actions
32
- */
33
- declare const ReferralActionsSelector: {
34
- readonly CreateLink: "0xb2c0f17c";
35
- readonly Referred: "0x010cc3b9";
36
- };
37
23
  /**
38
24
  * Encode a create referral link interaction
39
25
  */
@@ -50,4 +36,30 @@ declare const ReferralInteractionEncoder: {
50
36
  referred: typeof referred;
51
37
  };
52
38
 
53
- export { PressActionsSelector, PressInteractionEncoder, ReferralActionsSelector, ReferralInteractionEncoder };
39
+ /**
40
+ * Encode a start purchase interaction
41
+ */
42
+ declare function startPurchase({ purchaseId, }: {
43
+ purchaseId: Hex;
44
+ }): PreparedInteraction;
45
+ /**
46
+ * Encode a complete purchase interaction
47
+ */
48
+ declare function completedPurchase({ purchaseId, proof, }: {
49
+ purchaseId: Hex;
50
+ proof: Hex[];
51
+ }): PreparedInteraction;
52
+ declare const PurchaseInteractionEncoder: {
53
+ startPurchase: typeof startPurchase;
54
+ completedPurchase: typeof completedPurchase;
55
+ };
56
+
57
+ /**
58
+ * Encode a create referral link interaction
59
+ */
60
+ declare function open(): PreparedInteraction;
61
+ declare const WebShopInteractionEncoder: {
62
+ open: typeof open;
63
+ };
64
+
65
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, WebShopInteractionEncoder };
@@ -1,13 +1,6 @@
1
1
  import { Hex, Address } from 'viem';
2
2
  import { P as PreparedInteraction } from '../../interaction-BngPoHA0.js';
3
3
 
4
- /**
5
- * All the press interactions actions
6
- */
7
- declare const PressActionsSelector: {
8
- readonly OpenArticle: "0xc0a24ffb";
9
- readonly ReadArticle: "0xd5bd0fbe";
10
- };
11
4
  /**
12
5
  * Encode an open article interaction
13
6
  * @param articleId
@@ -27,13 +20,6 @@ declare const PressInteractionEncoder: {
27
20
  readArticle: typeof readArticle;
28
21
  };
29
22
 
30
- /**
31
- * All the referral interactions actions
32
- */
33
- declare const ReferralActionsSelector: {
34
- readonly CreateLink: "0xb2c0f17c";
35
- readonly Referred: "0x010cc3b9";
36
- };
37
23
  /**
38
24
  * Encode a create referral link interaction
39
25
  */
@@ -50,4 +36,30 @@ declare const ReferralInteractionEncoder: {
50
36
  referred: typeof referred;
51
37
  };
52
38
 
53
- export { PressActionsSelector, PressInteractionEncoder, ReferralActionsSelector, ReferralInteractionEncoder };
39
+ /**
40
+ * Encode a start purchase interaction
41
+ */
42
+ declare function startPurchase({ purchaseId, }: {
43
+ purchaseId: Hex;
44
+ }): PreparedInteraction;
45
+ /**
46
+ * Encode a complete purchase interaction
47
+ */
48
+ declare function completedPurchase({ purchaseId, proof, }: {
49
+ purchaseId: Hex;
50
+ proof: Hex[];
51
+ }): PreparedInteraction;
52
+ declare const PurchaseInteractionEncoder: {
53
+ startPurchase: typeof startPurchase;
54
+ completedPurchase: typeof completedPurchase;
55
+ };
56
+
57
+ /**
58
+ * Encode a create referral link interaction
59
+ */
60
+ declare function open(): PreparedInteraction;
61
+ declare const WebShopInteractionEncoder: {
62
+ open: typeof open;
63
+ };
64
+
65
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, WebShopInteractionEncoder };
@@ -1,14 +1,13 @@
1
1
  import {
2
- PressActionsSelector,
3
2
  PressInteractionEncoder,
4
- ReferralActionsSelector,
5
- ReferralInteractionEncoder
6
- } from "../../chunk-IH3QWPWT.js";
7
- import "../../chunk-22T2NHQK.js";
8
- import "../../chunk-PKBMQBKP.js";
3
+ PurchaseInteractionEncoder,
4
+ ReferralInteractionEncoder,
5
+ WebShopInteractionEncoder
6
+ } from "../../chunk-TIKEZMSD.js";
7
+ import "../../chunk-HY6YATLS.js";
9
8
  export {
10
- PressActionsSelector,
11
9
  PressInteractionEncoder,
12
- ReferralActionsSelector,
13
- ReferralInteractionEncoder
10
+ PurchaseInteractionEncoder,
11
+ ReferralInteractionEncoder,
12
+ WebShopInteractionEncoder
14
13
  };
@@ -21,7 +21,7 @@ declare const RpcErrorCodes: {
21
21
  readonly corruptedResponse: -32003;
22
22
  readonly clientAborted: -32004;
23
23
  readonly walletNotConnected: -32005;
24
- readonly noInteractionSession: -32006;
24
+ readonly serverErrorForInteractionDelegation: -32006;
25
25
  };
26
26
 
27
27
  export { FrakRpcError as F, RpcErrorCodes as R };
@@ -21,7 +21,7 @@ declare const RpcErrorCodes: {
21
21
  readonly corruptedResponse: -32003;
22
22
  readonly clientAborted: -32004;
23
23
  readonly walletNotConnected: -32005;
24
- readonly noInteractionSession: -32006;
24
+ readonly serverErrorForInteractionDelegation: -32006;
25
25
  };
26
26
 
27
27
  export { FrakRpcError as F, RpcErrorCodes as R };