@frak-labs/nexus-sdk 0.0.24 → 0.0.26
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.
- package/README.md +2 -72
- package/dist/bundle/bundle.js +6 -6
- package/package.json +11 -64
- package/dist/FrakContext-DKSVaeVb.d.cts +0 -450
- package/dist/FrakContext-DjeuWC2U.d.ts +0 -450
- package/dist/chunk-2VNIEGOJ.js +0 -864
- package/dist/chunk-4MMSQL44.js +0 -351
- package/dist/chunk-4PVF24BB.cjs +0 -114
- package/dist/chunk-BOGCLEPR.js +0 -80
- package/dist/chunk-DE2KWQVP.cjs +0 -351
- package/dist/chunk-FETGS7X7.js +0 -114
- package/dist/chunk-H4BK3CNV.cjs +0 -864
- package/dist/chunk-P3J2BIUT.cjs +0 -80
- package/dist/chunk-QLM5NFMZ.cjs +0 -245
- package/dist/chunk-YPQA63LW.js +0 -245
- package/dist/core/actions/index.cjs +0 -29
- package/dist/core/actions/index.d.cts +0 -92
- package/dist/core/actions/index.d.ts +0 -92
- package/dist/core/actions/index.js +0 -29
- package/dist/core/index.cjs +0 -34
- package/dist/core/index.d.cts +0 -167
- package/dist/core/index.d.ts +0 -167
- package/dist/core/index.js +0 -34
- package/dist/core/interactions/index.cjs +0 -13
- package/dist/core/interactions/index.d.cts +0 -65
- package/dist/core/interactions/index.d.ts +0 -65
- package/dist/core/interactions/index.js +0 -13
- package/dist/error-Dflr3G5x.d.cts +0 -27
- package/dist/error-Dflr3G5x.d.ts +0 -27
- package/dist/interaction-BngPoHA0.d.cts +0 -22
- package/dist/interaction-BngPoHA0.d.ts +0 -22
- package/dist/processReferral-CJI_Rc4K.d.ts +0 -53
- package/dist/processReferral-DUP8imQV.d.cts +0 -53
- package/dist/react/index.cjs +0 -366
- package/dist/react/index.d.cts +0 -167
- package/dist/react/index.d.ts +0 -167
- package/dist/react/index.js +0 -366
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, k as SendTransactionModalStepType, o as FinalModalStepType, q as FinalActionType, L as LoginModalStepType, n as OpenInteractionSessionModalStepType, c as ModalRpcMetadata } from '../../FrakContext-DjeuWC2U.js';
|
|
2
|
-
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
|
-
import { P as ProcessReferralOptions } from '../../processReferral-CJI_Rc4K.js';
|
|
4
|
-
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-CJI_Rc4K.js';
|
|
5
|
-
import { Hex } from 'viem';
|
|
6
|
-
import 'viem/chains';
|
|
7
|
-
import 'viem/siwe';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Function used to watch the current nexus wallet status
|
|
11
|
-
* @param client
|
|
12
|
-
* @param callback
|
|
13
|
-
*/
|
|
14
|
-
declare function watchWalletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Function used to send an interaction
|
|
18
|
-
* @param client
|
|
19
|
-
* @param productId
|
|
20
|
-
* @param interaction
|
|
21
|
-
* @param validation
|
|
22
|
-
*/
|
|
23
|
-
declare function sendInteraction(client: NexusClient, { productId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Function used to display a modal
|
|
27
|
-
* @param client
|
|
28
|
-
* @param args
|
|
29
|
-
*/
|
|
30
|
-
declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Function used to open the SSO
|
|
34
|
-
* @param client
|
|
35
|
-
* @param args
|
|
36
|
-
*/
|
|
37
|
-
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Function used to get the current product information
|
|
41
|
-
* @param client
|
|
42
|
-
*/
|
|
43
|
-
declare function getProductInformation(client: NexusClient): Promise<GetProductInformationReturnType>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Function used to track the status of a purchase
|
|
47
|
-
*/
|
|
48
|
-
declare function trackPurchaseStatus(args: {
|
|
49
|
-
customerId: string | number;
|
|
50
|
-
orderId: string | number;
|
|
51
|
-
token: string;
|
|
52
|
-
}): Promise<void>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Represent the type of the modal step builder
|
|
56
|
-
*/
|
|
57
|
-
type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
58
|
-
params: DisplayModalParamsType<Steps>;
|
|
59
|
-
sendTx: (options: SendTransactionModalStepType["params"]) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;
|
|
60
|
-
reward: (options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
61
|
-
sharing: (sharingOptions?: Extract<FinalActionType, {
|
|
62
|
-
key: "sharing";
|
|
63
|
-
}>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
64
|
-
display: () => Promise<ModalRpcStepsResultType<Steps>>;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Represent the output type of the modal builder
|
|
68
|
-
*/
|
|
69
|
-
type ModalBuilder = ModalStepBuilder<[
|
|
70
|
-
LoginModalStepType,
|
|
71
|
-
OpenInteractionSessionModalStepType
|
|
72
|
-
]>;
|
|
73
|
-
/**
|
|
74
|
-
* Simple modal builder params builder
|
|
75
|
-
* @param client
|
|
76
|
-
* @param metadata
|
|
77
|
-
* @param login
|
|
78
|
-
* @param openSession
|
|
79
|
-
*/
|
|
80
|
-
declare function modalBuilder(client: NexusClient, { metadata, login, openSession, }: {
|
|
81
|
-
metadata?: ModalRpcMetadata;
|
|
82
|
-
login?: LoginModalStepType["params"];
|
|
83
|
-
openSession?: OpenInteractionSessionModalStepType["params"];
|
|
84
|
-
}): ModalBuilder;
|
|
85
|
-
|
|
86
|
-
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
87
|
-
productId?: Hex;
|
|
88
|
-
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
89
|
-
options?: ProcessReferralOptions;
|
|
90
|
-
}): Promise<unknown>;
|
|
91
|
-
|
|
92
|
-
export { type ModalBuilder, type ModalStepBuilder, displayModal, getProductInformation, modalBuilder, openSso, referralInteraction, sendInteraction, trackPurchaseStatus, watchWalletStatus };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
displayModal,
|
|
3
|
-
getProductInformation,
|
|
4
|
-
modalBuilder,
|
|
5
|
-
openSso,
|
|
6
|
-
processReferral,
|
|
7
|
-
referralInteraction,
|
|
8
|
-
sendInteraction,
|
|
9
|
-
sendTransaction,
|
|
10
|
-
siweAuthenticate,
|
|
11
|
-
trackPurchaseStatus,
|
|
12
|
-
watchWalletStatus
|
|
13
|
-
} from "../../chunk-4MMSQL44.js";
|
|
14
|
-
import "../../chunk-2VNIEGOJ.js";
|
|
15
|
-
import "../../chunk-FETGS7X7.js";
|
|
16
|
-
import "../../chunk-BOGCLEPR.js";
|
|
17
|
-
export {
|
|
18
|
-
displayModal,
|
|
19
|
-
getProductInformation,
|
|
20
|
-
modalBuilder,
|
|
21
|
-
openSso,
|
|
22
|
-
processReferral,
|
|
23
|
-
referralInteraction,
|
|
24
|
-
sendInteraction,
|
|
25
|
-
sendTransaction,
|
|
26
|
-
siweAuthenticate,
|
|
27
|
-
trackPurchaseStatus,
|
|
28
|
-
watchWalletStatus
|
|
29
|
-
};
|
package/dist/core/index.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkQLM5NFMZcjs = require('../chunk-QLM5NFMZ.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _chunkH4BK3CNVcjs = require('../chunk-H4BK3CNV.cjs');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _chunkP3J2BIUTcjs = require('../chunk-P3J2BIUT.cjs');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exports.Deferred = _chunkH4BK3CNVcjs.Deferred; exports.FrakContextManager = _chunkH4BK3CNVcjs.FrakContextManager; exports.FrakRpcError = _chunkH4BK3CNVcjs.FrakRpcError; exports.RpcErrorCodes = _chunkH4BK3CNVcjs.RpcErrorCodes; exports.compressJson = _chunkH4BK3CNVcjs.compressJson; exports.createIFrameNexusClient = _chunkQLM5NFMZcjs.createIFrameNexusClient; exports.createIframe = _chunkH4BK3CNVcjs.createIframe; exports.decompressDataAndCheckHash = _chunkH4BK3CNVcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkH4BK3CNVcjs.decompressJson; exports.hashAndCompressData = _chunkH4BK3CNVcjs.hashAndCompressData; exports.interactionTypes = _chunkP3J2BIUTcjs.interactionTypes; exports.productTypes = _chunkP3J2BIUTcjs.productTypes; exports.productTypesMask = _chunkP3J2BIUTcjs.productTypesMask;
|
package/dist/core/index.d.cts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-DKSVaeVb.cjs';
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, v as ExtractedReturnTypeFromRpc, q as FinalActionType, o as FinalModalStepType, G as GetProductInformationReturnType, t as IFrameEvent, u as IFrameLifecycleEvent, s as IFrameRpcEvent, I as IFrameRpcSchema, r as IFrameTransport, L as LoginModalStepType, c as ModalRpcMetadata, d as ModalRpcStepsInput, e as ModalRpcStepsResultType, f as ModalStepMetadata, M as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, k as SendTransactionModalStepType, l as SendTransactionReturnType, j as SendTransactionTxType, g as SiweAuthenticateModalStepType, i as SiweAuthenticateReturnType, h as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, b as productTypesMask } from '../FrakContext-DKSVaeVb.cjs';
|
|
3
|
-
import { Address } from 'viem';
|
|
4
|
-
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
5
|
-
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.cjs';
|
|
6
|
-
import 'viem/chains';
|
|
7
|
-
import 'viem/siwe';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The received encoded data from a client
|
|
11
|
-
* -> The encoded should contain a HashProtectedData once decoded
|
|
12
|
-
*/
|
|
13
|
-
type CompressedData = Readonly<{
|
|
14
|
-
compressed: string;
|
|
15
|
-
compressedHash: string;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* The encoded data to send to a client / received by a client
|
|
19
|
-
*/
|
|
20
|
-
type HashProtectedData<DataType> = Readonly<DataType & {
|
|
21
|
-
validationHash: string;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Represent a key provider used for the hashed and secure compression
|
|
25
|
-
*/
|
|
26
|
-
type KeyProvider<DataType> = (value: DataType) => string[];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Create a new iframe Nexus client
|
|
30
|
-
*/
|
|
31
|
-
declare function createIFrameNexusClient({ config, iframe, }: {
|
|
32
|
-
config: NexusWalletSdkConfig;
|
|
33
|
-
iframe: HTMLIFrameElement;
|
|
34
|
-
}): NexusClient;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create the given iframe
|
|
38
|
-
* @param walletBaseUrl - @deprecated Use config.walletUrl instead. Will be removed in future versions.
|
|
39
|
-
* @param config
|
|
40
|
-
*/
|
|
41
|
-
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
|
-
walletBaseUrl?: string;
|
|
43
|
-
config?: NexusWalletSdkConfig;
|
|
44
|
-
}): Promise<HTMLIFrameElement | undefined>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Compress the given params, and add hash protection to (rapidly) prevent interception modification
|
|
48
|
-
* @param data The params to encode
|
|
49
|
-
*/
|
|
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>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Decompress the given string
|
|
59
|
-
* @param compressedData The params to encode
|
|
60
|
-
*/
|
|
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
|
-
* Compress the current Frak context
|
|
70
|
-
* @param context
|
|
71
|
-
*/
|
|
72
|
-
declare function compress(context?: Partial<FrakContext>): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Decompress the given Frak context
|
|
75
|
-
* @param context
|
|
76
|
-
*/
|
|
77
|
-
declare function decompress(context?: string): FrakContext | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Parse the current Frak context in the given url
|
|
80
|
-
* @param url
|
|
81
|
-
*/
|
|
82
|
-
declare function parse({ url }: {
|
|
83
|
-
url: string;
|
|
84
|
-
}): Readonly<{
|
|
85
|
-
r: Address;
|
|
86
|
-
}> | null | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Populate the current url with the given Frak context
|
|
89
|
-
*/
|
|
90
|
-
declare function update({ url, context, }: {
|
|
91
|
-
url?: string;
|
|
92
|
-
context: Partial<FrakContext>;
|
|
93
|
-
}): string | null;
|
|
94
|
-
/**
|
|
95
|
-
* Remove Nexus context from current url
|
|
96
|
-
*/
|
|
97
|
-
declare function remove(url: string): string;
|
|
98
|
-
/**
|
|
99
|
-
* Replace the current url with the given Nexus context
|
|
100
|
-
* @param url
|
|
101
|
-
* @param context
|
|
102
|
-
*/
|
|
103
|
-
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
104
|
-
url?: string;
|
|
105
|
-
context: Partial<FrakContext> | null;
|
|
106
|
-
}): void;
|
|
107
|
-
/**
|
|
108
|
-
* Export our frak context "class"
|
|
109
|
-
*/
|
|
110
|
-
declare const FrakContextManager: {
|
|
111
|
-
compress: typeof compress;
|
|
112
|
-
decompress: typeof decompress;
|
|
113
|
-
parse: typeof parse;
|
|
114
|
-
update: typeof update;
|
|
115
|
-
remove: typeof remove;
|
|
116
|
-
replaceUrl: typeof replaceUrl;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
declare class Deferred<T> {
|
|
120
|
-
private readonly _promise;
|
|
121
|
-
private _resolve;
|
|
122
|
-
private _reject;
|
|
123
|
-
constructor();
|
|
124
|
-
get promise(): Promise<T>;
|
|
125
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
126
|
-
reject: (reason?: unknown) => void;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
131
|
-
*/
|
|
132
|
-
type InteractionTypesKey = {
|
|
133
|
-
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
134
|
-
}[keyof typeof interactionTypes];
|
|
135
|
-
/**
|
|
136
|
-
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
137
|
-
*/
|
|
138
|
-
type FullInteractionTypesKey = {
|
|
139
|
-
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
140
|
-
}[keyof typeof interactionTypes];
|
|
141
|
-
/**
|
|
142
|
-
* Each interactions types according to the product types
|
|
143
|
-
*/
|
|
144
|
-
declare const interactionTypes: {
|
|
145
|
-
readonly press: {
|
|
146
|
-
readonly openArticle: "0xc0a24ffb";
|
|
147
|
-
readonly readArticle: "0xd5bd0fbe";
|
|
148
|
-
};
|
|
149
|
-
readonly dapp: {
|
|
150
|
-
readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
|
|
151
|
-
readonly callableVerifiableStorageUpdate: "0xa07da986";
|
|
152
|
-
};
|
|
153
|
-
readonly webshop: {
|
|
154
|
-
readonly open: "0xb311798f";
|
|
155
|
-
};
|
|
156
|
-
readonly referral: {
|
|
157
|
-
readonly referred: "0x010cc3b9";
|
|
158
|
-
readonly createLink: "0xb2c0f17c";
|
|
159
|
-
};
|
|
160
|
-
readonly purchase: {
|
|
161
|
-
readonly started: "0xd87e90c3";
|
|
162
|
-
readonly completed: "0x8403aeb4";
|
|
163
|
-
readonly unsafeCompleted: "0x4d5b14e0";
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export { type CompressedData, Deferred, FrakContextManager, type FullInteractionTypesKey, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes };
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-DjeuWC2U.js';
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, v as ExtractedReturnTypeFromRpc, q as FinalActionType, o as FinalModalStepType, G as GetProductInformationReturnType, t as IFrameEvent, u as IFrameLifecycleEvent, s as IFrameRpcEvent, I as IFrameRpcSchema, r as IFrameTransport, L as LoginModalStepType, c as ModalRpcMetadata, d as ModalRpcStepsInput, e as ModalRpcStepsResultType, f as ModalStepMetadata, M as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, k as SendTransactionModalStepType, l as SendTransactionReturnType, j as SendTransactionTxType, g as SiweAuthenticateModalStepType, i as SiweAuthenticateReturnType, h as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, b as productTypesMask } from '../FrakContext-DjeuWC2U.js';
|
|
3
|
-
import { Address } from 'viem';
|
|
4
|
-
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
5
|
-
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.js';
|
|
6
|
-
import 'viem/chains';
|
|
7
|
-
import 'viem/siwe';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The received encoded data from a client
|
|
11
|
-
* -> The encoded should contain a HashProtectedData once decoded
|
|
12
|
-
*/
|
|
13
|
-
type CompressedData = Readonly<{
|
|
14
|
-
compressed: string;
|
|
15
|
-
compressedHash: string;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* The encoded data to send to a client / received by a client
|
|
19
|
-
*/
|
|
20
|
-
type HashProtectedData<DataType> = Readonly<DataType & {
|
|
21
|
-
validationHash: string;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Represent a key provider used for the hashed and secure compression
|
|
25
|
-
*/
|
|
26
|
-
type KeyProvider<DataType> = (value: DataType) => string[];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Create a new iframe Nexus client
|
|
30
|
-
*/
|
|
31
|
-
declare function createIFrameNexusClient({ config, iframe, }: {
|
|
32
|
-
config: NexusWalletSdkConfig;
|
|
33
|
-
iframe: HTMLIFrameElement;
|
|
34
|
-
}): NexusClient;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create the given iframe
|
|
38
|
-
* @param walletBaseUrl - @deprecated Use config.walletUrl instead. Will be removed in future versions.
|
|
39
|
-
* @param config
|
|
40
|
-
*/
|
|
41
|
-
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
|
-
walletBaseUrl?: string;
|
|
43
|
-
config?: NexusWalletSdkConfig;
|
|
44
|
-
}): Promise<HTMLIFrameElement | undefined>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Compress the given params, and add hash protection to (rapidly) prevent interception modification
|
|
48
|
-
* @param data The params to encode
|
|
49
|
-
*/
|
|
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>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Decompress the given string
|
|
59
|
-
* @param compressedData The params to encode
|
|
60
|
-
*/
|
|
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
|
-
* Compress the current Frak context
|
|
70
|
-
* @param context
|
|
71
|
-
*/
|
|
72
|
-
declare function compress(context?: Partial<FrakContext>): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Decompress the given Frak context
|
|
75
|
-
* @param context
|
|
76
|
-
*/
|
|
77
|
-
declare function decompress(context?: string): FrakContext | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Parse the current Frak context in the given url
|
|
80
|
-
* @param url
|
|
81
|
-
*/
|
|
82
|
-
declare function parse({ url }: {
|
|
83
|
-
url: string;
|
|
84
|
-
}): Readonly<{
|
|
85
|
-
r: Address;
|
|
86
|
-
}> | null | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Populate the current url with the given Frak context
|
|
89
|
-
*/
|
|
90
|
-
declare function update({ url, context, }: {
|
|
91
|
-
url?: string;
|
|
92
|
-
context: Partial<FrakContext>;
|
|
93
|
-
}): string | null;
|
|
94
|
-
/**
|
|
95
|
-
* Remove Nexus context from current url
|
|
96
|
-
*/
|
|
97
|
-
declare function remove(url: string): string;
|
|
98
|
-
/**
|
|
99
|
-
* Replace the current url with the given Nexus context
|
|
100
|
-
* @param url
|
|
101
|
-
* @param context
|
|
102
|
-
*/
|
|
103
|
-
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
104
|
-
url?: string;
|
|
105
|
-
context: Partial<FrakContext> | null;
|
|
106
|
-
}): void;
|
|
107
|
-
/**
|
|
108
|
-
* Export our frak context "class"
|
|
109
|
-
*/
|
|
110
|
-
declare const FrakContextManager: {
|
|
111
|
-
compress: typeof compress;
|
|
112
|
-
decompress: typeof decompress;
|
|
113
|
-
parse: typeof parse;
|
|
114
|
-
update: typeof update;
|
|
115
|
-
remove: typeof remove;
|
|
116
|
-
replaceUrl: typeof replaceUrl;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
declare class Deferred<T> {
|
|
120
|
-
private readonly _promise;
|
|
121
|
-
private _resolve;
|
|
122
|
-
private _reject;
|
|
123
|
-
constructor();
|
|
124
|
-
get promise(): Promise<T>;
|
|
125
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
126
|
-
reject: (reason?: unknown) => void;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
131
|
-
*/
|
|
132
|
-
type InteractionTypesKey = {
|
|
133
|
-
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
134
|
-
}[keyof typeof interactionTypes];
|
|
135
|
-
/**
|
|
136
|
-
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
137
|
-
*/
|
|
138
|
-
type FullInteractionTypesKey = {
|
|
139
|
-
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
140
|
-
}[keyof typeof interactionTypes];
|
|
141
|
-
/**
|
|
142
|
-
* Each interactions types according to the product types
|
|
143
|
-
*/
|
|
144
|
-
declare const interactionTypes: {
|
|
145
|
-
readonly press: {
|
|
146
|
-
readonly openArticle: "0xc0a24ffb";
|
|
147
|
-
readonly readArticle: "0xd5bd0fbe";
|
|
148
|
-
};
|
|
149
|
-
readonly dapp: {
|
|
150
|
-
readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
|
|
151
|
-
readonly callableVerifiableStorageUpdate: "0xa07da986";
|
|
152
|
-
};
|
|
153
|
-
readonly webshop: {
|
|
154
|
-
readonly open: "0xb311798f";
|
|
155
|
-
};
|
|
156
|
-
readonly referral: {
|
|
157
|
-
readonly referred: "0x010cc3b9";
|
|
158
|
-
readonly createLink: "0xb2c0f17c";
|
|
159
|
-
};
|
|
160
|
-
readonly purchase: {
|
|
161
|
-
readonly started: "0xd87e90c3";
|
|
162
|
-
readonly completed: "0x8403aeb4";
|
|
163
|
-
readonly unsafeCompleted: "0x4d5b14e0";
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export { type CompressedData, Deferred, FrakContextManager, type FullInteractionTypesKey, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes };
|
package/dist/core/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-YPQA63LW.js";
|
|
4
|
-
import {
|
|
5
|
-
Deferred,
|
|
6
|
-
FrakContextManager,
|
|
7
|
-
FrakRpcError,
|
|
8
|
-
RpcErrorCodes,
|
|
9
|
-
compressJson,
|
|
10
|
-
createIframe,
|
|
11
|
-
decompressDataAndCheckHash,
|
|
12
|
-
decompressJson,
|
|
13
|
-
hashAndCompressData
|
|
14
|
-
} from "../chunk-2VNIEGOJ.js";
|
|
15
|
-
import {
|
|
16
|
-
interactionTypes,
|
|
17
|
-
productTypes,
|
|
18
|
-
productTypesMask
|
|
19
|
-
} from "../chunk-BOGCLEPR.js";
|
|
20
|
-
export {
|
|
21
|
-
Deferred,
|
|
22
|
-
FrakContextManager,
|
|
23
|
-
FrakRpcError,
|
|
24
|
-
RpcErrorCodes,
|
|
25
|
-
compressJson,
|
|
26
|
-
createIFrameNexusClient,
|
|
27
|
-
createIframe,
|
|
28
|
-
decompressDataAndCheckHash,
|
|
29
|
-
decompressJson,
|
|
30
|
-
hashAndCompressData,
|
|
31
|
-
interactionTypes,
|
|
32
|
-
productTypes,
|
|
33
|
-
productTypesMask
|
|
34
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk4PVF24BBcjs = require('../../chunk-4PVF24BB.cjs');
|
|
7
|
-
require('../../chunk-P3J2BIUT.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.PressInteractionEncoder = _chunk4PVF24BBcjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunk4PVF24BBcjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunk4PVF24BBcjs.ReferralInteractionEncoder; exports.WebShopInteractionEncoder = _chunk4PVF24BBcjs.WebShopInteractionEncoder;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Hex, Address } from 'viem';
|
|
2
|
-
import { P as PreparedInteraction } from '../../interaction-BngPoHA0.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Encode an open article interaction
|
|
6
|
-
* @param articleId
|
|
7
|
-
*/
|
|
8
|
-
declare function openArticle({ articleId }: {
|
|
9
|
-
articleId: Hex;
|
|
10
|
-
}): PreparedInteraction;
|
|
11
|
-
/**
|
|
12
|
-
* Encode a read article interaction
|
|
13
|
-
* @param articleId
|
|
14
|
-
*/
|
|
15
|
-
declare function readArticle({ articleId }: {
|
|
16
|
-
articleId: Hex;
|
|
17
|
-
}): PreparedInteraction;
|
|
18
|
-
declare const PressInteractionEncoder: {
|
|
19
|
-
openArticle: typeof openArticle;
|
|
20
|
-
readArticle: typeof readArticle;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Encode a create referral link interaction
|
|
25
|
-
*/
|
|
26
|
-
declare function createLink(): PreparedInteraction;
|
|
27
|
-
/**
|
|
28
|
-
* Encode a referred interaction
|
|
29
|
-
* @param referrer
|
|
30
|
-
*/
|
|
31
|
-
declare function referred({ referrer }: {
|
|
32
|
-
referrer: Address;
|
|
33
|
-
}): PreparedInteraction;
|
|
34
|
-
declare const ReferralInteractionEncoder: {
|
|
35
|
-
createLink: typeof createLink;
|
|
36
|
-
referred: typeof referred;
|
|
37
|
-
};
|
|
38
|
-
|
|
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,65 +0,0 @@
|
|
|
1
|
-
import { Hex, Address } from 'viem';
|
|
2
|
-
import { P as PreparedInteraction } from '../../interaction-BngPoHA0.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Encode an open article interaction
|
|
6
|
-
* @param articleId
|
|
7
|
-
*/
|
|
8
|
-
declare function openArticle({ articleId }: {
|
|
9
|
-
articleId: Hex;
|
|
10
|
-
}): PreparedInteraction;
|
|
11
|
-
/**
|
|
12
|
-
* Encode a read article interaction
|
|
13
|
-
* @param articleId
|
|
14
|
-
*/
|
|
15
|
-
declare function readArticle({ articleId }: {
|
|
16
|
-
articleId: Hex;
|
|
17
|
-
}): PreparedInteraction;
|
|
18
|
-
declare const PressInteractionEncoder: {
|
|
19
|
-
openArticle: typeof openArticle;
|
|
20
|
-
readArticle: typeof readArticle;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Encode a create referral link interaction
|
|
25
|
-
*/
|
|
26
|
-
declare function createLink(): PreparedInteraction;
|
|
27
|
-
/**
|
|
28
|
-
* Encode a referred interaction
|
|
29
|
-
* @param referrer
|
|
30
|
-
*/
|
|
31
|
-
declare function referred({ referrer }: {
|
|
32
|
-
referrer: Address;
|
|
33
|
-
}): PreparedInteraction;
|
|
34
|
-
declare const ReferralInteractionEncoder: {
|
|
35
|
-
createLink: typeof createLink;
|
|
36
|
-
referred: typeof referred;
|
|
37
|
-
};
|
|
38
|
-
|
|
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 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PressInteractionEncoder,
|
|
3
|
-
PurchaseInteractionEncoder,
|
|
4
|
-
ReferralInteractionEncoder,
|
|
5
|
-
WebShopInteractionEncoder
|
|
6
|
-
} from "../../chunk-FETGS7X7.js";
|
|
7
|
-
import "../../chunk-BOGCLEPR.js";
|
|
8
|
-
export {
|
|
9
|
-
PressInteractionEncoder,
|
|
10
|
-
PurchaseInteractionEncoder,
|
|
11
|
-
ReferralInteractionEncoder,
|
|
12
|
-
WebShopInteractionEncoder
|
|
13
|
-
};
|