@frak-labs/nexus-sdk 0.0.13 → 0.0.14
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/chunk-22T2NHQK.js +22 -0
- package/dist/{chunk-FF32LTPI.js → chunk-5LZQXBFJ.js} +1 -1
- package/dist/{chunk-2SGRLI7T.cjs → chunk-5SGDBU5S.cjs} +1 -1
- package/dist/chunk-AANA3LEO.cjs +22 -0
- package/dist/{chunk-GUDT2W6I.js → chunk-IH3QWPWT.js} +10 -8
- package/dist/{chunk-IQQTTKJL.cjs → chunk-PURWUKEM.cjs} +9 -7
- package/dist/{chunk-5CFD5FM2.js → chunk-S223FMEJ.js} +5 -5
- package/dist/{chunk-S5FVCA2E.cjs → chunk-UOEVM7TR.cjs} +5 -5
- package/dist/{client-B6_BIGc3.d.ts → client-DJd7-ajw.d.ts} +6 -3
- package/dist/{client-Oily5ph8.d.cts → client-DXITs1Kf.d.cts} +6 -3
- package/dist/core/actions/index.cjs +2 -2
- package/dist/core/actions/index.d.cts +7 -7
- package/dist/core/actions/index.d.ts +7 -7
- package/dist/core/actions/index.js +1 -1
- package/dist/core/index.cjs +8 -2
- package/dist/core/index.d.cts +21 -4
- package/dist/core/index.d.ts +21 -4
- package/dist/core/index.js +8 -2
- package/dist/core/interactions/index.cjs +3 -2
- package/dist/core/interactions/index.d.cts +1 -1
- package/dist/core/interactions/index.d.ts +1 -1
- package/dist/core/interactions/index.js +2 -1
- package/dist/{interaction-D3-M3nBh.d.cts → interaction-BngPoHA0.d.cts} +1 -1
- package/dist/{interaction-D3-M3nBh.d.ts → interaction-BngPoHA0.d.ts} +1 -1
- package/dist/react/index.cjs +31 -30
- package/dist/react/index.d.cts +6 -6
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +7 -6
- package/dist/{sendTransaction-BKKYEt8p.d.cts → sendTransaction-C19oCc6X.d.cts} +1 -1
- package/dist/{sendTransaction-BHqCq_9X.d.ts → sendTransaction-fLvpfqaQ.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/core/constants/productTypes.ts
|
|
2
|
+
var productTypes = {
|
|
3
|
+
// content type
|
|
4
|
+
dapp: 1,
|
|
5
|
+
press: 2,
|
|
6
|
+
// feature type
|
|
7
|
+
referral: 30
|
|
8
|
+
};
|
|
9
|
+
var productTypesMask = Object.entries(
|
|
10
|
+
productTypes
|
|
11
|
+
).reduce(
|
|
12
|
+
(acc, [key, value]) => {
|
|
13
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
14
|
+
return acc;
|
|
15
|
+
},
|
|
16
|
+
{}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
productTypes,
|
|
21
|
+
productTypesMask
|
|
22
|
+
};
|
|
@@ -256,7 +256,7 @@ function createIFrameMessageHandler({
|
|
|
256
256
|
if (!iframe.contentWindow) {
|
|
257
257
|
throw new FrakRpcError(
|
|
258
258
|
RpcErrorCodes.configError,
|
|
259
|
-
"The iframe does not have a
|
|
259
|
+
"The iframe does not have a product window"
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
262
|
const contentWindow = iframe.contentWindow;
|
|
@@ -256,7 +256,7 @@ function createIFrameMessageHandler({
|
|
|
256
256
|
if (!iframe.contentWindow) {
|
|
257
257
|
throw new FrakRpcError(
|
|
258
258
|
RpcErrorCodes.configError,
|
|
259
|
-
"The iframe does not have a
|
|
259
|
+
"The iframe does not have a product window"
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
262
|
const contentWindow = iframe.contentWindow;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core/constants/productTypes.ts
|
|
2
|
+
var productTypes = {
|
|
3
|
+
// content type
|
|
4
|
+
dapp: 1,
|
|
5
|
+
press: 2,
|
|
6
|
+
// feature type
|
|
7
|
+
referral: 30
|
|
8
|
+
};
|
|
9
|
+
var productTypesMask = Object.entries(
|
|
10
|
+
productTypes
|
|
11
|
+
).reduce(
|
|
12
|
+
(acc, [key, value]) => {
|
|
13
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
14
|
+
return acc;
|
|
15
|
+
},
|
|
16
|
+
{}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.productTypes = productTypes; exports.productTypesMask = productTypesMask;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
productTypes
|
|
3
|
+
} from "./chunk-22T2NHQK.js";
|
|
4
|
+
|
|
1
5
|
// src/core/interactions/pressEncoder.ts
|
|
2
|
-
import { concatHex, pad } from "viem";
|
|
3
|
-
var PressTypeSelector = "0x02";
|
|
6
|
+
import { concatHex, pad, toHex } from "viem";
|
|
4
7
|
var PressActionsSelector = {
|
|
5
8
|
OpenArticle: "0xc0a24ffb",
|
|
6
9
|
ReadArticle: "0xd5bd0fbe"
|
|
@@ -11,7 +14,7 @@ function openArticle({ articleId }) {
|
|
|
11
14
|
pad(articleId, { size: 32 })
|
|
12
15
|
]);
|
|
13
16
|
return {
|
|
14
|
-
handlerTypeDenominator:
|
|
17
|
+
handlerTypeDenominator: toHex(productTypes.press),
|
|
15
18
|
interactionData
|
|
16
19
|
};
|
|
17
20
|
}
|
|
@@ -21,7 +24,7 @@ function readArticle({ articleId }) {
|
|
|
21
24
|
pad(articleId, { size: 32 })
|
|
22
25
|
]);
|
|
23
26
|
return {
|
|
24
|
-
handlerTypeDenominator:
|
|
27
|
+
handlerTypeDenominator: toHex(productTypes.press),
|
|
25
28
|
interactionData
|
|
26
29
|
};
|
|
27
30
|
}
|
|
@@ -31,8 +34,7 @@ var PressInteractionEncoder = {
|
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
// src/core/interactions/referralEncoder.ts
|
|
34
|
-
import { concatHex as concatHex2, pad as pad2 } from "viem";
|
|
35
|
-
var ReferralTypeSelector = "0x1E";
|
|
37
|
+
import { concatHex as concatHex2, pad as pad2, toHex as toHex2 } from "viem";
|
|
36
38
|
var ReferralActionsSelector = {
|
|
37
39
|
CreateLink: "0xb2c0f17c",
|
|
38
40
|
Referred: "0x010cc3b9"
|
|
@@ -43,7 +45,7 @@ function createLink() {
|
|
|
43
45
|
"0x"
|
|
44
46
|
]);
|
|
45
47
|
return {
|
|
46
|
-
handlerTypeDenominator:
|
|
48
|
+
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
47
49
|
interactionData
|
|
48
50
|
};
|
|
49
51
|
}
|
|
@@ -53,7 +55,7 @@ function referred({ referrer }) {
|
|
|
53
55
|
pad2(referrer, { size: 32 })
|
|
54
56
|
]);
|
|
55
57
|
return {
|
|
56
|
-
handlerTypeDenominator:
|
|
58
|
+
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
57
59
|
interactionData
|
|
58
60
|
};
|
|
59
61
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkAANA3LEOcjs = require('./chunk-AANA3LEO.cjs');
|
|
4
|
+
|
|
5
|
+
// src/core/interactions/pressEncoder.ts
|
|
2
6
|
var _viem = require('viem');
|
|
3
|
-
var PressTypeSelector = "0x02";
|
|
4
7
|
var PressActionsSelector = {
|
|
5
8
|
OpenArticle: "0xc0a24ffb",
|
|
6
9
|
ReadArticle: "0xd5bd0fbe"
|
|
@@ -11,7 +14,7 @@ function openArticle({ articleId }) {
|
|
|
11
14
|
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
12
15
|
]);
|
|
13
16
|
return {
|
|
14
|
-
handlerTypeDenominator:
|
|
17
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.press),
|
|
15
18
|
interactionData
|
|
16
19
|
};
|
|
17
20
|
}
|
|
@@ -21,7 +24,7 @@ function readArticle({ articleId }) {
|
|
|
21
24
|
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
22
25
|
]);
|
|
23
26
|
return {
|
|
24
|
-
handlerTypeDenominator:
|
|
27
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.press),
|
|
25
28
|
interactionData
|
|
26
29
|
};
|
|
27
30
|
}
|
|
@@ -32,7 +35,6 @@ var PressInteractionEncoder = {
|
|
|
32
35
|
|
|
33
36
|
// src/core/interactions/referralEncoder.ts
|
|
34
37
|
|
|
35
|
-
var ReferralTypeSelector = "0x1E";
|
|
36
38
|
var ReferralActionsSelector = {
|
|
37
39
|
CreateLink: "0xb2c0f17c",
|
|
38
40
|
Referred: "0x010cc3b9"
|
|
@@ -43,7 +45,7 @@ function createLink() {
|
|
|
43
45
|
"0x"
|
|
44
46
|
]);
|
|
45
47
|
return {
|
|
46
|
-
handlerTypeDenominator:
|
|
48
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.referral),
|
|
47
49
|
interactionData
|
|
48
50
|
};
|
|
49
51
|
}
|
|
@@ -53,7 +55,7 @@ function referred({ referrer }) {
|
|
|
53
55
|
_viem.pad.call(void 0, referrer, { size: 32 })
|
|
54
56
|
]);
|
|
55
57
|
return {
|
|
56
|
-
handlerTypeDenominator:
|
|
58
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.referral),
|
|
57
59
|
interactionData
|
|
58
60
|
};
|
|
59
61
|
}
|
|
@@ -8,18 +8,18 @@ function watchWalletStatus(client, callback) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
// src/core/utils/
|
|
11
|
+
// src/core/utils/computeProductId.ts
|
|
12
12
|
import { keccak256, toHex } from "viem";
|
|
13
|
-
function
|
|
13
|
+
function computeProductId({ domain }) {
|
|
14
14
|
return keccak256(toHex(domain));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// src/core/actions/sendInteraction.ts
|
|
18
|
-
async function sendInteraction(client, {
|
|
19
|
-
const
|
|
18
|
+
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
19
|
+
const pId = productId ?? computeProductId(client.config);
|
|
20
20
|
return await client.request({
|
|
21
21
|
method: "frak_sendInteraction",
|
|
22
|
-
params: [
|
|
22
|
+
params: [pId, interaction, validation]
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -8,18 +8,18 @@ function watchWalletStatus(client, callback) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
// src/core/utils/
|
|
11
|
+
// src/core/utils/computeProductId.ts
|
|
12
12
|
var _viem = require('viem');
|
|
13
|
-
function
|
|
13
|
+
function computeProductId({ domain }) {
|
|
14
14
|
return _viem.keccak256.call(void 0, _viem.toHex.call(void 0, domain));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// src/core/actions/sendInteraction.ts
|
|
18
|
-
async function sendInteraction(client, {
|
|
19
|
-
const
|
|
18
|
+
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
19
|
+
const pId = _nullishCoalesce(productId, () => ( computeProductId(client.config)));
|
|
20
20
|
return await client.request({
|
|
21
21
|
method: "frak_sendInteraction",
|
|
22
|
-
params: [
|
|
22
|
+
params: [pId, interaction, validation]
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, Hex, RpcSchema } from 'viem';
|
|
2
2
|
import { Prettify } from 'viem/chains';
|
|
3
3
|
import { SiweMessage } from 'viem/siwe';
|
|
4
|
-
import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-
|
|
4
|
+
import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-BngPoHA0.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for the Nexus Wallet SDK
|
|
@@ -102,7 +102,10 @@ type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWith
|
|
|
102
102
|
/**
|
|
103
103
|
* Parameters of the send transaction rpc request
|
|
104
104
|
*/
|
|
105
|
-
type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId"
|
|
105
|
+
type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId" | "expirationTime" | "issuedAt" | "notBefore"> & {
|
|
106
|
+
expirationTimeTimestamp?: number;
|
|
107
|
+
notBeforeTimestamp?: number;
|
|
108
|
+
};
|
|
106
109
|
/**
|
|
107
110
|
* Return type of the send transaction rpc request
|
|
108
111
|
*/
|
|
@@ -240,7 +243,7 @@ type IFrameRpcSchema = [
|
|
|
240
243
|
{
|
|
241
244
|
Method: "frak_sendInteraction";
|
|
242
245
|
Parameters: [
|
|
243
|
-
|
|
246
|
+
productId: Hex,
|
|
244
247
|
interaction: PreparedInteraction,
|
|
245
248
|
signature?: Hex
|
|
246
249
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, Hex, RpcSchema } from 'viem';
|
|
2
2
|
import { Prettify } from 'viem/chains';
|
|
3
3
|
import { SiweMessage } from 'viem/siwe';
|
|
4
|
-
import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-
|
|
4
|
+
import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-BngPoHA0.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for the Nexus Wallet SDK
|
|
@@ -102,7 +102,10 @@ type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWith
|
|
|
102
102
|
/**
|
|
103
103
|
* Parameters of the send transaction rpc request
|
|
104
104
|
*/
|
|
105
|
-
type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId"
|
|
105
|
+
type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId" | "expirationTime" | "issuedAt" | "notBefore"> & {
|
|
106
|
+
expirationTimeTimestamp?: number;
|
|
107
|
+
notBeforeTimestamp?: number;
|
|
108
|
+
};
|
|
106
109
|
/**
|
|
107
110
|
* Return type of the send transaction rpc request
|
|
108
111
|
*/
|
|
@@ -240,7 +243,7 @@ type IFrameRpcSchema = [
|
|
|
240
243
|
{
|
|
241
244
|
Method: "frak_sendInteraction";
|
|
242
245
|
Parameters: [
|
|
243
|
-
|
|
246
|
+
productId: Hex,
|
|
244
247
|
interaction: PreparedInteraction,
|
|
245
248
|
signature?: Hex
|
|
246
249
|
];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkUOEVM7TRcjs = require('../../chunk-UOEVM7TR.cjs');
|
|
9
9
|
require('../../chunk-ETV4XYOV.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -14,4 +14,4 @@ require('../../chunk-ETV4XYOV.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.displayModal =
|
|
17
|
+
exports.displayModal = _chunkUOEVM7TRcjs.displayModal; exports.openSso = _chunkUOEVM7TRcjs.openSso; exports.sendInteraction = _chunkUOEVM7TRcjs.sendInteraction; exports.sendTransaction = _chunkUOEVM7TRcjs.sendTransaction; exports.siweAuthenticate = _chunkUOEVM7TRcjs.siweAuthenticate; exports.watchWalletStatus = _chunkUOEVM7TRcjs.watchWalletStatus;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-
|
|
2
|
-
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-
|
|
3
|
-
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-
|
|
1
|
+
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DXITs1Kf.cjs';
|
|
2
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
|
|
3
|
+
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-C19oCc6X.cjs';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import 'viem/chains';
|
|
6
6
|
import 'viem/siwe';
|
|
@@ -15,16 +15,16 @@ declare function watchWalletStatus(client: NexusClient, callback: (status: Walle
|
|
|
15
15
|
/**
|
|
16
16
|
* Function used to send an interaction
|
|
17
17
|
* @param client
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
18
|
+
* @param productId
|
|
19
|
+
* @param interaction
|
|
20
20
|
* @param validation
|
|
21
21
|
*/
|
|
22
|
-
declare function sendInteraction(client: NexusClient, {
|
|
22
|
+
declare function sendInteraction(client: NexusClient, { productId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Function used to display a modal
|
|
26
26
|
* @param client
|
|
27
|
-
* @param
|
|
27
|
+
* @param args
|
|
28
28
|
*/
|
|
29
29
|
declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
30
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-
|
|
2
|
-
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-
|
|
3
|
-
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-
|
|
1
|
+
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DJd7-ajw.js';
|
|
2
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
|
+
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-fLvpfqaQ.js';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import 'viem/chains';
|
|
6
6
|
import 'viem/siwe';
|
|
@@ -15,16 +15,16 @@ declare function watchWalletStatus(client: NexusClient, callback: (status: Walle
|
|
|
15
15
|
/**
|
|
16
16
|
* Function used to send an interaction
|
|
17
17
|
* @param client
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
18
|
+
* @param productId
|
|
19
|
+
* @param interaction
|
|
20
20
|
* @param validation
|
|
21
21
|
*/
|
|
22
|
-
declare function sendInteraction(client: NexusClient, {
|
|
22
|
+
declare function sendInteraction(client: NexusClient, { productId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Function used to display a modal
|
|
26
26
|
* @param client
|
|
27
|
-
* @param
|
|
27
|
+
* @param args
|
|
28
28
|
*/
|
|
29
29
|
declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
30
30
|
|
package/dist/core/index.cjs
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk5SGDBU5Scjs = require('../chunk-5SGDBU5S.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkAANA3LEOcjs = require('../chunk-AANA3LEO.cjs');
|
|
9
13
|
require('../chunk-ETV4XYOV.cjs');
|
|
10
14
|
|
|
11
15
|
|
|
@@ -14,4 +18,6 @@ require('../chunk-ETV4XYOV.cjs');
|
|
|
14
18
|
|
|
15
19
|
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.FrakRpcError = _chunk5SGDBU5Scjs.FrakRpcError; exports.RpcErrorCodes = _chunk5SGDBU5Scjs.RpcErrorCodes; exports.createIFrameNexusClient = _chunk5SGDBU5Scjs.createIFrameNexusClient; exports.createIframe = _chunk5SGDBU5Scjs.createIframe; exports.decompressDataAndCheckHash = _chunk5SGDBU5Scjs.decompressDataAndCheckHash; exports.hashAndCompressData = _chunk5SGDBU5Scjs.hashAndCompressData; exports.productTypes = _chunkAANA3LEOcjs.productTypes; exports.productTypesMask = _chunkAANA3LEOcjs.productTypesMask;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-
|
|
3
|
-
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-
|
|
1
|
+
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-DXITs1Kf.cjs';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-DXITs1Kf.cjs';
|
|
3
|
+
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
4
4
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.cjs';
|
|
5
5
|
import 'viem';
|
|
6
6
|
import 'viem/chains';
|
|
@@ -53,4 +53,21 @@ declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
|
|
|
53
53
|
*/
|
|
54
54
|
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The keys for each product types
|
|
58
|
+
*/
|
|
59
|
+
type ProductTypesKey = keyof typeof productTypes;
|
|
60
|
+
/**
|
|
61
|
+
* List of the product types per denominator
|
|
62
|
+
*/
|
|
63
|
+
declare const productTypes: {
|
|
64
|
+
dapp: number;
|
|
65
|
+
press: number;
|
|
66
|
+
referral: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Bitmask for each product types
|
|
70
|
+
*/
|
|
71
|
+
declare const productTypesMask: Record<ProductTypesKey, bigint>;
|
|
72
|
+
|
|
73
|
+
export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-
|
|
3
|
-
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-
|
|
1
|
+
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-DJd7-ajw.js';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-DJd7-ajw.js';
|
|
3
|
+
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
4
4
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.js';
|
|
5
5
|
import 'viem';
|
|
6
6
|
import 'viem/chains';
|
|
@@ -53,4 +53,21 @@ declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
|
|
|
53
53
|
*/
|
|
54
54
|
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The keys for each product types
|
|
58
|
+
*/
|
|
59
|
+
type ProductTypesKey = keyof typeof productTypes;
|
|
60
|
+
/**
|
|
61
|
+
* List of the product types per denominator
|
|
62
|
+
*/
|
|
63
|
+
declare const productTypes: {
|
|
64
|
+
dapp: number;
|
|
65
|
+
press: number;
|
|
66
|
+
referral: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Bitmask for each product types
|
|
70
|
+
*/
|
|
71
|
+
declare const productTypesMask: Record<ProductTypesKey, bigint>;
|
|
72
|
+
|
|
73
|
+
export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
|
package/dist/core/index.js
CHANGED
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
createIframe,
|
|
6
6
|
decompressDataAndCheckHash,
|
|
7
7
|
hashAndCompressData
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-5LZQXBFJ.js";
|
|
9
|
+
import {
|
|
10
|
+
productTypes,
|
|
11
|
+
productTypesMask
|
|
12
|
+
} from "../chunk-22T2NHQK.js";
|
|
9
13
|
import "../chunk-PKBMQBKP.js";
|
|
10
14
|
export {
|
|
11
15
|
FrakRpcError,
|
|
@@ -13,5 +17,7 @@ export {
|
|
|
13
17
|
createIFrameNexusClient,
|
|
14
18
|
createIframe,
|
|
15
19
|
decompressDataAndCheckHash,
|
|
16
|
-
hashAndCompressData
|
|
20
|
+
hashAndCompressData,
|
|
21
|
+
productTypes,
|
|
22
|
+
productTypesMask
|
|
17
23
|
};
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkPURWUKEMcjs = require('../../chunk-PURWUKEM.cjs');
|
|
7
|
+
require('../../chunk-AANA3LEO.cjs');
|
|
7
8
|
require('../../chunk-ETV4XYOV.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
exports.PressActionsSelector =
|
|
14
|
+
exports.PressActionsSelector = _chunkPURWUKEMcjs.PressActionsSelector; exports.PressInteractionEncoder = _chunkPURWUKEMcjs.PressInteractionEncoder; exports.ReferralActionsSelector = _chunkPURWUKEMcjs.ReferralActionsSelector; exports.ReferralInteractionEncoder = _chunkPURWUKEMcjs.ReferralInteractionEncoder;
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
PressInteractionEncoder,
|
|
4
4
|
ReferralActionsSelector,
|
|
5
5
|
ReferralInteractionEncoder
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-IH3QWPWT.js";
|
|
7
|
+
import "../../chunk-22T2NHQK.js";
|
|
7
8
|
import "../../chunk-PKBMQBKP.js";
|
|
8
9
|
export {
|
|
9
10
|
PressActionsSelector,
|
package/dist/react/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk5SGDBU5Scjs = require('../chunk-5SGDBU5S.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -15,10 +15,11 @@ var _chunk2SGRLI7Tcjs = require('../chunk-2SGRLI7T.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkUOEVM7TRcjs = require('../chunk-UOEVM7TR.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkPURWUKEMcjs = require('../chunk-PURWUKEM.cjs');
|
|
22
|
+
require('../chunk-AANA3LEO.cjs');
|
|
22
23
|
require('../chunk-ETV4XYOV.cjs');
|
|
23
24
|
|
|
24
25
|
// src/react/provider/NexusConfigProvider.ts
|
|
@@ -51,8 +52,8 @@ function NexusConfigProvider(parameters) {
|
|
|
51
52
|
function useNexusConfig() {
|
|
52
53
|
const config = _react.useContext.call(void 0, NexusConfigContext);
|
|
53
54
|
if (!config) {
|
|
54
|
-
throw new (0,
|
|
55
|
-
|
|
55
|
+
throw new (0, _chunk5SGDBU5Scjs.FrakRpcError)(
|
|
56
|
+
_chunk5SGDBU5Scjs.RpcErrorCodes.configError,
|
|
56
57
|
"Nexus config not found"
|
|
57
58
|
);
|
|
58
59
|
}
|
|
@@ -85,11 +86,11 @@ function useWalletStatus() {
|
|
|
85
86
|
queryKey: ["nexus-sdk", "wallet-status-listener"],
|
|
86
87
|
queryFn: async () => {
|
|
87
88
|
if (!client) {
|
|
88
|
-
throw new (0,
|
|
89
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
89
90
|
}
|
|
90
|
-
const firstResult = new (0,
|
|
91
|
+
const firstResult = new (0, _chunk5SGDBU5Scjs.Deferred)();
|
|
91
92
|
let hasResolved = false;
|
|
92
|
-
await
|
|
93
|
+
await _chunkUOEVM7TRcjs.watchWalletStatus.call(void 0, client, (status) => {
|
|
93
94
|
newStatusUpdated(status);
|
|
94
95
|
if (!hasResolved) {
|
|
95
96
|
firstResult.resolve(status);
|
|
@@ -113,9 +114,9 @@ function useSendTransactionAction({
|
|
|
113
114
|
mutationKey: ["nexus-sdk", "send-transaction"],
|
|
114
115
|
mutationFn: async (params) => {
|
|
115
116
|
if (!client) {
|
|
116
|
-
throw new (0,
|
|
117
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
117
118
|
}
|
|
118
|
-
return
|
|
119
|
+
return _chunkUOEVM7TRcjs.sendTransaction.call(void 0, client, params);
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
}
|
|
@@ -135,9 +136,9 @@ function useSiweAuthenticate({
|
|
|
135
136
|
],
|
|
136
137
|
mutationFn: async (params) => {
|
|
137
138
|
if (!client) {
|
|
138
|
-
throw new (0,
|
|
139
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
139
140
|
}
|
|
140
|
-
return
|
|
141
|
+
return _chunkUOEVM7TRcjs.siweAuthenticate.call(void 0, client, params);
|
|
141
142
|
}
|
|
142
143
|
});
|
|
143
144
|
}
|
|
@@ -158,9 +159,9 @@ function useDisplayModal({
|
|
|
158
159
|
mutationKey: ["nexus-sdk", "display-modal"],
|
|
159
160
|
mutationFn: async (args) => {
|
|
160
161
|
if (!client) {
|
|
161
|
-
throw new (0,
|
|
162
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
162
163
|
}
|
|
163
|
-
return
|
|
164
|
+
return _chunkUOEVM7TRcjs.displayModal.call(void 0, client, args);
|
|
164
165
|
}
|
|
165
166
|
});
|
|
166
167
|
}
|
|
@@ -176,9 +177,9 @@ function useSendInteraction({
|
|
|
176
177
|
mutationKey: ["nexus-sdk", "send-interaction"],
|
|
177
178
|
mutationFn: async (params) => {
|
|
178
179
|
if (!client) {
|
|
179
|
-
throw new (0,
|
|
180
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
180
181
|
}
|
|
181
|
-
return
|
|
182
|
+
return _chunkUOEVM7TRcjs.sendInteraction.call(void 0, client, params);
|
|
182
183
|
}
|
|
183
184
|
});
|
|
184
185
|
}
|
|
@@ -233,7 +234,7 @@ function useNexusContext() {
|
|
|
233
234
|
const url = new URL(location.href);
|
|
234
235
|
const nexusContext2 = url.searchParams.get(contextKey);
|
|
235
236
|
if (!nexusContext2) return null;
|
|
236
|
-
const parsedContext = await
|
|
237
|
+
const parsedContext = await _chunk5SGDBU5Scjs.decompressJson.call(void 0, nexusContext2);
|
|
237
238
|
if (!parsedContext) return null;
|
|
238
239
|
return parsedContext;
|
|
239
240
|
},
|
|
@@ -244,7 +245,7 @@ function useNexusContext() {
|
|
|
244
245
|
mutationFn: async (newContext) => {
|
|
245
246
|
if (!location || typeof window === "undefined") return;
|
|
246
247
|
const fullNewContext = nexusContext ? { ...nexusContext, ...newContext } : newContext;
|
|
247
|
-
const compressedContext = await
|
|
248
|
+
const compressedContext = await _chunk5SGDBU5Scjs.compressJson.call(void 0, fullNewContext);
|
|
248
249
|
if (!compressedContext) return;
|
|
249
250
|
const url = new URL(location.href);
|
|
250
251
|
url.searchParams.set(contextKey, compressedContext);
|
|
@@ -260,7 +261,7 @@ function useNexusContext() {
|
|
|
260
261
|
|
|
261
262
|
// src/react/hook/helper/useReferralInteraction.ts
|
|
262
263
|
function useReferralInteraction({
|
|
263
|
-
|
|
264
|
+
productId,
|
|
264
265
|
modalConfig
|
|
265
266
|
} = {}) {
|
|
266
267
|
const { nexusContext, updateContextAsync } = useNexusContext();
|
|
@@ -285,10 +286,10 @@ function useReferralInteraction({
|
|
|
285
286
|
if (currentWallet && _viem.isAddressEqual.call(void 0, nexusContext.r, currentWallet)) {
|
|
286
287
|
return "self-referral";
|
|
287
288
|
}
|
|
288
|
-
const interaction =
|
|
289
|
+
const interaction = _chunkPURWUKEMcjs.ReferralInteractionEncoder.referred({
|
|
289
290
|
referrer: nexusContext.r
|
|
290
291
|
});
|
|
291
|
-
await sendInteraction2({
|
|
292
|
+
await sendInteraction2({ productId, interaction });
|
|
292
293
|
if (currentWallet) {
|
|
293
294
|
await updateContextAsync({ r: currentWallet });
|
|
294
295
|
}
|
|
@@ -298,7 +299,7 @@ function useReferralInteraction({
|
|
|
298
299
|
}
|
|
299
300
|
}, [
|
|
300
301
|
nexusContext,
|
|
301
|
-
|
|
302
|
+
productId,
|
|
302
303
|
ensureWalletConnected,
|
|
303
304
|
sendInteraction2,
|
|
304
305
|
updateContextAsync,
|
|
@@ -343,11 +344,11 @@ function useEnsureWalletConnected({
|
|
|
343
344
|
}, [walletStatus, modalConfig, displayModal2]);
|
|
344
345
|
}
|
|
345
346
|
function mapErrorToState(error) {
|
|
346
|
-
if (error instanceof
|
|
347
|
+
if (error instanceof _chunk5SGDBU5Scjs.FrakRpcError) {
|
|
347
348
|
switch (error.code) {
|
|
348
|
-
case
|
|
349
|
+
case _chunk5SGDBU5Scjs.RpcErrorCodes.walletNotConnected:
|
|
349
350
|
return "no-wallet";
|
|
350
|
-
case
|
|
351
|
+
case _chunk5SGDBU5Scjs.RpcErrorCodes.noInteractionSession:
|
|
351
352
|
return "no-session";
|
|
352
353
|
default:
|
|
353
354
|
return "error";
|
|
@@ -365,9 +366,9 @@ function useOpenSso({ mutations } = {}) {
|
|
|
365
366
|
mutationKey: ["nexus-sdk", "open-sso"],
|
|
366
367
|
mutationFn: async (params) => {
|
|
367
368
|
if (!client) {
|
|
368
|
-
throw new (0,
|
|
369
|
+
throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
|
|
369
370
|
}
|
|
370
|
-
return
|
|
371
|
+
return _chunkUOEVM7TRcjs.openSso.call(void 0, client, params);
|
|
371
372
|
}
|
|
372
373
|
});
|
|
373
374
|
}
|
|
@@ -383,15 +384,15 @@ function NexusIFrameClientProvider({
|
|
|
383
384
|
const config = useNexusConfig();
|
|
384
385
|
const [client, setClient] = _react.useState.call(void 0, void 0);
|
|
385
386
|
const iFrame = _react.createElement.call(void 0, "iframe", {
|
|
386
|
-
...
|
|
387
|
+
..._chunk5SGDBU5Scjs.baseIframeProps,
|
|
387
388
|
src: `${config.walletUrl}/listener`,
|
|
388
|
-
style: _nullishCoalesce(style, () => (
|
|
389
|
+
style: _nullishCoalesce(style, () => ( _chunk5SGDBU5Scjs.baseIframeProps.style)),
|
|
389
390
|
ref: (iframe) => {
|
|
390
391
|
if (!iframe || client) {
|
|
391
392
|
return;
|
|
392
393
|
}
|
|
393
394
|
setClient(
|
|
394
|
-
|
|
395
|
+
_chunk5SGDBU5Scjs.createIFrameNexusClient.call(void 0, {
|
|
395
396
|
iframe,
|
|
396
397
|
config
|
|
397
398
|
})
|
package/dist/react/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-
|
|
3
|
+
import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-DXITs1Kf.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-C4Zm5nQe.cjs';
|
|
9
|
-
import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-
|
|
10
|
-
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-
|
|
9
|
+
import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-C19oCc6X.cjs';
|
|
10
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
11
11
|
import 'viem/chains';
|
|
12
12
|
import 'viem/siwe';
|
|
13
13
|
|
|
@@ -116,11 +116,11 @@ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-sessi
|
|
|
116
116
|
/**
|
|
117
117
|
* Helper hook to automatically submit a referral interaction when detected
|
|
118
118
|
* -> And automatically set the referral context in the url
|
|
119
|
-
* @param
|
|
119
|
+
* @param productId
|
|
120
120
|
* @param modalConfig
|
|
121
121
|
*/
|
|
122
|
-
declare function useReferralInteraction({
|
|
123
|
-
|
|
122
|
+
declare function useReferralInteraction({ productId, modalConfig, }?: {
|
|
123
|
+
productId?: Hex;
|
|
124
124
|
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
125
125
|
}): ReferralState;
|
|
126
126
|
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-
|
|
3
|
+
import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-DJd7-ajw.js';
|
|
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-C4Zm5nQe.js';
|
|
9
|
-
import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-
|
|
10
|
-
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-
|
|
9
|
+
import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-fLvpfqaQ.js';
|
|
10
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
11
11
|
import 'viem/chains';
|
|
12
12
|
import 'viem/siwe';
|
|
13
13
|
|
|
@@ -116,11 +116,11 @@ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-sessi
|
|
|
116
116
|
/**
|
|
117
117
|
* Helper hook to automatically submit a referral interaction when detected
|
|
118
118
|
* -> And automatically set the referral context in the url
|
|
119
|
-
* @param
|
|
119
|
+
* @param productId
|
|
120
120
|
* @param modalConfig
|
|
121
121
|
*/
|
|
122
|
-
declare function useReferralInteraction({
|
|
123
|
-
|
|
122
|
+
declare function useReferralInteraction({ productId, modalConfig, }?: {
|
|
123
|
+
productId?: Hex;
|
|
124
124
|
modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
|
|
125
125
|
}): ReferralState;
|
|
126
126
|
|
package/dist/react/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
compressJson,
|
|
8
8
|
createIFrameNexusClient,
|
|
9
9
|
decompressJson
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-5LZQXBFJ.js";
|
|
11
11
|
import {
|
|
12
12
|
displayModal,
|
|
13
13
|
openSso,
|
|
@@ -15,10 +15,11 @@ import {
|
|
|
15
15
|
sendTransaction,
|
|
16
16
|
siweAuthenticate,
|
|
17
17
|
watchWalletStatus
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-S223FMEJ.js";
|
|
19
19
|
import {
|
|
20
20
|
ReferralInteractionEncoder
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-IH3QWPWT.js";
|
|
22
|
+
import "../chunk-22T2NHQK.js";
|
|
22
23
|
import "../chunk-PKBMQBKP.js";
|
|
23
24
|
|
|
24
25
|
// src/react/provider/NexusConfigProvider.ts
|
|
@@ -260,7 +261,7 @@ function useNexusContext() {
|
|
|
260
261
|
|
|
261
262
|
// src/react/hook/helper/useReferralInteraction.ts
|
|
262
263
|
function useReferralInteraction({
|
|
263
|
-
|
|
264
|
+
productId,
|
|
264
265
|
modalConfig
|
|
265
266
|
} = {}) {
|
|
266
267
|
const { nexusContext, updateContextAsync } = useNexusContext();
|
|
@@ -288,7 +289,7 @@ function useReferralInteraction({
|
|
|
288
289
|
const interaction = ReferralInteractionEncoder.referred({
|
|
289
290
|
referrer: nexusContext.r
|
|
290
291
|
});
|
|
291
|
-
await sendInteraction2({
|
|
292
|
+
await sendInteraction2({ productId, interaction });
|
|
292
293
|
if (currentWallet) {
|
|
293
294
|
await updateContextAsync({ r: currentWallet });
|
|
294
295
|
}
|
|
@@ -298,7 +299,7 @@ function useReferralInteraction({
|
|
|
298
299
|
}
|
|
299
300
|
}, [
|
|
300
301
|
nexusContext,
|
|
301
|
-
|
|
302
|
+
productId,
|
|
302
303
|
ensureWalletConnected,
|
|
303
304
|
sendInteraction2,
|
|
304
305
|
updateContextAsync,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-
|
|
1
|
+
import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-DXITs1Kf.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Partial SIWE params, since we can rebuild them from the SDK if they are empty
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-
|
|
1
|
+
import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-DJd7-ajw.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Partial SIWE params, since we can rebuild them from the SDK if they are empty
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.
|
|
14
|
+
"version": "0.0.14",
|
|
15
15
|
"description": "Nexus Wallet client SDK, helping any person to interact with the Frak wallet, and require the unlock of a premium article within the Frak ecosystem.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"js-sha256": "^0.11.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@tanstack/react-query": ">=5.
|
|
84
|
+
"@tanstack/react-query": ">=5.53.3",
|
|
85
85
|
"@types/node": "^22",
|
|
86
86
|
"tsup": "^8.2.4",
|
|
87
87
|
"typescript": "^5"
|