@frak-labs/nexus-sdk 0.0.24 → 0.0.26
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 +2 -72
- package/dist/bundle/bundle.js +6 -6
- package/package.json +11 -64
- package/dist/FrakContext-DKSVaeVb.d.cts +0 -450
- package/dist/FrakContext-DjeuWC2U.d.ts +0 -450
- package/dist/chunk-2VNIEGOJ.js +0 -864
- package/dist/chunk-4MMSQL44.js +0 -351
- package/dist/chunk-4PVF24BB.cjs +0 -114
- package/dist/chunk-BOGCLEPR.js +0 -80
- package/dist/chunk-DE2KWQVP.cjs +0 -351
- package/dist/chunk-FETGS7X7.js +0 -114
- package/dist/chunk-H4BK3CNV.cjs +0 -864
- package/dist/chunk-P3J2BIUT.cjs +0 -80
- package/dist/chunk-QLM5NFMZ.cjs +0 -245
- package/dist/chunk-YPQA63LW.js +0 -245
- package/dist/core/actions/index.cjs +0 -29
- package/dist/core/actions/index.d.cts +0 -92
- package/dist/core/actions/index.d.ts +0 -92
- package/dist/core/actions/index.js +0 -29
- package/dist/core/index.cjs +0 -34
- package/dist/core/index.d.cts +0 -167
- package/dist/core/index.d.ts +0 -167
- package/dist/core/index.js +0 -34
- package/dist/core/interactions/index.cjs +0 -13
- package/dist/core/interactions/index.d.cts +0 -65
- package/dist/core/interactions/index.d.ts +0 -65
- package/dist/core/interactions/index.js +0 -13
- package/dist/error-Dflr3G5x.d.cts +0 -27
- package/dist/error-Dflr3G5x.d.ts +0 -27
- package/dist/interaction-BngPoHA0.d.cts +0 -22
- package/dist/interaction-BngPoHA0.d.ts +0 -22
- package/dist/processReferral-CJI_Rc4K.d.ts +0 -53
- package/dist/processReferral-DUP8imQV.d.cts +0 -53
- package/dist/react/index.cjs +0 -366
- package/dist/react/index.d.cts +0 -167
- package/dist/react/index.d.ts +0 -167
- package/dist/react/index.js +0 -366
package/dist/chunk-DE2KWQVP.cjs
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkH4BK3CNVcjs = require('./chunk-H4BK3CNV.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk4PVF24BBcjs = require('./chunk-4PVF24BB.cjs');
|
|
10
|
-
|
|
11
|
-
// src/core/actions/watchWalletStatus.ts
|
|
12
|
-
function watchWalletStatus(client, callback) {
|
|
13
|
-
if (!callback) {
|
|
14
|
-
return client.request({ method: "frak_listenToWalletStatus" }).then((result) => {
|
|
15
|
-
savePotentialToken(result.interactionToken);
|
|
16
|
-
return result;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
const firstResult = new (0, _chunkH4BK3CNVcjs.Deferred)();
|
|
20
|
-
let hasResolved = false;
|
|
21
|
-
return client.listenerRequest(
|
|
22
|
-
{
|
|
23
|
-
method: "frak_listenToWalletStatus"
|
|
24
|
-
},
|
|
25
|
-
(status) => {
|
|
26
|
-
callback(status);
|
|
27
|
-
savePotentialToken(status.interactionToken);
|
|
28
|
-
if (!hasResolved) {
|
|
29
|
-
firstResult.resolve(status);
|
|
30
|
-
hasResolved = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
).then(() => firstResult.promise);
|
|
34
|
-
}
|
|
35
|
-
function savePotentialToken(interactionToken) {
|
|
36
|
-
if (typeof window === "undefined") {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (interactionToken) {
|
|
40
|
-
window.sessionStorage.setItem(
|
|
41
|
-
"frak-wallet-interaction-token",
|
|
42
|
-
interactionToken
|
|
43
|
-
);
|
|
44
|
-
} else {
|
|
45
|
-
window.sessionStorage.removeItem("frak.interaction-token");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/core/utils/computeProductId.ts
|
|
50
|
-
var _viem = require('viem');
|
|
51
|
-
function computeProductId({ domain }) {
|
|
52
|
-
const effectiveDomain = _nullishCoalesce(domain, () => ( window.location.host));
|
|
53
|
-
return _viem.keccak256.call(void 0, _viem.toHex.call(void 0, effectiveDomain));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// src/core/actions/sendInteraction.ts
|
|
57
|
-
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
58
|
-
const pId = _nullishCoalesce(productId, () => ( computeProductId(client.config)));
|
|
59
|
-
return await client.request({
|
|
60
|
-
method: "frak_sendInteraction",
|
|
61
|
-
params: [pId, interaction, validation]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/core/actions/displayModal.ts
|
|
66
|
-
async function displayModal(client, { steps, metadata }) {
|
|
67
|
-
return await client.request({
|
|
68
|
-
method: "frak_displayModal",
|
|
69
|
-
params: [steps, client.config.metadata.name, metadata]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/core/actions/openSso.ts
|
|
74
|
-
async function openSso(client, args) {
|
|
75
|
-
const { metadata } = client.config;
|
|
76
|
-
await client.request({
|
|
77
|
-
method: "frak_sso",
|
|
78
|
-
params: [args, metadata.name, metadata.css]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/core/actions/getProductInformation.ts
|
|
83
|
-
async function getProductInformation(client) {
|
|
84
|
-
return await client.request({
|
|
85
|
-
method: "frak_getProductInformation"
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/core/actions/trackPurchaseStatus.ts
|
|
90
|
-
async function trackPurchaseStatus(args) {
|
|
91
|
-
if (typeof window === "undefined") {
|
|
92
|
-
console.warn("[Frak] No window found, can't track purchase");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const interactionToken = window.sessionStorage.getItem(
|
|
96
|
-
"frak-wallet-interaction-token"
|
|
97
|
-
);
|
|
98
|
-
if (!interactionToken) {
|
|
99
|
-
console.warn("[Frak] No frak session found, skipping purchase check");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
await fetch("https://backend.frak.id/interactions/listenForPurchase", {
|
|
103
|
-
method: "POST",
|
|
104
|
-
headers: {
|
|
105
|
-
Accept: "application/json",
|
|
106
|
-
"Content-Type": "application/json",
|
|
107
|
-
"x-wallet-sdk-auth": interactionToken
|
|
108
|
-
},
|
|
109
|
-
body: JSON.stringify(args)
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// src/core/actions/wrapper/siweAuthenticate.ts
|
|
114
|
-
var _siwe = require('viem/siwe');
|
|
115
|
-
async function siweAuthenticate(client, { siwe, metadata }) {
|
|
116
|
-
const effectiveDomain = _nullishCoalesce(_optionalChain([client, 'access', _ => _.config, 'optionalAccess', _2 => _2.domain]), () => ( window.location.host));
|
|
117
|
-
const realStatement = _nullishCoalesce(_optionalChain([siwe, 'optionalAccess', _3 => _3.statement]), () => ( `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`));
|
|
118
|
-
const builtSiwe = {
|
|
119
|
-
...siwe,
|
|
120
|
-
statement: realStatement,
|
|
121
|
-
nonce: _nullishCoalesce(_optionalChain([siwe, 'optionalAccess', _4 => _4.nonce]), () => ( _siwe.generateSiweNonce.call(void 0, ))),
|
|
122
|
-
uri: _nullishCoalesce(_optionalChain([siwe, 'optionalAccess', _5 => _5.uri]), () => ( `https://${effectiveDomain}`)),
|
|
123
|
-
version: _nullishCoalesce(_optionalChain([siwe, 'optionalAccess', _6 => _6.version]), () => ( "1")),
|
|
124
|
-
domain: effectiveDomain
|
|
125
|
-
};
|
|
126
|
-
const result = await displayModal(client, {
|
|
127
|
-
metadata,
|
|
128
|
-
steps: {
|
|
129
|
-
login: {},
|
|
130
|
-
siweAuthenticate: {
|
|
131
|
-
siwe: builtSiwe
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return result.siweAuthenticate;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// src/core/actions/wrapper/sendTransaction.ts
|
|
139
|
-
async function sendTransaction(client, { tx, metadata }) {
|
|
140
|
-
const result = await displayModal(client, {
|
|
141
|
-
metadata,
|
|
142
|
-
steps: {
|
|
143
|
-
login: {},
|
|
144
|
-
sendTransaction: { tx }
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return result.sendTransaction;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/core/actions/wrapper/modalBuilder.ts
|
|
151
|
-
function modalBuilder(client, {
|
|
152
|
-
metadata,
|
|
153
|
-
login,
|
|
154
|
-
openSession
|
|
155
|
-
}) {
|
|
156
|
-
const baseParams = {
|
|
157
|
-
steps: {
|
|
158
|
-
login: _nullishCoalesce(login, () => ( {})),
|
|
159
|
-
openSession: _nullishCoalesce(openSession, () => ( {}))
|
|
160
|
-
},
|
|
161
|
-
metadata
|
|
162
|
-
};
|
|
163
|
-
return modalStepsBuilder(client, baseParams);
|
|
164
|
-
}
|
|
165
|
-
function modalStepsBuilder(client, params) {
|
|
166
|
-
function sendTx(options) {
|
|
167
|
-
return modalStepsBuilder(client, {
|
|
168
|
-
...params,
|
|
169
|
-
steps: {
|
|
170
|
-
...params.steps,
|
|
171
|
-
sendTransaction: options
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function reward(options) {
|
|
176
|
-
return modalStepsBuilder(
|
|
177
|
-
client,
|
|
178
|
-
{
|
|
179
|
-
...params,
|
|
180
|
-
steps: {
|
|
181
|
-
...params.steps,
|
|
182
|
-
final: {
|
|
183
|
-
...options,
|
|
184
|
-
action: { key: "reward" }
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
function sharing(sharingOptions, options) {
|
|
191
|
-
return modalStepsBuilder(
|
|
192
|
-
client,
|
|
193
|
-
{
|
|
194
|
-
...params,
|
|
195
|
-
steps: {
|
|
196
|
-
...params.steps,
|
|
197
|
-
final: {
|
|
198
|
-
...options,
|
|
199
|
-
action: { key: "sharing", options: sharingOptions }
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
async function display() {
|
|
206
|
-
return await displayModal(client, params);
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
// Access current modal params
|
|
210
|
-
params,
|
|
211
|
-
// Function to add new steps
|
|
212
|
-
sendTx,
|
|
213
|
-
reward,
|
|
214
|
-
sharing,
|
|
215
|
-
// Display the modal
|
|
216
|
-
display
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/core/actions/referral/processReferral.ts
|
|
221
|
-
|
|
222
|
-
async function processReferral(client, {
|
|
223
|
-
walletStatus,
|
|
224
|
-
frakContext,
|
|
225
|
-
modalConfig,
|
|
226
|
-
productId,
|
|
227
|
-
options
|
|
228
|
-
}) {
|
|
229
|
-
let walletRequest = false;
|
|
230
|
-
async function getFreshWalletStatus() {
|
|
231
|
-
if (walletRequest) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
walletRequest = true;
|
|
235
|
-
return ensureWalletConnected(client, {
|
|
236
|
-
modalConfig,
|
|
237
|
-
walletStatus
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async function pushReferralInteraction(referrer) {
|
|
241
|
-
const interaction = _chunk4PVF24BBcjs.ReferralInteractionEncoder.referred({
|
|
242
|
-
referrer
|
|
243
|
-
});
|
|
244
|
-
await sendInteraction(client, { productId, interaction });
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
const { status, currentWallet } = await processReferralLogic({
|
|
248
|
-
initialWalletStatus: walletStatus,
|
|
249
|
-
getFreshWalletStatus,
|
|
250
|
-
pushReferralInteraction,
|
|
251
|
-
frakContext
|
|
252
|
-
});
|
|
253
|
-
_chunkH4BK3CNVcjs.FrakContextManager.replaceUrl({
|
|
254
|
-
url: _optionalChain([window, 'access', _7 => _7.location, 'optionalAccess', _8 => _8.href]),
|
|
255
|
-
context: _optionalChain([options, 'optionalAccess', _9 => _9.alwaysAppendUrl]) ? { r: currentWallet } : null
|
|
256
|
-
});
|
|
257
|
-
return status;
|
|
258
|
-
} catch (error) {
|
|
259
|
-
console.log("Error processing referral", { error });
|
|
260
|
-
_chunkH4BK3CNVcjs.FrakContextManager.replaceUrl({
|
|
261
|
-
url: _optionalChain([window, 'access', _10 => _10.location, 'optionalAccess', _11 => _11.href]),
|
|
262
|
-
context: _optionalChain([options, 'optionalAccess', _12 => _12.alwaysAppendUrl]) ? { r: _optionalChain([walletStatus, 'optionalAccess', _13 => _13.wallet]) } : null
|
|
263
|
-
});
|
|
264
|
-
return mapErrorToState(error);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async function processReferralLogic({
|
|
268
|
-
initialWalletStatus,
|
|
269
|
-
getFreshWalletStatus,
|
|
270
|
-
pushReferralInteraction,
|
|
271
|
-
frakContext
|
|
272
|
-
}) {
|
|
273
|
-
let currentWallet = _optionalChain([initialWalletStatus, 'optionalAccess', _14 => _14.wallet]);
|
|
274
|
-
if (!_optionalChain([frakContext, 'optionalAccess', _15 => _15.r])) {
|
|
275
|
-
return { status: "no-referrer", currentWallet };
|
|
276
|
-
}
|
|
277
|
-
if (!currentWallet) {
|
|
278
|
-
currentWallet = await getFreshWalletStatus();
|
|
279
|
-
}
|
|
280
|
-
if (currentWallet && _viem.isAddressEqual.call(void 0, frakContext.r, currentWallet)) {
|
|
281
|
-
return { status: "self-referral", currentWallet };
|
|
282
|
-
}
|
|
283
|
-
if (!_optionalChain([initialWalletStatus, 'optionalAccess', _16 => _16.interactionSession])) {
|
|
284
|
-
currentWallet = await getFreshWalletStatus();
|
|
285
|
-
}
|
|
286
|
-
await pushReferralInteraction(frakContext.r);
|
|
287
|
-
return { status: "success", currentWallet };
|
|
288
|
-
}
|
|
289
|
-
async function ensureWalletConnected(client, {
|
|
290
|
-
modalConfig,
|
|
291
|
-
walletStatus
|
|
292
|
-
}) {
|
|
293
|
-
if (!_optionalChain([walletStatus, 'optionalAccess', _17 => _17.interactionSession])) {
|
|
294
|
-
if (!modalConfig) {
|
|
295
|
-
return void 0;
|
|
296
|
-
}
|
|
297
|
-
const result = await displayModal(client, modalConfig);
|
|
298
|
-
return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _18 => _18.login, 'optionalAccess', _19 => _19.wallet]), () => ( void 0));
|
|
299
|
-
}
|
|
300
|
-
return _nullishCoalesce(walletStatus.wallet, () => ( void 0));
|
|
301
|
-
}
|
|
302
|
-
function mapErrorToState(error) {
|
|
303
|
-
if (error instanceof _chunkH4BK3CNVcjs.FrakRpcError) {
|
|
304
|
-
switch (error.code) {
|
|
305
|
-
case _chunkH4BK3CNVcjs.RpcErrorCodes.walletNotConnected:
|
|
306
|
-
return "no-wallet";
|
|
307
|
-
case _chunkH4BK3CNVcjs.RpcErrorCodes.serverErrorForInteractionDelegation:
|
|
308
|
-
return "no-session";
|
|
309
|
-
default:
|
|
310
|
-
return "error";
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return "error";
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// src/core/actions/referral/referralInteraction.ts
|
|
317
|
-
async function referralInteraction(client, {
|
|
318
|
-
productId,
|
|
319
|
-
modalConfig,
|
|
320
|
-
options
|
|
321
|
-
} = {}) {
|
|
322
|
-
const frakContext = _chunkH4BK3CNVcjs.FrakContextManager.parse({
|
|
323
|
-
url: window.location.href
|
|
324
|
-
});
|
|
325
|
-
const currentWalletStatus = await watchWalletStatus(client);
|
|
326
|
-
try {
|
|
327
|
-
return await processReferral(client, {
|
|
328
|
-
walletStatus: currentWalletStatus,
|
|
329
|
-
frakContext,
|
|
330
|
-
modalConfig,
|
|
331
|
-
productId,
|
|
332
|
-
options
|
|
333
|
-
});
|
|
334
|
-
} catch (error) {
|
|
335
|
-
return error;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
exports.watchWalletStatus = watchWalletStatus; exports.sendInteraction = sendInteraction; exports.displayModal = displayModal; exports.openSso = openSso; exports.getProductInformation = getProductInformation; exports.trackPurchaseStatus = trackPurchaseStatus; exports.siweAuthenticate = siweAuthenticate; exports.sendTransaction = sendTransaction; exports.modalBuilder = modalBuilder; exports.processReferral = processReferral; exports.referralInteraction = referralInteraction;
|
package/dist/chunk-FETGS7X7.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interactionTypes,
|
|
3
|
-
productTypes
|
|
4
|
-
} from "./chunk-BOGCLEPR.js";
|
|
5
|
-
|
|
6
|
-
// src/core/interactions/pressEncoder.ts
|
|
7
|
-
import { concatHex, pad, toHex } from "viem";
|
|
8
|
-
function openArticle({ articleId }) {
|
|
9
|
-
const interactionData = concatHex([
|
|
10
|
-
interactionTypes.press.openArticle,
|
|
11
|
-
pad(articleId, { size: 32 })
|
|
12
|
-
]);
|
|
13
|
-
return {
|
|
14
|
-
handlerTypeDenominator: toHex(productTypes.press),
|
|
15
|
-
interactionData
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function readArticle({ articleId }) {
|
|
19
|
-
const interactionData = concatHex([
|
|
20
|
-
interactionTypes.press.readArticle,
|
|
21
|
-
pad(articleId, { size: 32 })
|
|
22
|
-
]);
|
|
23
|
-
return {
|
|
24
|
-
handlerTypeDenominator: toHex(productTypes.press),
|
|
25
|
-
interactionData
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var PressInteractionEncoder = {
|
|
29
|
-
openArticle,
|
|
30
|
-
readArticle
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/core/interactions/referralEncoder.ts
|
|
34
|
-
import { concatHex as concatHex2, pad as pad2, toHex as toHex2 } from "viem";
|
|
35
|
-
function createLink() {
|
|
36
|
-
const interactionData = concatHex2([
|
|
37
|
-
interactionTypes.referral.createLink,
|
|
38
|
-
"0x"
|
|
39
|
-
]);
|
|
40
|
-
return {
|
|
41
|
-
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
42
|
-
interactionData
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function referred({ referrer }) {
|
|
46
|
-
const interactionData = concatHex2([
|
|
47
|
-
interactionTypes.referral.referred,
|
|
48
|
-
pad2(referrer, { size: 32 })
|
|
49
|
-
]);
|
|
50
|
-
return {
|
|
51
|
-
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
52
|
-
interactionData
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
var ReferralInteractionEncoder = {
|
|
56
|
-
createLink,
|
|
57
|
-
referred
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// src/core/interactions/purchaseEncoder.ts
|
|
61
|
-
import { concatHex as concatHex3, encodeAbiParameters, pad as pad3, toHex as toHex3 } from "viem";
|
|
62
|
-
function startPurchase({
|
|
63
|
-
purchaseId
|
|
64
|
-
}) {
|
|
65
|
-
const interactionData = concatHex3([
|
|
66
|
-
interactionTypes.purchase.started,
|
|
67
|
-
pad3(purchaseId, { size: 32 })
|
|
68
|
-
]);
|
|
69
|
-
return {
|
|
70
|
-
handlerTypeDenominator: toHex3(productTypes.purchase),
|
|
71
|
-
interactionData
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function completedPurchase({
|
|
75
|
-
purchaseId,
|
|
76
|
-
proof
|
|
77
|
-
}) {
|
|
78
|
-
const innerData = encodeAbiParameters(
|
|
79
|
-
[{ type: "uint256" }, { type: "bytes32[]" }],
|
|
80
|
-
[BigInt(purchaseId), proof]
|
|
81
|
-
);
|
|
82
|
-
const interactionData = concatHex3([
|
|
83
|
-
interactionTypes.purchase.completed,
|
|
84
|
-
innerData
|
|
85
|
-
]);
|
|
86
|
-
return {
|
|
87
|
-
handlerTypeDenominator: toHex3(productTypes.purchase),
|
|
88
|
-
interactionData
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
var PurchaseInteractionEncoder = {
|
|
92
|
-
startPurchase,
|
|
93
|
-
completedPurchase
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/core/interactions/webshopEncoder.ts
|
|
97
|
-
import { concatHex as concatHex4, toHex as toHex4 } from "viem";
|
|
98
|
-
function open() {
|
|
99
|
-
const interactionData = concatHex4([interactionTypes.webshop.open, "0x"]);
|
|
100
|
-
return {
|
|
101
|
-
handlerTypeDenominator: toHex4(productTypes.webshop),
|
|
102
|
-
interactionData
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
var WebShopInteractionEncoder = {
|
|
106
|
-
open
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export {
|
|
110
|
-
PressInteractionEncoder,
|
|
111
|
-
ReferralInteractionEncoder,
|
|
112
|
-
PurchaseInteractionEncoder,
|
|
113
|
-
WebShopInteractionEncoder
|
|
114
|
-
};
|