@frak-labs/nexus-sdk 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/{chunk-JXQKTLEE.cjs → chunk-AYZHGMEV.cjs} +14 -14
- package/dist/{chunk-DI2REDPX.js → chunk-PDR3CF3P.js} +19 -11
- package/dist/{chunk-OXP3VK26.js → chunk-SZUN32YC.js} +1 -1
- package/dist/{chunk-5QWG35A2.js → chunk-VK7GPKK4.js} +9 -0
- package/dist/{chunk-3LF3FGI6.cjs → chunk-X4JNNWJ4.cjs} +23 -15
- package/dist/{chunk-2XUJYDD3.cjs → chunk-ZOLP2FJZ.cjs} +9 -0
- package/dist/{client-DWLJ8zR-.d.ts → client-BwzXSgqQ.d.cts} +32 -3
- package/dist/{client-DWLJ8zR-.d.cts → client-BwzXSgqQ.d.ts} +32 -3
- package/dist/core/actions/index.cjs +5 -3
- package/dist/core/actions/index.d.cts +21 -5
- package/dist/core/actions/index.d.ts +21 -5
- package/dist/core/actions/index.js +4 -2
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/react/index.cjs +148 -18
- package/dist/react/index.d.cts +25 -11
- package/dist/react/index.d.ts +25 -11
- package/dist/react/index.js +146 -16
- package/dist/{watchUnlockStatus-B4kRztOM.d.cts → watchUnlockStatus-DXClCYH9.d.cts} +8 -3
- package/dist/{watchUnlockStatus--7dFtOJr.d.ts → watchUnlockStatus-WJxoDliF.d.ts} +8 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Nexus Wallet SDK
|
|
2
2
|
|
|
3
|
-
This SDK help any dApps, or gated content provider, use the [Nexus Wallet](https://
|
|
3
|
+
This SDK help any dApps, or gated content provider, use the [Nexus Wallet](https://nexus.frak.id/) as a regular wallet, with smoother UX for your end-users (pay for his gas fees, check the paywall options, track his consumption etc.)
|
|
4
4
|
|
|
5
5
|
Checkout our documentation for more informations about the usage:
|
|
6
6
|
- [React client usage](https://docs.frak.id/wallet-sdk/how-to/client-react)
|
|
@@ -29,11 +29,12 @@ import type { NexusClient, NexusWalletSdkConfig } from "@frak-labs/nexus-sdk/cor
|
|
|
29
29
|
// Create the config for the Nexus Wallet SDK
|
|
30
30
|
export const nexusConfig: NexusWalletSdkConfig = {
|
|
31
31
|
// The current url for the wallet sdk
|
|
32
|
-
walletUrl: "https://
|
|
33
|
-
// The
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
walletUrl: "https://nexus-dev.frak.id",
|
|
33
|
+
// The name of your dapp
|
|
34
|
+
metadata: {
|
|
35
|
+
// Your app name
|
|
36
|
+
name: string,
|
|
37
|
+
},
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// Create the iFrame and the associated NexusClient
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZOLP2FJZcjs = require('./chunk-ZOLP2FJZ.cjs');
|
|
8
8
|
|
|
9
9
|
// src/core/utils/Deferred.ts
|
|
10
10
|
var Deferred = class {
|
|
11
11
|
constructor() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
_chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_promise");
|
|
13
|
+
_chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_resolve");
|
|
14
|
+
_chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_reject");
|
|
15
|
+
_chunkZOLP2FJZcjs.__publicField.call(void 0, this, "resolve", (value) => {
|
|
16
16
|
_optionalChain([this, 'access', _ => _._resolve, 'optionalCall', _2 => _2(value)]);
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
_chunkZOLP2FJZcjs.__publicField.call(void 0, this, "reject", (reason) => {
|
|
19
19
|
_optionalChain([this, 'access', _3 => _3._reject, 'optionalCall', _4 => _4(reason)]);
|
|
20
20
|
});
|
|
21
21
|
this._promise = new Promise((resolve, reject) => {
|
|
@@ -109,18 +109,18 @@ function createIFrameNexusClient({
|
|
|
109
109
|
throw new Error("The iframe provider isn't connected yet");
|
|
110
110
|
}
|
|
111
111
|
const result = new Deferred();
|
|
112
|
-
const resultCompressionKeyProvider =
|
|
112
|
+
const resultCompressionKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider.call(void 0, args);
|
|
113
113
|
const channelId = channelManager.createChannel(async (message) => {
|
|
114
|
-
const decompressed = await
|
|
114
|
+
const decompressed = await _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
|
|
115
115
|
message.data,
|
|
116
116
|
resultCompressionKeyProvider
|
|
117
117
|
);
|
|
118
118
|
result.resolve(decompressed);
|
|
119
119
|
channelManager.removeChannel(channelId);
|
|
120
120
|
});
|
|
121
|
-
const compressedMessage = await
|
|
121
|
+
const compressedMessage = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
|
|
122
122
|
args,
|
|
123
|
-
|
|
123
|
+
_chunkZOLP2FJZcjs.iFrameRequestKeyProvider
|
|
124
124
|
);
|
|
125
125
|
messageHandler.sendEvent({
|
|
126
126
|
id: channelId,
|
|
@@ -134,17 +134,17 @@ function createIFrameNexusClient({
|
|
|
134
134
|
if (!isConnected) {
|
|
135
135
|
throw new Error("The iframe provider isn't connected yet");
|
|
136
136
|
}
|
|
137
|
-
const resultCompressionKeyProvider =
|
|
137
|
+
const resultCompressionKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider.call(void 0, args);
|
|
138
138
|
const channelId = channelManager.createChannel(async (message) => {
|
|
139
|
-
const decompressed = await
|
|
139
|
+
const decompressed = await _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
|
|
140
140
|
message.data,
|
|
141
141
|
resultCompressionKeyProvider
|
|
142
142
|
);
|
|
143
143
|
callback(decompressed);
|
|
144
144
|
});
|
|
145
|
-
const compressedMessage = await
|
|
145
|
+
const compressedMessage = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
|
|
146
146
|
args,
|
|
147
|
-
|
|
147
|
+
_chunkZOLP2FJZcjs.iFrameRequestKeyProvider
|
|
148
148
|
);
|
|
149
149
|
messageHandler.sendEvent({
|
|
150
150
|
id: channelId,
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
getRedirectResponseResponseKeyProvider,
|
|
4
4
|
hashAndCompressData,
|
|
5
5
|
redirectRequestKeyProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VK7GPKK4.js";
|
|
7
7
|
|
|
8
8
|
// src/core/actions/getUnlockOptions.ts
|
|
9
|
-
function getArticleUnlockOptions(client, { articleId }) {
|
|
9
|
+
function getArticleUnlockOptions(client, { articleId, contentId }) {
|
|
10
10
|
return client.request({
|
|
11
11
|
method: "frak_getArticleUnlockOptions",
|
|
12
|
-
params: [
|
|
12
|
+
params: [contentId, articleId]
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// src/core/actions/watchUnlockStatus.ts
|
|
17
|
-
function watchUnlockStatus(client, { articleId }, callback) {
|
|
17
|
+
function watchUnlockStatus(client, { articleId, contentId }, callback) {
|
|
18
18
|
return client.listenerRequest(
|
|
19
19
|
{
|
|
20
20
|
method: "frak_listenToArticleUnlockStatus",
|
|
21
|
-
params: [
|
|
21
|
+
params: [contentId, articleId]
|
|
22
22
|
},
|
|
23
23
|
callback
|
|
24
24
|
);
|
|
@@ -39,11 +39,7 @@ async function getStartArticleUnlockUrl(config, params) {
|
|
|
39
39
|
const { compressed, compressedHash } = await hashAndCompressData(
|
|
40
40
|
{
|
|
41
41
|
method: "frak_startArticleUnlock",
|
|
42
|
-
params
|
|
43
|
-
...params,
|
|
44
|
-
contentId: config.contentId,
|
|
45
|
-
contentTitle: config.contentTitle
|
|
46
|
-
}
|
|
42
|
+
params
|
|
47
43
|
},
|
|
48
44
|
redirectRequestKeyProvider
|
|
49
45
|
);
|
|
@@ -69,10 +65,22 @@ async function decodeStartUnlockReturn({
|
|
|
69
65
|
);
|
|
70
66
|
}
|
|
71
67
|
|
|
68
|
+
// src/core/actions/setUserReferred.ts
|
|
69
|
+
function setUserReferred(client, { contentId, walletAddress }, callback) {
|
|
70
|
+
return client.listenerRequest(
|
|
71
|
+
{
|
|
72
|
+
method: "frak_listenToSetUserReferred",
|
|
73
|
+
params: [contentId, walletAddress]
|
|
74
|
+
},
|
|
75
|
+
callback
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
export {
|
|
73
80
|
getArticleUnlockOptions,
|
|
74
81
|
watchUnlockStatus,
|
|
75
82
|
watchWalletStatus,
|
|
76
83
|
getStartArticleUnlockUrl,
|
|
77
|
-
decodeStartUnlockReturn
|
|
84
|
+
decodeStartUnlockReturn,
|
|
85
|
+
setUserReferred
|
|
78
86
|
};
|
|
@@ -74,6 +74,9 @@ var iFrameRequestKeyProvider = (args) => {
|
|
|
74
74
|
if (args.method === "frak_listenToArticleUnlockStatus") {
|
|
75
75
|
return ["article-unlock-status", args.params[0], args.params[1]];
|
|
76
76
|
}
|
|
77
|
+
if (args.method === "frak_listenToSetUserReferred") {
|
|
78
|
+
return ["user-referred", args.params[0], args.params[1]];
|
|
79
|
+
}
|
|
77
80
|
throw new Error(`No key provider found for the arguments ${args}`);
|
|
78
81
|
};
|
|
79
82
|
function getIFrameResponseKeyProvider(param) {
|
|
@@ -97,6 +100,12 @@ function getIFrameResponseKeyProvider(param) {
|
|
|
97
100
|
response.key === "valid" ? response.allowedUntil.toString(16) : "deadbeef"
|
|
98
101
|
];
|
|
99
102
|
}
|
|
103
|
+
if (param.method === "frak_listenToSetUserReferred") {
|
|
104
|
+
return (response) => [
|
|
105
|
+
"user-referred",
|
|
106
|
+
response.key
|
|
107
|
+
];
|
|
108
|
+
}
|
|
100
109
|
throw new Error(`No key provider found for the request ${param}`);
|
|
101
110
|
}
|
|
102
111
|
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZOLP2FJZcjs = require('./chunk-ZOLP2FJZ.cjs');
|
|
7
7
|
|
|
8
8
|
// src/core/actions/getUnlockOptions.ts
|
|
9
|
-
function getArticleUnlockOptions(client, { articleId }) {
|
|
9
|
+
function getArticleUnlockOptions(client, { articleId, contentId }) {
|
|
10
10
|
return client.request({
|
|
11
11
|
method: "frak_getArticleUnlockOptions",
|
|
12
|
-
params: [
|
|
12
|
+
params: [contentId, articleId]
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// src/core/actions/watchUnlockStatus.ts
|
|
17
|
-
function watchUnlockStatus(client, { articleId }, callback) {
|
|
17
|
+
function watchUnlockStatus(client, { articleId, contentId }, callback) {
|
|
18
18
|
return client.listenerRequest(
|
|
19
19
|
{
|
|
20
20
|
method: "frak_listenToArticleUnlockStatus",
|
|
21
|
-
params: [
|
|
21
|
+
params: [contentId, articleId]
|
|
22
22
|
},
|
|
23
23
|
callback
|
|
24
24
|
);
|
|
@@ -36,16 +36,12 @@ function watchWalletStatus(client, callback) {
|
|
|
36
36
|
|
|
37
37
|
// src/core/actions/startUnlock.ts
|
|
38
38
|
async function getStartArticleUnlockUrl(config, params) {
|
|
39
|
-
const { compressed, compressedHash } = await
|
|
39
|
+
const { compressed, compressedHash } = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
|
|
40
40
|
{
|
|
41
41
|
method: "frak_startArticleUnlock",
|
|
42
|
-
params
|
|
43
|
-
...params,
|
|
44
|
-
contentId: config.contentId,
|
|
45
|
-
contentTitle: config.contentTitle
|
|
46
|
-
}
|
|
42
|
+
params
|
|
47
43
|
},
|
|
48
|
-
|
|
44
|
+
_chunkZOLP2FJZcjs.redirectRequestKeyProvider
|
|
49
45
|
);
|
|
50
46
|
const outputUrl = new URL(config.walletUrl);
|
|
51
47
|
outputUrl.pathname = "/paywall";
|
|
@@ -57,10 +53,10 @@ async function decodeStartUnlockReturn({
|
|
|
57
53
|
result,
|
|
58
54
|
hash
|
|
59
55
|
}) {
|
|
60
|
-
const keyProvider =
|
|
56
|
+
const keyProvider = _chunkZOLP2FJZcjs.getRedirectResponseResponseKeyProvider.call(void 0,
|
|
61
57
|
"frak_startArticleUnlock"
|
|
62
58
|
);
|
|
63
|
-
return
|
|
59
|
+
return _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
|
|
64
60
|
{
|
|
65
61
|
compressed: decodeURIComponent(result),
|
|
66
62
|
compressedHash: decodeURIComponent(hash)
|
|
@@ -69,10 +65,22 @@ async function decodeStartUnlockReturn({
|
|
|
69
65
|
);
|
|
70
66
|
}
|
|
71
67
|
|
|
68
|
+
// src/core/actions/setUserReferred.ts
|
|
69
|
+
function setUserReferred(client, { contentId, walletAddress }, callback) {
|
|
70
|
+
return client.listenerRequest(
|
|
71
|
+
{
|
|
72
|
+
method: "frak_listenToSetUserReferred",
|
|
73
|
+
params: [contentId, walletAddress]
|
|
74
|
+
},
|
|
75
|
+
callback
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
72
80
|
|
|
73
81
|
|
|
74
82
|
|
|
75
83
|
|
|
76
84
|
|
|
77
85
|
|
|
78
|
-
exports.getArticleUnlockOptions = getArticleUnlockOptions; exports.watchUnlockStatus = watchUnlockStatus; exports.watchWalletStatus = watchWalletStatus; exports.getStartArticleUnlockUrl = getStartArticleUnlockUrl; exports.decodeStartUnlockReturn = decodeStartUnlockReturn;
|
|
86
|
+
exports.getArticleUnlockOptions = getArticleUnlockOptions; exports.watchUnlockStatus = watchUnlockStatus; exports.watchWalletStatus = watchWalletStatus; exports.getStartArticleUnlockUrl = getStartArticleUnlockUrl; exports.decodeStartUnlockReturn = decodeStartUnlockReturn; exports.setUserReferred = setUserReferred;
|
|
@@ -74,6 +74,9 @@ var iFrameRequestKeyProvider = (args) => {
|
|
|
74
74
|
if (args.method === "frak_listenToArticleUnlockStatus") {
|
|
75
75
|
return ["article-unlock-status", args.params[0], args.params[1]];
|
|
76
76
|
}
|
|
77
|
+
if (args.method === "frak_listenToSetUserReferred") {
|
|
78
|
+
return ["user-referred", args.params[0], args.params[1]];
|
|
79
|
+
}
|
|
77
80
|
throw new Error(`No key provider found for the arguments ${args}`);
|
|
78
81
|
};
|
|
79
82
|
function getIFrameResponseKeyProvider(param) {
|
|
@@ -97,6 +100,12 @@ function getIFrameResponseKeyProvider(param) {
|
|
|
97
100
|
response.key === "valid" ? response.allowedUntil.toString(16) : "deadbeef"
|
|
98
101
|
];
|
|
99
102
|
}
|
|
103
|
+
if (param.method === "frak_listenToSetUserReferred") {
|
|
104
|
+
return (response) => [
|
|
105
|
+
"user-referred",
|
|
106
|
+
response.key
|
|
107
|
+
];
|
|
108
|
+
}
|
|
100
109
|
throw new Error(`No key provider found for the request ${param}`);
|
|
101
110
|
}
|
|
102
111
|
|
|
@@ -6,9 +6,30 @@ import { Prettify } from 'viem/chains';
|
|
|
6
6
|
*/
|
|
7
7
|
type NexusWalletSdkConfig = Readonly<{
|
|
8
8
|
walletUrl: string;
|
|
9
|
+
metadata: {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Parameters of the referred request
|
|
16
|
+
*/
|
|
17
|
+
type SetUserReferredParams = Readonly<{
|
|
9
18
|
contentId: Hex;
|
|
10
|
-
contentTitle: string;
|
|
11
19
|
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Return type of the referred request
|
|
22
|
+
*/
|
|
23
|
+
type SetUserReferredReturnType = UserIsSameWallet | UserReferredSuccessful | UserReferredHistory;
|
|
24
|
+
type UserIsSameWallet = {
|
|
25
|
+
key: "same-wallet";
|
|
26
|
+
};
|
|
27
|
+
type UserReferredSuccessful = {
|
|
28
|
+
key: "referred-successful";
|
|
29
|
+
};
|
|
30
|
+
type UserReferredHistory = {
|
|
31
|
+
key: "referred-history";
|
|
32
|
+
};
|
|
12
33
|
|
|
13
34
|
type PaidArticleUnlockPrice = Readonly<{
|
|
14
35
|
index: number;
|
|
@@ -57,6 +78,7 @@ type UnlockError = {
|
|
|
57
78
|
* The response to the get unlock options response
|
|
58
79
|
*/
|
|
59
80
|
type UnlockOptionsReturnType = Readonly<{
|
|
81
|
+
frkBalanceAsHex?: Hex;
|
|
60
82
|
prices: {
|
|
61
83
|
index: number;
|
|
62
84
|
unlockDurationInSec: number;
|
|
@@ -116,7 +138,6 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
|
|
|
116
138
|
type WalletConnected = {
|
|
117
139
|
key: "connected";
|
|
118
140
|
wallet: Address;
|
|
119
|
-
frkBalanceAsHex: Hex;
|
|
120
141
|
};
|
|
121
142
|
type WalletNotConnected = {
|
|
122
143
|
key: "not-connected";
|
|
@@ -149,6 +170,14 @@ type IFrameRpcSchema = [
|
|
|
149
170
|
Method: "frak_listenToArticleUnlockStatus";
|
|
150
171
|
Parameters: [contentId: Hex, articleId: Hex];
|
|
151
172
|
ReturnType: ArticleUnlockStatusReturnType;
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Method used to set the referred user
|
|
176
|
+
*/
|
|
177
|
+
{
|
|
178
|
+
Method: "frak_listenToSetUserReferred";
|
|
179
|
+
Parameters: [contentId: Hex, walletAddress: Address];
|
|
180
|
+
ReturnType: SetUserReferredReturnType;
|
|
152
181
|
}
|
|
153
182
|
];
|
|
154
183
|
/**
|
|
@@ -246,4 +275,4 @@ type NexusClient = {
|
|
|
246
275
|
config: NexusWalletSdkConfig;
|
|
247
276
|
} & IFrameTransport;
|
|
248
277
|
|
|
249
|
-
export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b,
|
|
278
|
+
export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, SetUserReferredReturnType as c, ExtractedReturnTypeFromRpc as d, SetUserReferredParams as e, IFrameTransport as f, IFrameRpcEvent as g, IFrameEvent as h };
|
|
@@ -6,9 +6,30 @@ import { Prettify } from 'viem/chains';
|
|
|
6
6
|
*/
|
|
7
7
|
type NexusWalletSdkConfig = Readonly<{
|
|
8
8
|
walletUrl: string;
|
|
9
|
+
metadata: {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Parameters of the referred request
|
|
16
|
+
*/
|
|
17
|
+
type SetUserReferredParams = Readonly<{
|
|
9
18
|
contentId: Hex;
|
|
10
|
-
contentTitle: string;
|
|
11
19
|
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Return type of the referred request
|
|
22
|
+
*/
|
|
23
|
+
type SetUserReferredReturnType = UserIsSameWallet | UserReferredSuccessful | UserReferredHistory;
|
|
24
|
+
type UserIsSameWallet = {
|
|
25
|
+
key: "same-wallet";
|
|
26
|
+
};
|
|
27
|
+
type UserReferredSuccessful = {
|
|
28
|
+
key: "referred-successful";
|
|
29
|
+
};
|
|
30
|
+
type UserReferredHistory = {
|
|
31
|
+
key: "referred-history";
|
|
32
|
+
};
|
|
12
33
|
|
|
13
34
|
type PaidArticleUnlockPrice = Readonly<{
|
|
14
35
|
index: number;
|
|
@@ -57,6 +78,7 @@ type UnlockError = {
|
|
|
57
78
|
* The response to the get unlock options response
|
|
58
79
|
*/
|
|
59
80
|
type UnlockOptionsReturnType = Readonly<{
|
|
81
|
+
frkBalanceAsHex?: Hex;
|
|
60
82
|
prices: {
|
|
61
83
|
index: number;
|
|
62
84
|
unlockDurationInSec: number;
|
|
@@ -116,7 +138,6 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
|
|
|
116
138
|
type WalletConnected = {
|
|
117
139
|
key: "connected";
|
|
118
140
|
wallet: Address;
|
|
119
|
-
frkBalanceAsHex: Hex;
|
|
120
141
|
};
|
|
121
142
|
type WalletNotConnected = {
|
|
122
143
|
key: "not-connected";
|
|
@@ -149,6 +170,14 @@ type IFrameRpcSchema = [
|
|
|
149
170
|
Method: "frak_listenToArticleUnlockStatus";
|
|
150
171
|
Parameters: [contentId: Hex, articleId: Hex];
|
|
151
172
|
ReturnType: ArticleUnlockStatusReturnType;
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Method used to set the referred user
|
|
176
|
+
*/
|
|
177
|
+
{
|
|
178
|
+
Method: "frak_listenToSetUserReferred";
|
|
179
|
+
Parameters: [contentId: Hex, walletAddress: Address];
|
|
180
|
+
ReturnType: SetUserReferredReturnType;
|
|
152
181
|
}
|
|
153
182
|
];
|
|
154
183
|
/**
|
|
@@ -246,4 +275,4 @@ type NexusClient = {
|
|
|
246
275
|
config: NexusWalletSdkConfig;
|
|
247
276
|
} & IFrameTransport;
|
|
248
277
|
|
|
249
|
-
export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b,
|
|
278
|
+
export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, SetUserReferredReturnType as c, ExtractedReturnTypeFromRpc as d, SetUserReferredParams as e, IFrameTransport as f, IFrameRpcEvent as g, IFrameEvent as h };
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunk3LF3FGI6cjs = require('../../chunk-3LF3FGI6.cjs');
|
|
8
|
-
require('../../chunk-2XUJYDD3.cjs');
|
|
9
7
|
|
|
8
|
+
var _chunkX4JNNWJ4cjs = require('../../chunk-X4JNNWJ4.cjs');
|
|
9
|
+
require('../../chunk-ZOLP2FJZ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.decodeStartUnlockReturn = _chunkX4JNNWJ4cjs.decodeStartUnlockReturn; exports.getArticleUnlockOptions = _chunkX4JNNWJ4cjs.getArticleUnlockOptions; exports.getStartArticleUnlockUrl = _chunkX4JNNWJ4cjs.getStartArticleUnlockUrl; exports.setUserReferred = _chunkX4JNNWJ4cjs.setUserReferred; exports.watchUnlockStatus = _chunkX4JNNWJ4cjs.watchUnlockStatus; exports.watchWalletStatus = _chunkX4JNNWJ4cjs.watchWalletStatus;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-
|
|
2
|
-
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-
|
|
3
|
-
import 'viem';
|
|
1
|
+
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-DXClCYH9.cjs';
|
|
2
|
+
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams, c as SetUserReferredReturnType } from '../../client-BwzXSgqQ.cjs';
|
|
3
|
+
import { Hex, Address } from 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ import 'viem/chains';
|
|
|
10
10
|
*/
|
|
11
11
|
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
12
12
|
|
|
13
|
-
type GetStartUnlockUrlParams =
|
|
13
|
+
type GetStartUnlockUrlParams = StartArticleUnlockParams;
|
|
14
14
|
/**
|
|
15
15
|
* Function used to build the unlock URL for a given article
|
|
16
16
|
* @param config
|
|
@@ -27,4 +27,20 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
|
|
|
27
27
|
validationHash: string;
|
|
28
28
|
}>>;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Type used to get the user referred options
|
|
32
|
+
*/
|
|
33
|
+
type SetUserReferredParams = {
|
|
34
|
+
contentId: Hex;
|
|
35
|
+
walletAddress: Address;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Function used to watch a current user referred
|
|
39
|
+
* @param client
|
|
40
|
+
* @param contentId
|
|
41
|
+
* @param walletAddress
|
|
42
|
+
* @param callback
|
|
43
|
+
*/
|
|
44
|
+
declare function setUserReferred(client: NexusClient, { contentId, walletAddress }: SetUserReferredParams, callback: (status: SetUserReferredReturnType) => void): Promise<void>;
|
|
45
|
+
|
|
46
|
+
export { decodeStartUnlockReturn, getStartArticleUnlockUrl, setUserReferred, watchWalletStatus };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus
|
|
2
|
-
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-
|
|
3
|
-
import 'viem';
|
|
1
|
+
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-WJxoDliF.js';
|
|
2
|
+
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams, c as SetUserReferredReturnType } from '../../client-BwzXSgqQ.js';
|
|
3
|
+
import { Hex, Address } from 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ import 'viem/chains';
|
|
|
10
10
|
*/
|
|
11
11
|
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
12
12
|
|
|
13
|
-
type GetStartUnlockUrlParams =
|
|
13
|
+
type GetStartUnlockUrlParams = StartArticleUnlockParams;
|
|
14
14
|
/**
|
|
15
15
|
* Function used to build the unlock URL for a given article
|
|
16
16
|
* @param config
|
|
@@ -27,4 +27,20 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
|
|
|
27
27
|
validationHash: string;
|
|
28
28
|
}>>;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Type used to get the user referred options
|
|
32
|
+
*/
|
|
33
|
+
type SetUserReferredParams = {
|
|
34
|
+
contentId: Hex;
|
|
35
|
+
walletAddress: Address;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Function used to watch a current user referred
|
|
39
|
+
* @param client
|
|
40
|
+
* @param contentId
|
|
41
|
+
* @param walletAddress
|
|
42
|
+
* @param callback
|
|
43
|
+
*/
|
|
44
|
+
declare function setUserReferred(client: NexusClient, { contentId, walletAddress }: SetUserReferredParams, callback: (status: SetUserReferredReturnType) => void): Promise<void>;
|
|
45
|
+
|
|
46
|
+
export { decodeStartUnlockReturn, getStartArticleUnlockUrl, setUserReferred, watchWalletStatus };
|
|
@@ -2,14 +2,16 @@ import {
|
|
|
2
2
|
decodeStartUnlockReturn,
|
|
3
3
|
getArticleUnlockOptions,
|
|
4
4
|
getStartArticleUnlockUrl,
|
|
5
|
+
setUserReferred,
|
|
5
6
|
watchUnlockStatus,
|
|
6
7
|
watchWalletStatus
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-PDR3CF3P.js";
|
|
9
|
+
import "../../chunk-VK7GPKK4.js";
|
|
9
10
|
export {
|
|
10
11
|
decodeStartUnlockReturn,
|
|
11
12
|
getArticleUnlockOptions,
|
|
12
13
|
getStartArticleUnlockUrl,
|
|
14
|
+
setUserReferred,
|
|
13
15
|
watchUnlockStatus,
|
|
14
16
|
watchWalletStatus
|
|
15
17
|
};
|
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 _chunkAYZHGMEVcjs = require('../chunk-AYZHGMEV.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ var _chunkJXQKTLEEcjs = require('../chunk-JXQKTLEE.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkZOLP2FJZcjs = require('../chunk-ZOLP2FJZ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -19,4 +19,4 @@ var _chunk2XUJYDD3cjs = require('../chunk-2XUJYDD3.cjs');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
exports.createIFrameNexusClient =
|
|
22
|
+
exports.createIFrameNexusClient = _chunkAYZHGMEVcjs.createIFrameNexusClient; exports.createIframe = _chunkZOLP2FJZcjs.createIframe; exports.decompressDataAndCheckHash = _chunkZOLP2FJZcjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunkZOLP2FJZcjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunkZOLP2FJZcjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunkZOLP2FJZcjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunkZOLP2FJZcjs.redirectRequestKeyProvider;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema,
|
|
2
|
-
export { A as ArticleUnlockStatusReturnType,
|
|
1
|
+
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, d as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-BwzXSgqQ.cjs';
|
|
2
|
+
export { A as ArticleUnlockStatusReturnType, h as IFrameEvent, g as IFrameRpcEvent, f as IFrameTransport, P as PaidArticleUnlockPrice, e as SetUserReferredParams, c as SetUserReferredReturnType, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-BwzXSgqQ.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema,
|
|
2
|
-
export { A as ArticleUnlockStatusReturnType,
|
|
1
|
+
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, d as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-BwzXSgqQ.js';
|
|
2
|
+
export { A as ArticleUnlockStatusReturnType, h as IFrameEvent, g as IFrameRpcEvent, f as IFrameTransport, P as PaidArticleUnlockPrice, e as SetUserReferredParams, c as SetUserReferredReturnType, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-BwzXSgqQ.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SZUN32YC.js";
|
|
4
4
|
import {
|
|
5
5
|
createIframe,
|
|
6
6
|
decompressDataAndCheckHash,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
hashAndCompressData,
|
|
10
10
|
iFrameRequestKeyProvider,
|
|
11
11
|
redirectRequestKeyProvider
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-VK7GPKK4.js";
|
|
13
13
|
export {
|
|
14
14
|
createIFrameNexusClient,
|
|
15
15
|
createIframe,
|