@frak-labs/nexus-sdk 0.0.2-alpha → 0.0.4
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-4X75PGSK.cjs → chunk-2XUJYDD3.cjs} +4 -4
- package/dist/chunk-3LF3FGI6.cjs +78 -0
- package/dist/{chunk-JE64MPH2.js → chunk-5QWG35A2.js} +4 -4
- package/dist/chunk-DI2REDPX.js +78 -0
- package/dist/chunk-JXQKTLEE.cjs +171 -0
- package/dist/chunk-OXP3VK26.js +171 -0
- package/dist/{client-SCwoh_kP.d.cts → client-gnNyzrko.d.cts} +9 -7
- package/dist/{client-SCwoh_kP.d.ts → client-gnNyzrko.d.ts} +9 -7
- package/dist/core/actions/index.cjs +3 -65
- package/dist/core/actions/index.d.cts +6 -39
- package/dist/core/actions/index.d.ts +6 -39
- package/dist/core/actions/index.js +7 -69
- package/dist/core/index.cjs +22 -179
- package/dist/core/index.d.cts +7 -7
- package/dist/core/index.d.ts +7 -7
- package/dist/core/index.js +5 -162
- package/dist/react/index.cjs +169 -0
- package/dist/react/index.d.cts +99 -0
- package/dist/react/index.d.ts +99 -0
- package/dist/react/index.js +169 -0
- package/dist/watchUnlockStatus-Btjg-WTs.d.ts +38 -0
- package/dist/watchUnlockStatus-DvDS55TN.d.cts +38 -0
- package/package.json +10 -2
|
@@ -3,75 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunk4X75PGSKcjs = require('../../chunk-4X75PGSK.cjs');
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return client.request({
|
|
11
|
-
method: "frak_getArticleUnlockOptions",
|
|
12
|
-
params: [client.config.contentId, articleId]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
7
|
+
var _chunk3LF3FGI6cjs = require('../../chunk-3LF3FGI6.cjs');
|
|
8
|
+
require('../../chunk-2XUJYDD3.cjs');
|
|
15
9
|
|
|
16
|
-
// src/core/actions/watchUnlockStatus.ts
|
|
17
|
-
function watchUnlockStatus(client, { articleId }, callback) {
|
|
18
|
-
return client.listenerRequest(
|
|
19
|
-
{
|
|
20
|
-
method: "frak_listenToArticleUnlockStatus",
|
|
21
|
-
params: [client.config.contentId, articleId]
|
|
22
|
-
},
|
|
23
|
-
callback
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
10
|
|
|
27
|
-
// src/core/actions/watchWalletStatus.ts
|
|
28
|
-
function watchWalletStatus(client, callback) {
|
|
29
|
-
return client.listenerRequest(
|
|
30
|
-
{
|
|
31
|
-
method: "frak_listenToWalletStatus"
|
|
32
|
-
},
|
|
33
|
-
callback
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
11
|
|
|
37
|
-
// src/core/actions/startUnlock.ts
|
|
38
|
-
async function getStartArticleUnlockUrl(config, params) {
|
|
39
|
-
const { compressed, compressedHash } = await _chunk4X75PGSKcjs.hashAndCompressData.call(void 0,
|
|
40
|
-
{
|
|
41
|
-
method: "frak_startArticleUnlock",
|
|
42
|
-
params: {
|
|
43
|
-
...params,
|
|
44
|
-
contentId: config.contentId,
|
|
45
|
-
contentTitle: config.contentTitle
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
_chunk4X75PGSKcjs.redirectRequestKeyProvider
|
|
49
|
-
);
|
|
50
|
-
const outputUrl = new URL(config.walletUrl);
|
|
51
|
-
outputUrl.pathname = "/paywall";
|
|
52
|
-
outputUrl.searchParams.set("params", encodeURIComponent(compressed));
|
|
53
|
-
outputUrl.searchParams.set("hash", encodeURIComponent(compressedHash));
|
|
54
|
-
return outputUrl.toString();
|
|
55
|
-
}
|
|
56
|
-
async function decodeStartUnlockReturn({
|
|
57
|
-
result,
|
|
58
|
-
hash
|
|
59
|
-
}) {
|
|
60
|
-
const keyProvider = _chunk4X75PGSKcjs.getRedirectResponseResponseKeyProvider.call(void 0,
|
|
61
|
-
"frak_startArticleUnlock"
|
|
62
|
-
);
|
|
63
|
-
return _chunk4X75PGSKcjs.decompressDataAndCheckHash.call(void 0,
|
|
64
|
-
{
|
|
65
|
-
compressed: decodeURIComponent(result),
|
|
66
|
-
compressedHash: decodeURIComponent(hash)
|
|
67
|
-
},
|
|
68
|
-
keyProvider
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
12
|
|
|
72
13
|
|
|
73
14
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
exports.decodeStartUnlockReturn = decodeStartUnlockReturn; exports.getArticleUnlockOptions = getArticleUnlockOptions; exports.getStartArticleUnlockUrl = getStartArticleUnlockUrl; exports.watchUnlockStatus = watchUnlockStatus; exports.watchWalletStatus = watchWalletStatus;
|
|
15
|
+
exports.decodeStartUnlockReturn = _chunk3LF3FGI6cjs.decodeStartUnlockReturn; exports.getArticleUnlockOptions = _chunk3LF3FGI6cjs.getArticleUnlockOptions; exports.getStartArticleUnlockUrl = _chunk3LF3FGI6cjs.getStartArticleUnlockUrl; exports.watchUnlockStatus = _chunk3LF3FGI6cjs.watchUnlockStatus; exports.watchWalletStatus = _chunk3LF3FGI6cjs.watchWalletStatus;
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-DvDS55TN.cjs';
|
|
2
|
+
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-gnNyzrko.cjs';
|
|
3
|
+
import 'viem';
|
|
3
4
|
import 'viem/chains';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Type used to get the unlock options
|
|
7
|
-
*/
|
|
8
|
-
type GetUnlockOptionsParams = {
|
|
9
|
-
articleId: Hex;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Function used to fetch the unlock option for the given client
|
|
13
|
-
* @param client
|
|
14
|
-
* @param articleId
|
|
15
|
-
*/
|
|
16
|
-
declare function getArticleUnlockOptions(client: FrakClient, { articleId }: GetUnlockOptionsParams): Promise<Readonly<{
|
|
17
|
-
prices: {
|
|
18
|
-
index: number;
|
|
19
|
-
unlockDurationInSec: number;
|
|
20
|
-
frkAmount: `0x${string}`;
|
|
21
|
-
isUserAccessible: boolean | null;
|
|
22
|
-
}[];
|
|
23
|
-
}>>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Type used to get the unlock options
|
|
27
|
-
*/
|
|
28
|
-
type WatchUnlockStatusParams = {
|
|
29
|
-
articleId: Hex;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Function used to watch a current article unlock status
|
|
33
|
-
* @param client
|
|
34
|
-
* @param articleId
|
|
35
|
-
* @param callback
|
|
36
|
-
*/
|
|
37
|
-
declare function watchUnlockStatus(client: FrakClient, { articleId }: WatchUnlockStatusParams, callback: (status: ArticleUnlockStatusReturnType) => void): Promise<void>;
|
|
38
|
-
|
|
39
6
|
/**
|
|
40
7
|
* Function used to watch the current nexus wallet status
|
|
41
8
|
* @param client
|
|
42
9
|
* @param callback
|
|
43
10
|
*/
|
|
44
|
-
declare function watchWalletStatus(client:
|
|
11
|
+
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
45
12
|
|
|
46
13
|
type GetStartUnlockUrlParams = Omit<StartArticleUnlockParams, "contentId" | "contentTitle">;
|
|
47
14
|
/**
|
|
@@ -49,7 +16,7 @@ type GetStartUnlockUrlParams = Omit<StartArticleUnlockParams, "contentId" | "con
|
|
|
49
16
|
* @param config
|
|
50
17
|
* @param params
|
|
51
18
|
*/
|
|
52
|
-
declare function getStartArticleUnlockUrl(config:
|
|
19
|
+
declare function getStartArticleUnlockUrl(config: NexusWalletSdkConfig, params: GetStartUnlockUrlParams): Promise<string>;
|
|
53
20
|
/**
|
|
54
21
|
* Function used to decode the response from the start unlock request (return typed passed as query param)
|
|
55
22
|
*/
|
|
@@ -60,4 +27,4 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
|
|
|
60
27
|
validationHash: string;
|
|
61
28
|
}>>;
|
|
62
29
|
|
|
63
|
-
export { decodeStartUnlockReturn,
|
|
30
|
+
export { decodeStartUnlockReturn, getStartArticleUnlockUrl, watchWalletStatus };
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-Btjg-WTs.js';
|
|
2
|
+
import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-gnNyzrko.js';
|
|
3
|
+
import 'viem';
|
|
3
4
|
import 'viem/chains';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Type used to get the unlock options
|
|
7
|
-
*/
|
|
8
|
-
type GetUnlockOptionsParams = {
|
|
9
|
-
articleId: Hex;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Function used to fetch the unlock option for the given client
|
|
13
|
-
* @param client
|
|
14
|
-
* @param articleId
|
|
15
|
-
*/
|
|
16
|
-
declare function getArticleUnlockOptions(client: FrakClient, { articleId }: GetUnlockOptionsParams): Promise<Readonly<{
|
|
17
|
-
prices: {
|
|
18
|
-
index: number;
|
|
19
|
-
unlockDurationInSec: number;
|
|
20
|
-
frkAmount: `0x${string}`;
|
|
21
|
-
isUserAccessible: boolean | null;
|
|
22
|
-
}[];
|
|
23
|
-
}>>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Type used to get the unlock options
|
|
27
|
-
*/
|
|
28
|
-
type WatchUnlockStatusParams = {
|
|
29
|
-
articleId: Hex;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Function used to watch a current article unlock status
|
|
33
|
-
* @param client
|
|
34
|
-
* @param articleId
|
|
35
|
-
* @param callback
|
|
36
|
-
*/
|
|
37
|
-
declare function watchUnlockStatus(client: FrakClient, { articleId }: WatchUnlockStatusParams, callback: (status: ArticleUnlockStatusReturnType) => void): Promise<void>;
|
|
38
|
-
|
|
39
6
|
/**
|
|
40
7
|
* Function used to watch the current nexus wallet status
|
|
41
8
|
* @param client
|
|
42
9
|
* @param callback
|
|
43
10
|
*/
|
|
44
|
-
declare function watchWalletStatus(client:
|
|
11
|
+
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
45
12
|
|
|
46
13
|
type GetStartUnlockUrlParams = Omit<StartArticleUnlockParams, "contentId" | "contentTitle">;
|
|
47
14
|
/**
|
|
@@ -49,7 +16,7 @@ type GetStartUnlockUrlParams = Omit<StartArticleUnlockParams, "contentId" | "con
|
|
|
49
16
|
* @param config
|
|
50
17
|
* @param params
|
|
51
18
|
*/
|
|
52
|
-
declare function getStartArticleUnlockUrl(config:
|
|
19
|
+
declare function getStartArticleUnlockUrl(config: NexusWalletSdkConfig, params: GetStartUnlockUrlParams): Promise<string>;
|
|
53
20
|
/**
|
|
54
21
|
* Function used to decode the response from the start unlock request (return typed passed as query param)
|
|
55
22
|
*/
|
|
@@ -60,4 +27,4 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
|
|
|
60
27
|
validationHash: string;
|
|
61
28
|
}>>;
|
|
62
29
|
|
|
63
|
-
export { decodeStartUnlockReturn,
|
|
30
|
+
export { decodeStartUnlockReturn, getStartArticleUnlockUrl, watchWalletStatus };
|
|
@@ -1,73 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function getArticleUnlockOptions(client, { articleId }) {
|
|
10
|
-
return client.request({
|
|
11
|
-
method: "frak_getArticleUnlockOptions",
|
|
12
|
-
params: [client.config.contentId, articleId]
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/core/actions/watchUnlockStatus.ts
|
|
17
|
-
function watchUnlockStatus(client, { articleId }, callback) {
|
|
18
|
-
return client.listenerRequest(
|
|
19
|
-
{
|
|
20
|
-
method: "frak_listenToArticleUnlockStatus",
|
|
21
|
-
params: [client.config.contentId, articleId]
|
|
22
|
-
},
|
|
23
|
-
callback
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/core/actions/watchWalletStatus.ts
|
|
28
|
-
function watchWalletStatus(client, callback) {
|
|
29
|
-
return client.listenerRequest(
|
|
30
|
-
{
|
|
31
|
-
method: "frak_listenToWalletStatus"
|
|
32
|
-
},
|
|
33
|
-
callback
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/core/actions/startUnlock.ts
|
|
38
|
-
async function getStartArticleUnlockUrl(config, params) {
|
|
39
|
-
const { compressed, compressedHash } = await hashAndCompressData(
|
|
40
|
-
{
|
|
41
|
-
method: "frak_startArticleUnlock",
|
|
42
|
-
params: {
|
|
43
|
-
...params,
|
|
44
|
-
contentId: config.contentId,
|
|
45
|
-
contentTitle: config.contentTitle
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
redirectRequestKeyProvider
|
|
49
|
-
);
|
|
50
|
-
const outputUrl = new URL(config.walletUrl);
|
|
51
|
-
outputUrl.pathname = "/paywall";
|
|
52
|
-
outputUrl.searchParams.set("params", encodeURIComponent(compressed));
|
|
53
|
-
outputUrl.searchParams.set("hash", encodeURIComponent(compressedHash));
|
|
54
|
-
return outputUrl.toString();
|
|
55
|
-
}
|
|
56
|
-
async function decodeStartUnlockReturn({
|
|
57
|
-
result,
|
|
58
|
-
hash
|
|
59
|
-
}) {
|
|
60
|
-
const keyProvider = getRedirectResponseResponseKeyProvider(
|
|
61
|
-
"frak_startArticleUnlock"
|
|
62
|
-
);
|
|
63
|
-
return decompressDataAndCheckHash(
|
|
64
|
-
{
|
|
65
|
-
compressed: decodeURIComponent(result),
|
|
66
|
-
compressedHash: decodeURIComponent(hash)
|
|
67
|
-
},
|
|
68
|
-
keyProvider
|
|
69
|
-
);
|
|
70
|
-
}
|
|
2
|
+
decodeStartUnlockReturn,
|
|
3
|
+
getArticleUnlockOptions,
|
|
4
|
+
getStartArticleUnlockUrl,
|
|
5
|
+
watchUnlockStatus,
|
|
6
|
+
watchWalletStatus
|
|
7
|
+
} from "../../chunk-DI2REDPX.js";
|
|
8
|
+
import "../../chunk-5QWG35A2.js";
|
|
71
9
|
export {
|
|
72
10
|
decodeStartUnlockReturn,
|
|
73
11
|
getArticleUnlockOptions,
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,179 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
this._promise = new Promise((resolve, reject) => {
|
|
25
|
-
this._resolve = resolve;
|
|
26
|
-
this._reject = reject;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
get promise() {
|
|
30
|
-
return this._promise;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// src/core/clients/transports/iframeChannelManager.ts
|
|
35
|
-
function createIFrameChannelManager() {
|
|
36
|
-
const channels = /* @__PURE__ */ new Map();
|
|
37
|
-
return {
|
|
38
|
-
// TODO: Better id system?? uid stuff?
|
|
39
|
-
createChannel: (resolver) => {
|
|
40
|
-
const id = Math.random().toString(36).substring(7);
|
|
41
|
-
channels.set(id, resolver);
|
|
42
|
-
return id;
|
|
43
|
-
},
|
|
44
|
-
getRpcResolver: (id) => channels.get(id),
|
|
45
|
-
removeChannel: (id) => channels.delete(id),
|
|
46
|
-
destroy: () => channels.clear()
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// src/core/clients/transports/iframeMessageHandler.ts
|
|
51
|
-
function createIFrameMessageHandler({
|
|
52
|
-
frakWalletUrl,
|
|
53
|
-
iframe,
|
|
54
|
-
channelManager
|
|
55
|
-
}) {
|
|
56
|
-
if (typeof window === "undefined") {
|
|
57
|
-
throw new Error("iframe client should be used in the browser");
|
|
58
|
-
}
|
|
59
|
-
if (!iframe.contentWindow) {
|
|
60
|
-
throw new Error("The iframe does not have a content window");
|
|
61
|
-
}
|
|
62
|
-
const contentWindow = iframe.contentWindow;
|
|
63
|
-
const isConnected = new Deferred();
|
|
64
|
-
const msgHandler = async (event) => {
|
|
65
|
-
if (!event.origin) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (new URL(event.origin).origin.toLowerCase() !== new URL(frakWalletUrl).origin.toLowerCase()) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if ("lifecycle" in event.data) {
|
|
72
|
-
isConnected.resolve(event.data.lifecycle === "connected");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const channel = event.data.id;
|
|
76
|
-
const resolver = channelManager.getRpcResolver(channel);
|
|
77
|
-
if (!resolver) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
await resolver(event.data);
|
|
81
|
-
};
|
|
82
|
-
window.addEventListener("message", msgHandler);
|
|
83
|
-
const sendEvent = (message) => {
|
|
84
|
-
contentWindow.postMessage(message, {
|
|
85
|
-
targetOrigin: frakWalletUrl
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const cleanup = () => {
|
|
89
|
-
window.removeEventListener("message", msgHandler);
|
|
90
|
-
};
|
|
91
|
-
return {
|
|
92
|
-
isConnected: isConnected.promise,
|
|
93
|
-
sendEvent,
|
|
94
|
-
cleanup
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// src/core/clients/createIFrameFrakClient.ts
|
|
99
|
-
function createIFrameFrakClient({
|
|
100
|
-
config,
|
|
101
|
-
iframe
|
|
102
|
-
}) {
|
|
103
|
-
const channelManager = createIFrameChannelManager();
|
|
104
|
-
const messageHandler = createIFrameMessageHandler({
|
|
105
|
-
frakWalletUrl: config.walletUrl,
|
|
106
|
-
iframe,
|
|
107
|
-
channelManager
|
|
108
|
-
});
|
|
109
|
-
const request = async (args) => {
|
|
110
|
-
const isConnected = await messageHandler.isConnected;
|
|
111
|
-
if (!isConnected) {
|
|
112
|
-
throw new Error("The iframe provider isn't connected yet");
|
|
113
|
-
}
|
|
114
|
-
const result = new Deferred();
|
|
115
|
-
const resultCompressionKeyProvider = _chunk4X75PGSKcjs.getIFrameResponseKeyProvider.call(void 0, args);
|
|
116
|
-
const channelId = channelManager.createChannel(async (message) => {
|
|
117
|
-
const decompressed = await _chunk4X75PGSKcjs.decompressDataAndCheckHash.call(void 0,
|
|
118
|
-
message.data,
|
|
119
|
-
resultCompressionKeyProvider
|
|
120
|
-
);
|
|
121
|
-
result.resolve(decompressed);
|
|
122
|
-
channelManager.removeChannel(channelId);
|
|
123
|
-
});
|
|
124
|
-
const compressedMessage = await _chunk4X75PGSKcjs.hashAndCompressData.call(void 0,
|
|
125
|
-
args,
|
|
126
|
-
_chunk4X75PGSKcjs.iFrameRequestKeyProvider
|
|
127
|
-
);
|
|
128
|
-
messageHandler.sendEvent({
|
|
129
|
-
id: channelId,
|
|
130
|
-
topic: args.method,
|
|
131
|
-
data: compressedMessage
|
|
132
|
-
});
|
|
133
|
-
return result.promise;
|
|
134
|
-
};
|
|
135
|
-
const listenerRequest = async (args, callback) => {
|
|
136
|
-
const isConnected = await messageHandler.isConnected;
|
|
137
|
-
if (!isConnected) {
|
|
138
|
-
throw new Error("The iframe provider isn't connected yet");
|
|
139
|
-
}
|
|
140
|
-
const resultCompressionKeyProvider = _chunk4X75PGSKcjs.getIFrameResponseKeyProvider.call(void 0, args);
|
|
141
|
-
const channelId = channelManager.createChannel(async (message) => {
|
|
142
|
-
const decompressed = await _chunk4X75PGSKcjs.decompressDataAndCheckHash.call(void 0,
|
|
143
|
-
message.data,
|
|
144
|
-
resultCompressionKeyProvider
|
|
145
|
-
);
|
|
146
|
-
callback(decompressed);
|
|
147
|
-
});
|
|
148
|
-
const compressedMessage = await _chunk4X75PGSKcjs.hashAndCompressData.call(void 0,
|
|
149
|
-
args,
|
|
150
|
-
_chunk4X75PGSKcjs.iFrameRequestKeyProvider
|
|
151
|
-
);
|
|
152
|
-
messageHandler.sendEvent({
|
|
153
|
-
id: channelId,
|
|
154
|
-
topic: args.method,
|
|
155
|
-
data: compressedMessage
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
const destroy = async () => {
|
|
159
|
-
channelManager.destroy();
|
|
160
|
-
messageHandler.cleanup();
|
|
161
|
-
};
|
|
162
|
-
return {
|
|
163
|
-
config,
|
|
164
|
-
waitForConnection: messageHandler.isConnected,
|
|
165
|
-
request,
|
|
166
|
-
listenerRequest,
|
|
167
|
-
destroy
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
exports.createIFrameFrakClient = createIFrameFrakClient; exports.createIframe = _chunk4X75PGSKcjs.createIframe; exports.decompressDataAndCheckHash = _chunk4X75PGSKcjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunk4X75PGSKcjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunk4X75PGSKcjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunk4X75PGSKcjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunk4X75PGSKcjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunk4X75PGSKcjs.redirectRequestKeyProvider;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkJXQKTLEEcjs = require('../chunk-JXQKTLEE.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk2XUJYDD3cjs = require('../chunk-2XUJYDD3.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.createIFrameNexusClient = _chunkJXQKTLEEcjs.createIFrameNexusClient; exports.createIframe = _chunk2XUJYDD3cjs.createIframe; exports.decompressDataAndCheckHash = _chunk2XUJYDD3cjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunk2XUJYDD3cjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunk2XUJYDD3cjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunk2XUJYDD3cjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunk2XUJYDD3cjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunk2XUJYDD3cjs.redirectRequestKeyProvider;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-
|
|
1
|
+
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, c as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-gnNyzrko.cjs';
|
|
2
|
+
export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-gnNyzrko.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Create a new iframe
|
|
7
|
+
* Create a new iframe Nexus client
|
|
8
8
|
*/
|
|
9
|
-
declare function
|
|
10
|
-
config:
|
|
9
|
+
declare function createIFrameNexusClient({ config, iframe, }: {
|
|
10
|
+
config: NexusWalletSdkConfig;
|
|
11
11
|
iframe: HTMLIFrameElement;
|
|
12
|
-
}):
|
|
12
|
+
}): NexusClient;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Create the given iframe
|
|
@@ -80,4 +80,4 @@ type RedirectRpcResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<R
|
|
|
80
80
|
*/
|
|
81
81
|
declare function getRedirectResponseResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]>(method: TMethod): RedirectRpcResponseKeyProvider<TMethod>;
|
|
82
82
|
|
|
83
|
-
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc,
|
|
83
|
+
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc, type HashProtectedData, IFrameRpcSchema, type KeyProvider, NexusClient, NexusWalletSdkConfig, RedirectRpcSchema, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, getIFrameResponseKeyProvider, getRedirectResponseResponseKeyProvider, hashAndCompressData, iFrameRequestKeyProvider, redirectRequestKeyProvider };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-
|
|
1
|
+
import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, c as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-gnNyzrko.js';
|
|
2
|
+
export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-gnNyzrko.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/chains';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Create a new iframe
|
|
7
|
+
* Create a new iframe Nexus client
|
|
8
8
|
*/
|
|
9
|
-
declare function
|
|
10
|
-
config:
|
|
9
|
+
declare function createIFrameNexusClient({ config, iframe, }: {
|
|
10
|
+
config: NexusWalletSdkConfig;
|
|
11
11
|
iframe: HTMLIFrameElement;
|
|
12
|
-
}):
|
|
12
|
+
}): NexusClient;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Create the given iframe
|
|
@@ -80,4 +80,4 @@ type RedirectRpcResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<R
|
|
|
80
80
|
*/
|
|
81
81
|
declare function getRedirectResponseResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]>(method: TMethod): RedirectRpcResponseKeyProvider<TMethod>;
|
|
82
82
|
|
|
83
|
-
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc,
|
|
83
|
+
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc, type HashProtectedData, IFrameRpcSchema, type KeyProvider, NexusClient, NexusWalletSdkConfig, RedirectRpcSchema, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, getIFrameResponseKeyProvider, getRedirectResponseResponseKeyProvider, hashAndCompressData, iFrameRequestKeyProvider, redirectRequestKeyProvider };
|