@frak-labs/nexus-sdk 0.0.20 → 0.0.22
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-ALy_TEwJ.d.ts → FrakContext-CDVlUN75.d.ts} +9 -1
- package/dist/{client-DaEox5q4.d.cts → FrakContext-DBdWC7ls.d.cts} +9 -1
- package/dist/bundle/bundle.js +3 -3
- package/dist/{chunk-QRECYKIR.cjs → chunk-4CWA7EWX.cjs} +68 -48
- package/dist/{chunk-A3XYA7S7.cjs → chunk-4OJ2NPAS.cjs} +15 -15
- package/dist/chunk-F3F4BCGV.cjs +860 -0
- package/dist/chunk-H3T2GAEC.js +79 -0
- package/dist/{chunk-TIKEZMSD.js → chunk-P4QEVLVV.js} +1 -1
- package/dist/{chunk-6LI5YIZB.js → chunk-Q3SIIAX2.js} +60 -40
- package/dist/chunk-QSXZKZJA.cjs +79 -0
- package/dist/{chunk-2SDBW6QC.cjs → chunk-QYOOKB34.cjs} +20 -18
- package/dist/{chunk-54MUKMZK.js → chunk-VVF4NKYR.js} +3 -1
- package/dist/chunk-ZQSA2VQ4.js +860 -0
- package/dist/core/actions/index.cjs +5 -5
- package/dist/core/actions/index.d.cts +6 -21
- package/dist/core/actions/index.d.ts +6 -21
- package/dist/core/actions/index.js +4 -4
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +8 -7
- package/dist/core/index.d.ts +8 -7
- package/dist/core/index.js +3 -3
- package/dist/core/interactions/index.cjs +3 -3
- package/dist/core/interactions/index.js +2 -2
- package/dist/processReferral-BWSIamn2.d.cts +53 -0
- package/dist/processReferral-CFyGAENf.d.ts +53 -0
- package/dist/react/index.cjs +31 -28
- package/dist/react/index.d.cts +8 -3
- package/dist/react/index.d.ts +8 -3
- package/dist/react/index.js +10 -7
- package/package.json +2 -11
- package/dist/FrakContext-LbQht1ep.d.cts +0 -10
- package/dist/FrakContext-LbQht1ep.d.ts +0 -10
- package/dist/chunk-7K4L7VQC.js +0 -288
- package/dist/chunk-HY6YATLS.js +0 -53
- package/dist/chunk-UFJ7W6CQ.cjs +0 -53
- package/dist/chunk-YDZBXUC4.cjs +0 -288
- package/dist/sendTransaction-BOd-pvXr.d.ts +0 -30
- package/dist/sendTransaction-MhdJPTWd.d.cts +0 -30
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../../chunk-
|
|
13
|
-
require('../../chunk-
|
|
14
|
-
require('../../chunk-
|
|
11
|
+
var _chunk4CWA7EWXcjs = require('../../chunk-4CWA7EWX.cjs');
|
|
12
|
+
require('../../chunk-F3F4BCGV.cjs');
|
|
13
|
+
require('../../chunk-4OJ2NPAS.cjs');
|
|
14
|
+
require('../../chunk-QSXZKZJA.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -22,4 +22,4 @@ require('../../chunk-UFJ7W6CQ.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
exports.displayModal =
|
|
25
|
+
exports.displayModal = _chunk4CWA7EWXcjs.displayModal; exports.openSso = _chunk4CWA7EWXcjs.openSso; exports.processReferral = _chunk4CWA7EWXcjs.processReferral; exports.referralInteraction = _chunk4CWA7EWXcjs.referralInteraction; exports.sendInteraction = _chunk4CWA7EWXcjs.sendInteraction; exports.sendTransaction = _chunk4CWA7EWXcjs.sendTransaction; exports.siweAuthenticate = _chunk4CWA7EWXcjs.siweAuthenticate; exports.walletStatus = _chunk4CWA7EWXcjs.walletStatus; exports.watchWalletStatus = _chunk4CWA7EWXcjs.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-DBdWC7ls.cjs';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
|
|
3
|
-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-BWSIamn2.cjs';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-BWSIamn2.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-CDVlUN75.js';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
|
-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-CFyGAENf.js';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-CFyGAENf.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,10 +8,10 @@ import {
|
|
|
8
8
|
siweAuthenticate,
|
|
9
9
|
walletStatus,
|
|
10
10
|
watchWalletStatus
|
|
11
|
-
} from "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
11
|
+
} from "../../chunk-Q3SIIAX2.js";
|
|
12
|
+
import "../../chunk-ZQSA2VQ4.js";
|
|
13
|
+
import "../../chunk-P4QEVLVV.js";
|
|
14
|
+
import "../../chunk-H3T2GAEC.js";
|
|
15
15
|
export {
|
|
16
16
|
displayModal,
|
|
17
17
|
openSso,
|
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 _chunkQYOOKB34cjs = require('../chunk-QYOOKB34.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,12 +11,12 @@ var _chunk2SDBW6QCcjs = require('../chunk-2SDBW6QC.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkF3F4BCGVcjs = require('../chunk-F3F4BCGV.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkQSXZKZJAcjs = require('../chunk-QSXZKZJA.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -31,4 +31,4 @@ var _chunkUFJ7W6CQcjs = require('../chunk-UFJ7W6CQ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.Deferred =
|
|
34
|
+
exports.Deferred = _chunkF3F4BCGVcjs.Deferred; exports.FrakContextManager = _chunkF3F4BCGVcjs.FrakContextManager; exports.FrakRpcError = _chunkF3F4BCGVcjs.FrakRpcError; exports.RpcErrorCodes = _chunkF3F4BCGVcjs.RpcErrorCodes; exports.compressJson = _chunkF3F4BCGVcjs.compressJson; exports.createIFrameNexusClient = _chunkQYOOKB34cjs.createIFrameNexusClient; exports.createIframe = _chunkF3F4BCGVcjs.createIframe; exports.decompressDataAndCheckHash = _chunkF3F4BCGVcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkF3F4BCGVcjs.decompressJson; exports.hashAndCompressData = _chunkF3F4BCGVcjs.hashAndCompressData; exports.interactionTypes = _chunkQSXZKZJAcjs.interactionTypes; exports.productTypes = _chunkQSXZKZJAcjs.productTypes; exports.productTypesMask = _chunkQSXZKZJAcjs.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-DBdWC7ls.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-DBdWC7ls.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';
|
|
@@ -37,9 +36,11 @@ declare function createIFrameNexusClient({ config, iframe, }: {
|
|
|
37
36
|
/**
|
|
38
37
|
* Create the given iframe
|
|
39
38
|
* @param walletBaseUrl
|
|
39
|
+
* @param config
|
|
40
40
|
*/
|
|
41
|
-
declare function createIframe({ walletBaseUrl, }: {
|
|
41
|
+
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
42
|
walletBaseUrl: string;
|
|
43
|
+
config?: NexusWalletSdkConfig;
|
|
43
44
|
}): Promise<HTMLIFrameElement | undefined>;
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -89,7 +90,7 @@ declare function parse({ url }: {
|
|
|
89
90
|
declare function update({ url, context, }: {
|
|
90
91
|
url?: string;
|
|
91
92
|
context: Partial<FrakContext>;
|
|
92
|
-
}): string | null
|
|
93
|
+
}): string | null;
|
|
93
94
|
/**
|
|
94
95
|
* Remove Nexus context from current url
|
|
95
96
|
*/
|
|
@@ -99,9 +100,9 @@ declare function remove(url: string): string;
|
|
|
99
100
|
* @param url
|
|
100
101
|
* @param context
|
|
101
102
|
*/
|
|
102
|
-
declare function replaceUrl({ url, context, }: {
|
|
103
|
+
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
103
104
|
url?: string;
|
|
104
|
-
context: Partial<FrakContext
|
|
105
|
+
context: Partial<FrakContext> | null;
|
|
105
106
|
}): void;
|
|
106
107
|
/**
|
|
107
108
|
* 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-CDVlUN75.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-CDVlUN75.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';
|
|
@@ -37,9 +36,11 @@ declare function createIFrameNexusClient({ config, iframe, }: {
|
|
|
37
36
|
/**
|
|
38
37
|
* Create the given iframe
|
|
39
38
|
* @param walletBaseUrl
|
|
39
|
+
* @param config
|
|
40
40
|
*/
|
|
41
|
-
declare function createIframe({ walletBaseUrl, }: {
|
|
41
|
+
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
42
|
walletBaseUrl: string;
|
|
43
|
+
config?: NexusWalletSdkConfig;
|
|
43
44
|
}): Promise<HTMLIFrameElement | undefined>;
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -89,7 +90,7 @@ declare function parse({ url }: {
|
|
|
89
90
|
declare function update({ url, context, }: {
|
|
90
91
|
url?: string;
|
|
91
92
|
context: Partial<FrakContext>;
|
|
92
|
-
}): string | null
|
|
93
|
+
}): string | null;
|
|
93
94
|
/**
|
|
94
95
|
* Remove Nexus context from current url
|
|
95
96
|
*/
|
|
@@ -99,9 +100,9 @@ declare function remove(url: string): string;
|
|
|
99
100
|
* @param url
|
|
100
101
|
* @param context
|
|
101
102
|
*/
|
|
102
|
-
declare function replaceUrl({ url, context, }: {
|
|
103
|
+
declare function replaceUrl({ url: baseUrl, context, }: {
|
|
103
104
|
url?: string;
|
|
104
|
-
context: Partial<FrakContext
|
|
105
|
+
context: Partial<FrakContext> | null;
|
|
105
106
|
}): void;
|
|
106
107
|
/**
|
|
107
108
|
* 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-VVF4NKYR.js";
|
|
4
4
|
import {
|
|
5
5
|
Deferred,
|
|
6
6
|
FrakContextManager,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
decompressDataAndCheckHash,
|
|
12
12
|
decompressJson,
|
|
13
13
|
hashAndCompressData
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-ZQSA2VQ4.js";
|
|
15
15
|
import {
|
|
16
16
|
interactionTypes,
|
|
17
17
|
productTypes,
|
|
18
18
|
productTypesMask
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-H3T2GAEC.js";
|
|
20
20
|
export {
|
|
21
21
|
Deferred,
|
|
22
22
|
FrakContextManager,
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
var _chunk4OJ2NPAScjs = require('../../chunk-4OJ2NPAS.cjs');
|
|
7
|
+
require('../../chunk-QSXZKZJA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.PressInteractionEncoder =
|
|
13
|
+
exports.PressInteractionEncoder = _chunk4OJ2NPAScjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunk4OJ2NPAScjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunk4OJ2NPAScjs.ReferralInteractionEncoder; exports.WebShopInteractionEncoder = _chunk4OJ2NPAScjs.WebShopInteractionEncoder;
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
PurchaseInteractionEncoder,
|
|
4
4
|
ReferralInteractionEncoder,
|
|
5
5
|
WebShopInteractionEncoder
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-P4QEVLVV.js";
|
|
7
|
+
import "../../chunk-H3T2GAEC.js";
|
|
8
8
|
export {
|
|
9
9
|
PressInteractionEncoder,
|
|
10
10
|
PurchaseInteractionEncoder,
|
|
@@ -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-DBdWC7ls.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-CDVlUN75.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 };
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQYOOKB34cjs = require('../chunk-QYOOKB34.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,16 +9,16 @@ var _chunk2SDBW6QCcjs = require('../chunk-2SDBW6QC.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk4CWA7EWXcjs = require('../chunk-4CWA7EWX.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
20
|
-
require('../chunk-
|
|
21
|
-
require('../chunk-
|
|
19
|
+
var _chunkF3F4BCGVcjs = require('../chunk-F3F4BCGV.cjs');
|
|
20
|
+
require('../chunk-4OJ2NPAS.cjs');
|
|
21
|
+
require('../chunk-QSXZKZJA.cjs');
|
|
22
22
|
|
|
23
23
|
// src/react/provider/NexusConfigProvider.ts
|
|
24
24
|
var _react = require('react');
|
|
@@ -50,8 +50,8 @@ function NexusConfigProvider(parameters) {
|
|
|
50
50
|
function useNexusConfig() {
|
|
51
51
|
const config = _react.useContext.call(void 0, NexusConfigContext);
|
|
52
52
|
if (!config) {
|
|
53
|
-
throw new (0,
|
|
54
|
-
|
|
53
|
+
throw new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
54
|
+
_chunkF3F4BCGVcjs.RpcErrorCodes.configError,
|
|
55
55
|
"Nexus config not found"
|
|
56
56
|
);
|
|
57
57
|
}
|
|
@@ -81,12 +81,13 @@ function useWalletStatus() {
|
|
|
81
81
|
);
|
|
82
82
|
return _reactquery.useQuery.call(void 0, {
|
|
83
83
|
gcTime: 0,
|
|
84
|
+
staleTime: 0,
|
|
84
85
|
queryKey: ["nexus-sdk", "wallet-status-listener"],
|
|
85
86
|
queryFn: async () => {
|
|
86
87
|
if (!client) {
|
|
87
|
-
throw new (0,
|
|
88
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
88
89
|
}
|
|
89
|
-
return
|
|
90
|
+
return _chunk4CWA7EWXcjs.walletStatus.call(void 0, client, newStatusUpdated);
|
|
90
91
|
},
|
|
91
92
|
enabled: !!client
|
|
92
93
|
});
|
|
@@ -103,9 +104,9 @@ function useSendTransactionAction({
|
|
|
103
104
|
mutationKey: ["nexus-sdk", "send-transaction"],
|
|
104
105
|
mutationFn: async (params) => {
|
|
105
106
|
if (!client) {
|
|
106
|
-
throw new (0,
|
|
107
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
107
108
|
}
|
|
108
|
-
return
|
|
109
|
+
return _chunk4CWA7EWXcjs.sendTransaction.call(void 0, client, params);
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
}
|
|
@@ -125,9 +126,9 @@ function useSiweAuthenticate({
|
|
|
125
126
|
],
|
|
126
127
|
mutationFn: async (params) => {
|
|
127
128
|
if (!client) {
|
|
128
|
-
throw new (0,
|
|
129
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
129
130
|
}
|
|
130
|
-
return
|
|
131
|
+
return _chunk4CWA7EWXcjs.siweAuthenticate.call(void 0, client, params);
|
|
131
132
|
}
|
|
132
133
|
});
|
|
133
134
|
}
|
|
@@ -180,12 +181,12 @@ function useFrakContext() {
|
|
|
180
181
|
const { location } = useWindowLocation();
|
|
181
182
|
const frakContext = _react.useMemo.call(void 0, () => {
|
|
182
183
|
if (!_optionalChain([location, 'optionalAccess', _7 => _7.href])) return null;
|
|
183
|
-
return
|
|
184
|
+
return _chunkF3F4BCGVcjs.FrakContextManager.parse({ url: location.href });
|
|
184
185
|
}, [_optionalChain([location, 'optionalAccess', _8 => _8.href])]);
|
|
185
186
|
const updateContext = _react.useCallback.call(void 0,
|
|
186
187
|
(newContext) => {
|
|
187
188
|
console.log("Updating context", { newContext });
|
|
188
|
-
|
|
189
|
+
_chunkF3F4BCGVcjs.FrakContextManager.replaceUrl({
|
|
189
190
|
url: _optionalChain([location, 'optionalAccess', _9 => _9.href]),
|
|
190
191
|
context: newContext
|
|
191
192
|
});
|
|
@@ -201,7 +202,8 @@ function useFrakContext() {
|
|
|
201
202
|
// src/react/hook/helper/useReferralInteraction.ts
|
|
202
203
|
function useReferralInteraction({
|
|
203
204
|
productId,
|
|
204
|
-
modalConfig
|
|
205
|
+
modalConfig,
|
|
206
|
+
options
|
|
205
207
|
} = {}) {
|
|
206
208
|
const client = useNexusClient();
|
|
207
209
|
const { frakContext } = useFrakContext();
|
|
@@ -222,13 +224,14 @@ function useReferralInteraction({
|
|
|
222
224
|
],
|
|
223
225
|
queryFn: () => {
|
|
224
226
|
if (!client) {
|
|
225
|
-
throw new (0,
|
|
227
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
226
228
|
}
|
|
227
|
-
return
|
|
229
|
+
return _chunk4CWA7EWXcjs.processReferral.call(void 0, client, {
|
|
228
230
|
walletStatus: walletStatus2,
|
|
229
231
|
frakContext,
|
|
230
232
|
modalConfig,
|
|
231
|
-
productId
|
|
233
|
+
productId,
|
|
234
|
+
options
|
|
232
235
|
});
|
|
233
236
|
},
|
|
234
237
|
enabled: !!walletStatus2
|
|
@@ -251,9 +254,9 @@ function useSendInteraction({
|
|
|
251
254
|
mutationKey: ["nexus-sdk", "send-interaction"],
|
|
252
255
|
mutationFn: async (params) => {
|
|
253
256
|
if (!client) {
|
|
254
|
-
throw new (0,
|
|
257
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
255
258
|
}
|
|
256
|
-
return
|
|
259
|
+
return _chunk4CWA7EWXcjs.sendInteraction.call(void 0, client, params);
|
|
257
260
|
}
|
|
258
261
|
});
|
|
259
262
|
}
|
|
@@ -269,9 +272,9 @@ function useDisplayModal({
|
|
|
269
272
|
mutationKey: ["nexus-sdk", "display-modal"],
|
|
270
273
|
mutationFn: async (args) => {
|
|
271
274
|
if (!client) {
|
|
272
|
-
throw new (0,
|
|
275
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
273
276
|
}
|
|
274
|
-
return
|
|
277
|
+
return _chunk4CWA7EWXcjs.displayModal.call(void 0, client, args);
|
|
275
278
|
}
|
|
276
279
|
});
|
|
277
280
|
}
|
|
@@ -285,9 +288,9 @@ function useOpenSso({ mutations } = {}) {
|
|
|
285
288
|
mutationKey: ["nexus-sdk", "open-sso"],
|
|
286
289
|
mutationFn: async (params) => {
|
|
287
290
|
if (!client) {
|
|
288
|
-
throw new (0,
|
|
291
|
+
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
289
292
|
}
|
|
290
|
-
return
|
|
293
|
+
return _chunk4CWA7EWXcjs.openSso.call(void 0, client, params);
|
|
291
294
|
}
|
|
292
295
|
});
|
|
293
296
|
}
|
|
@@ -303,15 +306,15 @@ function NexusIFrameClientProvider({
|
|
|
303
306
|
const config = useNexusConfig();
|
|
304
307
|
const [client, setClient] = _react.useState.call(void 0, void 0);
|
|
305
308
|
const iFrame = _react.createElement.call(void 0, "iframe", {
|
|
306
|
-
...
|
|
309
|
+
..._chunkF3F4BCGVcjs.baseIframeProps,
|
|
307
310
|
src: `${config.walletUrl}/listener`,
|
|
308
|
-
style: _nullishCoalesce(style, () => (
|
|
311
|
+
style: _nullishCoalesce(style, () => ( _chunkF3F4BCGVcjs.baseIframeProps.style)),
|
|
309
312
|
ref: (iframe) => {
|
|
310
313
|
if (!iframe || client) {
|
|
311
314
|
return;
|
|
312
315
|
}
|
|
313
316
|
setClient(
|
|
314
|
-
|
|
317
|
+
_chunkQYOOKB34cjs.createIFrameNexusClient.call(void 0, {
|
|
315
318
|
iframe,
|
|
316
319
|
config
|
|
317
320
|
})
|
package/dist/react/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { N as NexusWalletSdkConfig, a as NexusClient, W as WalletStatusReturnType, k as SendTransactionReturnType, h as SiweAuthenticateReturnType, D as DisplayModalParamsType, M as ModalStepTypes, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../
|
|
3
|
+
import { N as NexusWalletSdkConfig, a as NexusClient, W as WalletStatusReturnType, k as SendTransactionReturnType, h as SiweAuthenticateReturnType, D as DisplayModalParamsType, M as ModalStepTypes, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../FrakContext-DBdWC7ls.cjs';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { UseMutationOptions } from '@tanstack/react-query';
|
|
6
6
|
import * as viem from 'viem';
|
|
7
7
|
import { Hex } from 'viem';
|
|
8
8
|
import { F as FrakRpcError } from '../error-Dflr3G5x.cjs';
|
|
9
|
-
import { S as SendTransactionParams, a as SiweAuthenticateModalParams } from '../
|
|
9
|
+
import { S as SendTransactionParams, a as SiweAuthenticateModalParams, P as ProcessReferralOptions } from '../processReferral-BWSIamn2.cjs';
|
|
10
10
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
11
11
|
import 'viem/chains';
|
|
12
12
|
import 'viem/siwe';
|
|
@@ -19,6 +19,7 @@ declare const NexusConfigContext: react.Context<Readonly<{
|
|
|
19
19
|
metadata: {
|
|
20
20
|
name: string;
|
|
21
21
|
css?: string;
|
|
22
|
+
buttonShare?: string;
|
|
22
23
|
};
|
|
23
24
|
domain: string;
|
|
24
25
|
}> | undefined>;
|
|
@@ -40,6 +41,7 @@ declare function NexusConfigProvider(parameters: PropsWithChildren<NexusConfigPr
|
|
|
40
41
|
metadata: {
|
|
41
42
|
name: string;
|
|
42
43
|
css?: string;
|
|
44
|
+
buttonShare?: string;
|
|
43
45
|
};
|
|
44
46
|
domain: string;
|
|
45
47
|
}> | undefined>>;
|
|
@@ -75,6 +77,7 @@ declare function useNexusConfig(): Readonly<{
|
|
|
75
77
|
metadata: {
|
|
76
78
|
name: string;
|
|
77
79
|
css?: string;
|
|
80
|
+
buttonShare?: string;
|
|
78
81
|
};
|
|
79
82
|
domain: string;
|
|
80
83
|
}>;
|
|
@@ -117,10 +120,12 @@ declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams)
|
|
|
117
120
|
* -> And automatically set the referral context in the url
|
|
118
121
|
* @param productId
|
|
119
122
|
* @param modalConfig
|
|
123
|
+
* @param options
|
|
120
124
|
*/
|
|
121
|
-
declare function useReferralInteraction({ productId, modalConfig, }?: {
|
|
125
|
+
declare function useReferralInteraction({ productId, modalConfig, options, }?: {
|
|
122
126
|
productId?: Hex;
|
|
123
127
|
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
128
|
+
options?: ProcessReferralOptions;
|
|
124
129
|
}): Error | ("error" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "no-referrer" | "self-referral");
|
|
125
130
|
|
|
126
131
|
type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
|