@frak-labs/nexus-sdk 0.0.19 → 0.0.21
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/dist/{client-DaEox5q4.d.cts → FrakContext-BsezWx2F.d.cts} +8 -1
- package/dist/{client-ALy_TEwJ.d.ts → FrakContext-p0Jtv9gl.d.ts} +8 -1
- package/dist/bundle/bundle.js +3 -3
- package/dist/{chunk-LAO7FUQ2.cjs → chunk-BSCR57ZI.cjs} +66 -44
- package/dist/{chunk-YDZBXUC4.cjs → chunk-E527CMMJ.cjs} +14 -8
- package/dist/{chunk-ACCWBBZ7.js → chunk-MDGMJ6EQ.js} +59 -37
- package/dist/{chunk-2SDBW6QC.cjs → chunk-WXNW7ZMU.cjs} +18 -18
- package/dist/{chunk-7K4L7VQC.js → chunk-ZRPCX25Q.js} +13 -7
- package/dist/{chunk-54MUKMZK.js → chunk-ZZ7LUFNV.js} +1 -1
- package/dist/core/actions/index.cjs +3 -3
- package/dist/core/actions/index.d.cts +6 -21
- package/dist/core/actions/index.d.ts +6 -21
- package/dist/core/actions/index.js +2 -2
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.d.cts +5 -6
- package/dist/core/index.d.ts +5 -6
- package/dist/core/index.js +2 -2
- package/dist/processReferral-YbCg90hu.d.cts +53 -0
- package/dist/processReferral-t3gUNwJu.d.ts +53 -0
- package/dist/react/index.cjs +29 -26
- package/dist/react/index.d.cts +5 -3
- package/dist/react/index.d.ts +5 -3
- package/dist/react/index.js +8 -5
- package/package.json +1 -1
- package/dist/FrakContext-LbQht1ep.d.cts +0 -10
- package/dist/FrakContext-LbQht1ep.d.ts +0 -10
- package/dist/sendTransaction-BOd-pvXr.d.ts +0 -30
- package/dist/sendTransaction-MhdJPTWd.d.cts +0 -30
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FrakContextManager,
|
|
4
4
|
FrakRpcError,
|
|
5
5
|
RpcErrorCodes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZRPCX25Q.js";
|
|
7
7
|
import {
|
|
8
8
|
ReferralInteractionEncoder
|
|
9
9
|
} from "./chunk-TIKEZMSD.js";
|
|
@@ -106,49 +106,69 @@ async function processReferral(client, {
|
|
|
106
106
|
walletStatus: walletStatus2,
|
|
107
107
|
frakContext,
|
|
108
108
|
modalConfig,
|
|
109
|
-
productId
|
|
109
|
+
productId,
|
|
110
|
+
options
|
|
110
111
|
}) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
FrakContextManager.replaceUrl({
|
|
116
|
-
url: window.location?.href,
|
|
117
|
-
context: { r: currentWallet }
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return "no-referrer";
|
|
121
|
-
}
|
|
122
|
-
if (!currentWallet) {
|
|
123
|
-
currentWallet = await ensureWalletConnected(client, {
|
|
124
|
-
modalConfig,
|
|
125
|
-
walletStatus: walletStatus2
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
if (currentWallet && isAddressEqual(frakContext.r, currentWallet)) {
|
|
129
|
-
return "self-referral";
|
|
130
|
-
}
|
|
131
|
-
if (!walletStatus2?.interactionSession) {
|
|
132
|
-
currentWallet = await ensureWalletConnected(client, {
|
|
133
|
-
modalConfig,
|
|
134
|
-
walletStatus: walletStatus2
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
if (currentWallet) {
|
|
138
|
-
FrakContextManager.replaceUrl({
|
|
139
|
-
url: window.location?.href,
|
|
140
|
-
context: { r: currentWallet }
|
|
141
|
-
});
|
|
112
|
+
let walletRequest = false;
|
|
113
|
+
async function getFreshWalletStatus() {
|
|
114
|
+
if (walletRequest) {
|
|
115
|
+
return;
|
|
142
116
|
}
|
|
117
|
+
walletRequest = true;
|
|
118
|
+
return ensureWalletConnected(client, {
|
|
119
|
+
modalConfig,
|
|
120
|
+
walletStatus: walletStatus2
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async function pushReferralInteraction(referrer) {
|
|
143
124
|
const interaction = ReferralInteractionEncoder.referred({
|
|
144
|
-
referrer
|
|
125
|
+
referrer
|
|
145
126
|
});
|
|
146
127
|
await sendInteraction(client, { productId, interaction });
|
|
147
|
-
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const { status, currentWallet } = await processReferralLogic({
|
|
131
|
+
initialWalletStatus: walletStatus2,
|
|
132
|
+
getFreshWalletStatus,
|
|
133
|
+
pushReferralInteraction,
|
|
134
|
+
frakContext
|
|
135
|
+
});
|
|
136
|
+
FrakContextManager.replaceUrl({
|
|
137
|
+
url: window.location?.href,
|
|
138
|
+
context: options?.alwaysAppendUrl ? { r: currentWallet } : null
|
|
139
|
+
});
|
|
140
|
+
return status;
|
|
148
141
|
} catch (error) {
|
|
142
|
+
console.log("Error processing referral", { error });
|
|
143
|
+
FrakContextManager.replaceUrl({
|
|
144
|
+
url: window.location?.href,
|
|
145
|
+
context: options?.alwaysAppendUrl ? { r: walletStatus2?.wallet } : null
|
|
146
|
+
});
|
|
149
147
|
return mapErrorToState(error);
|
|
150
148
|
}
|
|
151
149
|
}
|
|
150
|
+
async function processReferralLogic({
|
|
151
|
+
initialWalletStatus,
|
|
152
|
+
getFreshWalletStatus,
|
|
153
|
+
pushReferralInteraction,
|
|
154
|
+
frakContext
|
|
155
|
+
}) {
|
|
156
|
+
let currentWallet = initialWalletStatus?.wallet;
|
|
157
|
+
if (!frakContext?.r) {
|
|
158
|
+
return { status: "no-referrer", currentWallet };
|
|
159
|
+
}
|
|
160
|
+
if (!currentWallet) {
|
|
161
|
+
currentWallet = await getFreshWalletStatus();
|
|
162
|
+
}
|
|
163
|
+
if (currentWallet && isAddressEqual(frakContext.r, currentWallet)) {
|
|
164
|
+
return { status: "self-referral", currentWallet };
|
|
165
|
+
}
|
|
166
|
+
if (!initialWalletStatus?.interactionSession) {
|
|
167
|
+
currentWallet = await getFreshWalletStatus();
|
|
168
|
+
}
|
|
169
|
+
await pushReferralInteraction(frakContext.r);
|
|
170
|
+
return { status: "success", currentWallet };
|
|
171
|
+
}
|
|
152
172
|
async function ensureWalletConnected(client, {
|
|
153
173
|
modalConfig,
|
|
154
174
|
walletStatus: walletStatus2
|
|
@@ -179,7 +199,8 @@ function mapErrorToState(error) {
|
|
|
179
199
|
// src/core/actions/referral/referralInteraction.ts
|
|
180
200
|
async function referralInteraction(client, {
|
|
181
201
|
productId,
|
|
182
|
-
modalConfig
|
|
202
|
+
modalConfig,
|
|
203
|
+
options
|
|
183
204
|
} = {}) {
|
|
184
205
|
const frakContext = FrakContextManager.parse({
|
|
185
206
|
url: window.location.href
|
|
@@ -190,7 +211,8 @@ async function referralInteraction(client, {
|
|
|
190
211
|
walletStatus: currentWalletStatus,
|
|
191
212
|
frakContext,
|
|
192
213
|
modalConfig,
|
|
193
|
-
productId
|
|
214
|
+
productId,
|
|
215
|
+
options
|
|
194
216
|
});
|
|
195
217
|
} catch (error) {
|
|
196
218
|
return error;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkE527CMMJcjs = require('./chunk-E527CMMJ.cjs');
|
|
10
10
|
|
|
11
11
|
// src/core/utils/constants.ts
|
|
12
12
|
var BACKUP_KEY = "nexus-wallet-backup";
|
|
@@ -31,7 +31,7 @@ function createIFrameChannelManager() {
|
|
|
31
31
|
function createIFrameLifecycleManager({
|
|
32
32
|
iframe
|
|
33
33
|
}) {
|
|
34
|
-
const isConnectedDeferred = new (0,
|
|
34
|
+
const isConnectedDeferred = new (0, _chunkE527CMMJcjs.Deferred)();
|
|
35
35
|
const handler = async (messageEvent) => {
|
|
36
36
|
switch (messageEvent.iframeLifecycle) {
|
|
37
37
|
// Resolve the isConnected promise
|
|
@@ -53,7 +53,7 @@ function createIFrameLifecycleManager({
|
|
|
53
53
|
// Change iframe visibility
|
|
54
54
|
case "show":
|
|
55
55
|
case "hide":
|
|
56
|
-
|
|
56
|
+
_chunkE527CMMJcjs.changeIframeVisibility.call(void 0, {
|
|
57
57
|
iframe,
|
|
58
58
|
isVisible: messageEvent.iframeLifecycle === "show"
|
|
59
59
|
});
|
|
@@ -74,14 +74,14 @@ function createIFrameMessageHandler({
|
|
|
74
74
|
iframeLifecycleManager
|
|
75
75
|
}) {
|
|
76
76
|
if (typeof window === "undefined") {
|
|
77
|
-
throw new (0,
|
|
78
|
-
|
|
77
|
+
throw new (0, _chunkE527CMMJcjs.FrakRpcError)(
|
|
78
|
+
_chunkE527CMMJcjs.RpcErrorCodes.configError,
|
|
79
79
|
"iframe client should be used in the browser"
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
if (!iframe.contentWindow) {
|
|
83
|
-
throw new (0,
|
|
84
|
-
|
|
83
|
+
throw new (0, _chunkE527CMMJcjs.FrakRpcError)(
|
|
84
|
+
_chunkE527CMMJcjs.RpcErrorCodes.configError,
|
|
85
85
|
"The iframe does not have a product window"
|
|
86
86
|
);
|
|
87
87
|
}
|
|
@@ -141,17 +141,17 @@ function createIFrameNexusClient({
|
|
|
141
141
|
const request = async (args) => {
|
|
142
142
|
const isConnected = await lifecycleManager.isConnected;
|
|
143
143
|
if (!isConnected) {
|
|
144
|
-
throw new (0,
|
|
145
|
-
|
|
144
|
+
throw new (0, _chunkE527CMMJcjs.FrakRpcError)(
|
|
145
|
+
_chunkE527CMMJcjs.RpcErrorCodes.clientNotConnected,
|
|
146
146
|
"The iframe provider isn't connected yet"
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
|
-
const result = new (0,
|
|
149
|
+
const result = new (0, _chunkE527CMMJcjs.Deferred)();
|
|
150
150
|
const channelId = channelManager.createChannel(async (message) => {
|
|
151
|
-
const decompressed = await
|
|
151
|
+
const decompressed = await _chunkE527CMMJcjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
152
152
|
if (decompressed.error) {
|
|
153
153
|
result.reject(
|
|
154
|
-
new (0,
|
|
154
|
+
new (0, _chunkE527CMMJcjs.FrakRpcError)(
|
|
155
155
|
decompressed.error.code,
|
|
156
156
|
decompressed.error.message,
|
|
157
157
|
_optionalChain([decompressed, 'access', _ => _.error, 'optionalAccess', _2 => _2.data])
|
|
@@ -162,7 +162,7 @@ function createIFrameNexusClient({
|
|
|
162
162
|
}
|
|
163
163
|
channelManager.removeChannel(channelId);
|
|
164
164
|
});
|
|
165
|
-
const compressedMessage = await
|
|
165
|
+
const compressedMessage = await _chunkE527CMMJcjs.hashAndCompressData.call(void 0, args);
|
|
166
166
|
messageHandler.sendEvent({
|
|
167
167
|
id: channelId,
|
|
168
168
|
topic: args.method,
|
|
@@ -173,20 +173,20 @@ function createIFrameNexusClient({
|
|
|
173
173
|
const listenerRequest = async (args, callback) => {
|
|
174
174
|
const isConnected = await lifecycleManager.isConnected;
|
|
175
175
|
if (!isConnected) {
|
|
176
|
-
throw new (0,
|
|
177
|
-
|
|
176
|
+
throw new (0, _chunkE527CMMJcjs.FrakRpcError)(
|
|
177
|
+
_chunkE527CMMJcjs.RpcErrorCodes.clientNotConnected,
|
|
178
178
|
"The iframe provider isn't connected yet"
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
const channelId = channelManager.createChannel(async (message) => {
|
|
182
|
-
const decompressed = await
|
|
182
|
+
const decompressed = await _chunkE527CMMJcjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
183
183
|
if (decompressed.result) {
|
|
184
184
|
callback(decompressed.result);
|
|
185
185
|
} else {
|
|
186
|
-
throw new (0,
|
|
186
|
+
throw new (0, _chunkE527CMMJcjs.InternalError)("No valid result in the response");
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
-
const compressedMessage = await
|
|
189
|
+
const compressedMessage = await _chunkE527CMMJcjs.hashAndCompressData.call(void 0, args);
|
|
190
190
|
messageHandler.sendEvent({
|
|
191
191
|
id: channelId,
|
|
192
192
|
topic: args.method,
|
|
@@ -235,9 +235,9 @@ function update({
|
|
|
235
235
|
if (!url) return null;
|
|
236
236
|
const currentContext = parse({ url });
|
|
237
237
|
const mergedContext = currentContext ? { ...currentContext, ...context } : context;
|
|
238
|
-
if (!mergedContext.r) return;
|
|
238
|
+
if (!mergedContext.r) return null;
|
|
239
239
|
const compressedContext = compress(mergedContext);
|
|
240
|
-
if (!compressedContext) return;
|
|
240
|
+
if (!compressedContext) return null;
|
|
241
241
|
const urlObj = new URL(url);
|
|
242
242
|
urlObj.searchParams.set(contextKey, compressedContext);
|
|
243
243
|
return urlObj.toString();
|
|
@@ -248,17 +248,23 @@ function remove(url) {
|
|
|
248
248
|
return urlObj.toString();
|
|
249
249
|
}
|
|
250
250
|
function replaceUrl({
|
|
251
|
-
url,
|
|
251
|
+
url: baseUrl,
|
|
252
252
|
context
|
|
253
253
|
}) {
|
|
254
254
|
if (!window.location?.href || typeof window === "undefined") {
|
|
255
255
|
console.error("No window found, can't update context");
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
const url = baseUrl ?? window.location.href;
|
|
259
|
+
let newUrl;
|
|
260
|
+
if (context !== null) {
|
|
261
|
+
newUrl = update({
|
|
262
|
+
url,
|
|
263
|
+
context
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
newUrl = remove(url);
|
|
267
|
+
}
|
|
262
268
|
if (!newUrl) return;
|
|
263
269
|
window.history.replaceState(null, "", newUrl.toString());
|
|
264
270
|
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../../chunk-
|
|
11
|
+
var _chunkBSCR57ZIcjs = require('../../chunk-BSCR57ZI.cjs');
|
|
12
|
+
require('../../chunk-E527CMMJ.cjs');
|
|
13
13
|
require('../../chunk-A3XYA7S7.cjs');
|
|
14
14
|
require('../../chunk-UFJ7W6CQ.cjs');
|
|
15
15
|
|
|
@@ -22,4 +22,4 @@ require('../../chunk-UFJ7W6CQ.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
exports.displayModal =
|
|
25
|
+
exports.displayModal = _chunkBSCR57ZIcjs.displayModal; exports.openSso = _chunkBSCR57ZIcjs.openSso; exports.processReferral = _chunkBSCR57ZIcjs.processReferral; exports.referralInteraction = _chunkBSCR57ZIcjs.referralInteraction; exports.sendInteraction = _chunkBSCR57ZIcjs.sendInteraction; exports.sendTransaction = _chunkBSCR57ZIcjs.sendTransaction; exports.siweAuthenticate = _chunkBSCR57ZIcjs.siweAuthenticate; exports.walletStatus = _chunkBSCR57ZIcjs.walletStatus; exports.watchWalletStatus = _chunkBSCR57ZIcjs.watchWalletStatus;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../FrakContext-BsezWx2F.cjs';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
|
|
3
|
-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-YbCg90hu.cjs';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-YbCg90hu.cjs';
|
|
4
5
|
import { Hex } from 'viem';
|
|
5
|
-
import { F as FrakContext } from '../../FrakContext-LbQht1ep.cjs';
|
|
6
6
|
import 'viem/chains';
|
|
7
7
|
import 'viem/siwe';
|
|
8
8
|
|
|
@@ -38,25 +38,10 @@ declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<
|
|
|
38
38
|
|
|
39
39
|
declare function walletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
40
40
|
|
|
41
|
-
declare function referralInteraction(client: NexusClient, { productId, modalConfig, }?: {
|
|
41
|
+
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
42
|
productId?: Hex;
|
|
43
43
|
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
44
|
+
options?: ProcessReferralOptions;
|
|
44
45
|
}): Promise<unknown>;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Automatically submit a referral interaction when detected
|
|
49
|
-
* -> And automatically set the referral context in the url
|
|
50
|
-
* @param walletStatus
|
|
51
|
-
* @param frakContext
|
|
52
|
-
* @param modalConfig
|
|
53
|
-
* @param productId
|
|
54
|
-
*/
|
|
55
|
-
declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, }: {
|
|
56
|
-
walletStatus?: WalletStatusReturnType;
|
|
57
|
-
frakContext?: Partial<FrakContext> | null;
|
|
58
|
-
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
59
|
-
productId?: Hex;
|
|
60
|
-
}): Promise<ReferralState>;
|
|
61
|
-
|
|
62
|
-
export { displayModal, openSso, processReferral, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
|
|
47
|
+
export { displayModal, openSso, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../FrakContext-p0Jtv9gl.js';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
|
-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-t3gUNwJu.js';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-t3gUNwJu.js';
|
|
4
5
|
import { Hex } from 'viem';
|
|
5
|
-
import { F as FrakContext } from '../../FrakContext-LbQht1ep.js';
|
|
6
6
|
import 'viem/chains';
|
|
7
7
|
import 'viem/siwe';
|
|
8
8
|
|
|
@@ -38,25 +38,10 @@ declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<
|
|
|
38
38
|
|
|
39
39
|
declare function walletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
40
40
|
|
|
41
|
-
declare function referralInteraction(client: NexusClient, { productId, modalConfig, }?: {
|
|
41
|
+
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
42
|
productId?: Hex;
|
|
43
43
|
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
44
|
+
options?: ProcessReferralOptions;
|
|
44
45
|
}): Promise<unknown>;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Automatically submit a referral interaction when detected
|
|
49
|
-
* -> And automatically set the referral context in the url
|
|
50
|
-
* @param walletStatus
|
|
51
|
-
* @param frakContext
|
|
52
|
-
* @param modalConfig
|
|
53
|
-
* @param productId
|
|
54
|
-
*/
|
|
55
|
-
declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, }: {
|
|
56
|
-
walletStatus?: WalletStatusReturnType;
|
|
57
|
-
frakContext?: Partial<FrakContext> | null;
|
|
58
|
-
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
59
|
-
productId?: Hex;
|
|
60
|
-
}): Promise<ReferralState>;
|
|
61
|
-
|
|
62
|
-
export { displayModal, openSso, processReferral, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
|
|
47
|
+
export { displayModal, openSso, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
siweAuthenticate,
|
|
9
9
|
walletStatus,
|
|
10
10
|
watchWalletStatus
|
|
11
|
-
} from "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
} from "../../chunk-MDGMJ6EQ.js";
|
|
12
|
+
import "../../chunk-ZRPCX25Q.js";
|
|
13
13
|
import "../../chunk-TIKEZMSD.js";
|
|
14
14
|
import "../../chunk-HY6YATLS.js";
|
|
15
15
|
export {
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWXNW7ZMUcjs = require('../chunk-WXNW7ZMU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ var _chunk2SDBW6QCcjs = require('../chunk-2SDBW6QC.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkE527CMMJcjs = require('../chunk-E527CMMJ.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -31,4 +31,4 @@ var _chunkUFJ7W6CQcjs = require('../chunk-UFJ7W6CQ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.Deferred =
|
|
34
|
+
exports.Deferred = _chunkE527CMMJcjs.Deferred; exports.FrakContextManager = _chunkE527CMMJcjs.FrakContextManager; exports.FrakRpcError = _chunkE527CMMJcjs.FrakRpcError; exports.RpcErrorCodes = _chunkE527CMMJcjs.RpcErrorCodes; exports.compressJson = _chunkE527CMMJcjs.compressJson; exports.createIFrameNexusClient = _chunkWXNW7ZMUcjs.createIFrameNexusClient; exports.createIframe = _chunkE527CMMJcjs.createIframe; exports.decompressDataAndCheckHash = _chunkE527CMMJcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkE527CMMJcjs.decompressJson; exports.hashAndCompressData = _chunkE527CMMJcjs.hashAndCompressData; exports.interactionTypes = _chunkUFJ7W6CQcjs.interactionTypes; exports.productTypes = _chunkUFJ7W6CQcjs.productTypes; exports.productTypesMask = _chunkUFJ7W6CQcjs.productTypesMask;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient } from '../
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc,
|
|
1
|
+
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-BsezWx2F.cjs';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, t as ExtractedReturnTypeFromRpc, o as FinalActionType, n as FinalModalStepType, r as IFrameEvent, s as IFrameLifecycleEvent, q as IFrameRpcEvent, I as IFrameRpcSchema, p 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 '../FrakContext-BsezWx2F.cjs';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
|
-
import { F as FrakContext } from '../FrakContext-LbQht1ep.cjs';
|
|
5
4
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
6
5
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.cjs';
|
|
7
6
|
import 'viem/chains';
|
|
@@ -89,7 +88,7 @@ declare function parse({ url }: {
|
|
|
89
88
|
declare function update({ url, context, }: {
|
|
90
89
|
url?: string;
|
|
91
90
|
context: Partial<FrakContext>;
|
|
92
|
-
}): string | null
|
|
91
|
+
}): string | null;
|
|
93
92
|
/**
|
|
94
93
|
* Remove Nexus context from current url
|
|
95
94
|
*/
|
|
@@ -99,9 +98,9 @@ declare function remove(url: string): string;
|
|
|
99
98
|
* @param url
|
|
100
99
|
* @param context
|
|
101
100
|
*/
|
|
102
|
-
declare function replaceUrl({ url, context, }: {
|
|
101
|
+
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
103
102
|
url?: string;
|
|
104
|
-
context: Partial<FrakContext
|
|
103
|
+
context: Partial<FrakContext> | null;
|
|
105
104
|
}): void;
|
|
106
105
|
/**
|
|
107
106
|
* Export our frak context "class"
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient } from '../
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc,
|
|
1
|
+
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-p0Jtv9gl.js';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, t as ExtractedReturnTypeFromRpc, o as FinalActionType, n as FinalModalStepType, r as IFrameEvent, s as IFrameLifecycleEvent, q as IFrameRpcEvent, I as IFrameRpcSchema, p 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 '../FrakContext-p0Jtv9gl.js';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
|
-
import { F as FrakContext } from '../FrakContext-LbQht1ep.js';
|
|
5
4
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
6
5
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.js';
|
|
7
6
|
import 'viem/chains';
|
|
@@ -89,7 +88,7 @@ declare function parse({ url }: {
|
|
|
89
88
|
declare function update({ url, context, }: {
|
|
90
89
|
url?: string;
|
|
91
90
|
context: Partial<FrakContext>;
|
|
92
|
-
}): string | null
|
|
91
|
+
}): string | null;
|
|
93
92
|
/**
|
|
94
93
|
* Remove Nexus context from current url
|
|
95
94
|
*/
|
|
@@ -99,9 +98,9 @@ declare function remove(url: string): string;
|
|
|
99
98
|
* @param url
|
|
100
99
|
* @param context
|
|
101
100
|
*/
|
|
102
|
-
declare function replaceUrl({ url, context, }: {
|
|
101
|
+
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
103
102
|
url?: string;
|
|
104
|
-
context: Partial<FrakContext
|
|
103
|
+
context: Partial<FrakContext> | null;
|
|
105
104
|
}): void;
|
|
106
105
|
/**
|
|
107
106
|
* Export our frak context "class"
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZZ7LUFNV.js";
|
|
4
4
|
import {
|
|
5
5
|
Deferred,
|
|
6
6
|
FrakContextManager,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
decompressDataAndCheckHash,
|
|
12
12
|
decompressJson,
|
|
13
13
|
hashAndCompressData
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-ZRPCX25Q.js";
|
|
15
15
|
import {
|
|
16
16
|
interactionTypes,
|
|
17
17
|
productTypes,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { g as SiweAuthenticationParams, b as ModalRpcMetadata, a as NexusClient, h as SiweAuthenticateReturnType, j as SendTransactionModalStepType, k as SendTransactionReturnType, W as WalletStatusReturnType, F as FrakContext, D as DisplayModalParamsType, M as ModalStepTypes } from './FrakContext-BsezWx2F.cjs';
|
|
2
|
+
import { Hex } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Partial SIWE params, since we can rebuild them from the SDK if they are empty
|
|
6
|
+
*/
|
|
7
|
+
type SiweAuthenticateModalParams = {
|
|
8
|
+
siwe?: Partial<SiweAuthenticationParams>;
|
|
9
|
+
metadata?: ModalRpcMetadata;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Function used to launch a siwe authentication
|
|
13
|
+
* @param client
|
|
14
|
+
* @param siwe
|
|
15
|
+
* @param context
|
|
16
|
+
*/
|
|
17
|
+
declare function siweAuthenticate(client: NexusClient, { siwe, metadata }: SiweAuthenticateModalParams): Promise<SiweAuthenticateReturnType>;
|
|
18
|
+
|
|
19
|
+
type SendTransactionParams = {
|
|
20
|
+
tx: SendTransactionModalStepType["params"]["tx"];
|
|
21
|
+
metadata?: ModalRpcMetadata;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Function used to send a user transaction
|
|
25
|
+
* @param client
|
|
26
|
+
* @param tx
|
|
27
|
+
* @param context
|
|
28
|
+
*/
|
|
29
|
+
declare function sendTransaction(client: NexusClient, { tx, metadata }: SendTransactionParams): Promise<SendTransactionReturnType>;
|
|
30
|
+
|
|
31
|
+
type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
|
|
32
|
+
type ProcessReferralOptions = {
|
|
33
|
+
alwaysAppendUrl?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Automatically submit a referral interaction when detected
|
|
37
|
+
* -> And automatically set the referral context in the url
|
|
38
|
+
* @param client
|
|
39
|
+
* @param walletStatus
|
|
40
|
+
* @param frakContext
|
|
41
|
+
* @param modalConfig
|
|
42
|
+
* @param productId
|
|
43
|
+
* @param options
|
|
44
|
+
*/
|
|
45
|
+
declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, options, }: {
|
|
46
|
+
walletStatus?: WalletStatusReturnType;
|
|
47
|
+
frakContext?: Partial<FrakContext> | null;
|
|
48
|
+
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
49
|
+
productId?: Hex;
|
|
50
|
+
options?: ProcessReferralOptions;
|
|
51
|
+
}): Promise<ReferralState>;
|
|
52
|
+
|
|
53
|
+
export { type ProcessReferralOptions as P, type SendTransactionParams as S, type SiweAuthenticateModalParams as a, sendTransaction as b, processReferral as p, siweAuthenticate as s };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { g as SiweAuthenticationParams, b as ModalRpcMetadata, a as NexusClient, h as SiweAuthenticateReturnType, j as SendTransactionModalStepType, k as SendTransactionReturnType, W as WalletStatusReturnType, F as FrakContext, D as DisplayModalParamsType, M as ModalStepTypes } from './FrakContext-p0Jtv9gl.js';
|
|
2
|
+
import { Hex } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Partial SIWE params, since we can rebuild them from the SDK if they are empty
|
|
6
|
+
*/
|
|
7
|
+
type SiweAuthenticateModalParams = {
|
|
8
|
+
siwe?: Partial<SiweAuthenticationParams>;
|
|
9
|
+
metadata?: ModalRpcMetadata;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Function used to launch a siwe authentication
|
|
13
|
+
* @param client
|
|
14
|
+
* @param siwe
|
|
15
|
+
* @param context
|
|
16
|
+
*/
|
|
17
|
+
declare function siweAuthenticate(client: NexusClient, { siwe, metadata }: SiweAuthenticateModalParams): Promise<SiweAuthenticateReturnType>;
|
|
18
|
+
|
|
19
|
+
type SendTransactionParams = {
|
|
20
|
+
tx: SendTransactionModalStepType["params"]["tx"];
|
|
21
|
+
metadata?: ModalRpcMetadata;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Function used to send a user transaction
|
|
25
|
+
* @param client
|
|
26
|
+
* @param tx
|
|
27
|
+
* @param context
|
|
28
|
+
*/
|
|
29
|
+
declare function sendTransaction(client: NexusClient, { tx, metadata }: SendTransactionParams): Promise<SendTransactionReturnType>;
|
|
30
|
+
|
|
31
|
+
type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
|
|
32
|
+
type ProcessReferralOptions = {
|
|
33
|
+
alwaysAppendUrl?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Automatically submit a referral interaction when detected
|
|
37
|
+
* -> And automatically set the referral context in the url
|
|
38
|
+
* @param client
|
|
39
|
+
* @param walletStatus
|
|
40
|
+
* @param frakContext
|
|
41
|
+
* @param modalConfig
|
|
42
|
+
* @param productId
|
|
43
|
+
* @param options
|
|
44
|
+
*/
|
|
45
|
+
declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, options, }: {
|
|
46
|
+
walletStatus?: WalletStatusReturnType;
|
|
47
|
+
frakContext?: Partial<FrakContext> | null;
|
|
48
|
+
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
49
|
+
productId?: Hex;
|
|
50
|
+
options?: ProcessReferralOptions;
|
|
51
|
+
}): Promise<ReferralState>;
|
|
52
|
+
|
|
53
|
+
export { type ProcessReferralOptions as P, type SendTransactionParams as S, type SiweAuthenticateModalParams as a, sendTransaction as b, processReferral as p, siweAuthenticate as s };
|