@frak-labs/core-sdk 0.0.2
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/LICENSE +674 -0
- package/README.md +8 -0
- package/cdn/bundle.js +21 -0
- package/dist/actions/index.cjs +352 -0
- package/dist/actions/index.d.cts +503 -0
- package/dist/actions/index.d.ts +503 -0
- package/dist/actions/index.js +352 -0
- package/dist/chunk-K5SAPMC2.js +842 -0
- package/dist/chunk-NJJQPEEL.cjs +842 -0
- package/dist/chunk-PR3T7O5I.cjs +79 -0
- package/dist/chunk-QZL2KCSB.js +79 -0
- package/dist/chunk-RAPLRHQ4.cjs +140 -0
- package/dist/chunk-VAINYZSV.js +140 -0
- package/dist/context-B0trlYGx.d.ts +626 -0
- package/dist/context-GkNATUkF.d.cts +626 -0
- package/dist/index.cjs +326 -0
- package/dist/index.d.cts +269 -0
- package/dist/index.d.ts +269 -0
- package/dist/index.js +326 -0
- package/dist/interaction-CTQ5-kqe.d.cts +43 -0
- package/dist/interaction-CTQ5-kqe.d.ts +43 -0
- package/dist/interactions/index.cjs +13 -0
- package/dist/interactions/index.d.cts +140 -0
- package/dist/interactions/index.d.ts +140 -0
- package/dist/interactions/index.js +13 -0
- package/package.json +95 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
+
|
|
29
|
+
// src/constants/productTypes.ts
|
|
30
|
+
var productTypes = {
|
|
31
|
+
// content type
|
|
32
|
+
dapp: 1,
|
|
33
|
+
press: 2,
|
|
34
|
+
webshop: 3,
|
|
35
|
+
// feature type
|
|
36
|
+
referral: 30,
|
|
37
|
+
purchase: 31
|
|
38
|
+
};
|
|
39
|
+
var productTypesMask = Object.entries(
|
|
40
|
+
productTypes
|
|
41
|
+
).reduce(
|
|
42
|
+
(acc, [key, value]) => {
|
|
43
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/constants/interactionTypes.ts
|
|
50
|
+
var interactionTypes = {
|
|
51
|
+
press: {
|
|
52
|
+
openArticle: "0xc0a24ffb",
|
|
53
|
+
readArticle: "0xd5bd0fbe"
|
|
54
|
+
},
|
|
55
|
+
dapp: {
|
|
56
|
+
proofVerifiableStorageUpdate: "0x2ab2aeef",
|
|
57
|
+
callableVerifiableStorageUpdate: "0xa07da986"
|
|
58
|
+
},
|
|
59
|
+
webshop: {
|
|
60
|
+
open: "0xb311798f"
|
|
61
|
+
},
|
|
62
|
+
referral: {
|
|
63
|
+
referred: "0x010cc3b9",
|
|
64
|
+
createLink: "0xb2c0f17c"
|
|
65
|
+
},
|
|
66
|
+
purchase: {
|
|
67
|
+
started: "0xd87e90c3",
|
|
68
|
+
completed: "0x8403aeb4"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__publicField = __publicField; exports.productTypes = productTypes; exports.productTypesMask = productTypesMask; exports.interactionTypes = interactionTypes;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
+
|
|
29
|
+
// src/constants/productTypes.ts
|
|
30
|
+
var productTypes = {
|
|
31
|
+
// content type
|
|
32
|
+
dapp: 1,
|
|
33
|
+
press: 2,
|
|
34
|
+
webshop: 3,
|
|
35
|
+
// feature type
|
|
36
|
+
referral: 30,
|
|
37
|
+
purchase: 31
|
|
38
|
+
};
|
|
39
|
+
var productTypesMask = Object.entries(
|
|
40
|
+
productTypes
|
|
41
|
+
).reduce(
|
|
42
|
+
(acc, [key, value]) => {
|
|
43
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/constants/interactionTypes.ts
|
|
50
|
+
var interactionTypes = {
|
|
51
|
+
press: {
|
|
52
|
+
openArticle: "0xc0a24ffb",
|
|
53
|
+
readArticle: "0xd5bd0fbe"
|
|
54
|
+
},
|
|
55
|
+
dapp: {
|
|
56
|
+
proofVerifiableStorageUpdate: "0x2ab2aeef",
|
|
57
|
+
callableVerifiableStorageUpdate: "0xa07da986"
|
|
58
|
+
},
|
|
59
|
+
webshop: {
|
|
60
|
+
open: "0xb311798f"
|
|
61
|
+
},
|
|
62
|
+
referral: {
|
|
63
|
+
referred: "0x010cc3b9",
|
|
64
|
+
createLink: "0xb2c0f17c"
|
|
65
|
+
},
|
|
66
|
+
purchase: {
|
|
67
|
+
started: "0xd87e90c3",
|
|
68
|
+
completed: "0x8403aeb4"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
__commonJS,
|
|
74
|
+
__toESM,
|
|
75
|
+
__publicField,
|
|
76
|
+
productTypes,
|
|
77
|
+
productTypesMask,
|
|
78
|
+
interactionTypes
|
|
79
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkPR3T7O5Icjs = require('./chunk-PR3T7O5I.cjs');
|
|
5
|
+
|
|
6
|
+
// src/interactions/pressEncoder.ts
|
|
7
|
+
var _viem = require('viem');
|
|
8
|
+
var PressInteractionEncoder = {
|
|
9
|
+
/**
|
|
10
|
+
* Encode an open article interaction
|
|
11
|
+
* @param args
|
|
12
|
+
* @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
|
|
13
|
+
*/
|
|
14
|
+
openArticle({ articleId }) {
|
|
15
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
16
|
+
_chunkPR3T7O5Icjs.interactionTypes.press.openArticle,
|
|
17
|
+
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
18
|
+
]);
|
|
19
|
+
return {
|
|
20
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.press),
|
|
21
|
+
interactionData
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Encode a read article interaction
|
|
26
|
+
* @param args
|
|
27
|
+
* @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
|
|
28
|
+
*/
|
|
29
|
+
readArticle({ articleId }) {
|
|
30
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
31
|
+
_chunkPR3T7O5Icjs.interactionTypes.press.readArticle,
|
|
32
|
+
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
33
|
+
]);
|
|
34
|
+
return {
|
|
35
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.press),
|
|
36
|
+
interactionData
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/interactions/referralEncoder.ts
|
|
42
|
+
|
|
43
|
+
var ReferralInteractionEncoder = {
|
|
44
|
+
/**
|
|
45
|
+
* Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
|
|
46
|
+
*/
|
|
47
|
+
createLink() {
|
|
48
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
49
|
+
_chunkPR3T7O5Icjs.interactionTypes.referral.createLink,
|
|
50
|
+
"0x"
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.referral),
|
|
54
|
+
interactionData
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Encode a referred interaction
|
|
59
|
+
* @param args
|
|
60
|
+
* @param args.referrer - The Ethereum address of the user who made the referral
|
|
61
|
+
*/
|
|
62
|
+
referred({ referrer }) {
|
|
63
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
64
|
+
_chunkPR3T7O5Icjs.interactionTypes.referral.referred,
|
|
65
|
+
_viem.pad.call(void 0, referrer, { size: 32 })
|
|
66
|
+
]);
|
|
67
|
+
return {
|
|
68
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.referral),
|
|
69
|
+
interactionData
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/interactions/purchaseEncoder.ts
|
|
75
|
+
|
|
76
|
+
var PurchaseInteractionEncoder = {
|
|
77
|
+
/**
|
|
78
|
+
* Encode a start purchase interaction
|
|
79
|
+
* @param args
|
|
80
|
+
* @param args.purchaseId - The id of the purchase that is being started.
|
|
81
|
+
*/
|
|
82
|
+
startPurchase({ purchaseId }) {
|
|
83
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
84
|
+
_chunkPR3T7O5Icjs.interactionTypes.purchase.started,
|
|
85
|
+
_viem.pad.call(void 0, purchaseId, { size: 32 })
|
|
86
|
+
]);
|
|
87
|
+
return {
|
|
88
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.purchase),
|
|
89
|
+
interactionData
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Encode a complete purchase interaction
|
|
94
|
+
* @param args
|
|
95
|
+
* @param args.purchaseId - The id of the purchase that is being completed.
|
|
96
|
+
* @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
|
|
97
|
+
*/
|
|
98
|
+
completedPurchase({
|
|
99
|
+
purchaseId,
|
|
100
|
+
proof
|
|
101
|
+
}) {
|
|
102
|
+
const innerData = _viem.encodeAbiParameters.call(void 0,
|
|
103
|
+
[{ type: "uint256" }, { type: "bytes32[]" }],
|
|
104
|
+
[BigInt(purchaseId), proof]
|
|
105
|
+
);
|
|
106
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
107
|
+
_chunkPR3T7O5Icjs.interactionTypes.purchase.completed,
|
|
108
|
+
innerData
|
|
109
|
+
]);
|
|
110
|
+
return {
|
|
111
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.purchase),
|
|
112
|
+
interactionData
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/interactions/webshopEncoder.ts
|
|
118
|
+
|
|
119
|
+
var WebShopInteractionEncoder = {
|
|
120
|
+
/**
|
|
121
|
+
* Encode an open webshop interaction
|
|
122
|
+
*/
|
|
123
|
+
open() {
|
|
124
|
+
const interactionData = _viem.concatHex.call(void 0, [
|
|
125
|
+
_chunkPR3T7O5Icjs.interactionTypes.webshop.open,
|
|
126
|
+
"0x"
|
|
127
|
+
]);
|
|
128
|
+
return {
|
|
129
|
+
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.webshop),
|
|
130
|
+
interactionData
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
exports.PressInteractionEncoder = PressInteractionEncoder; exports.ReferralInteractionEncoder = ReferralInteractionEncoder; exports.PurchaseInteractionEncoder = PurchaseInteractionEncoder; exports.WebShopInteractionEncoder = WebShopInteractionEncoder;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interactionTypes,
|
|
3
|
+
productTypes
|
|
4
|
+
} from "./chunk-QZL2KCSB.js";
|
|
5
|
+
|
|
6
|
+
// src/interactions/pressEncoder.ts
|
|
7
|
+
import { concatHex, pad, toHex } from "viem";
|
|
8
|
+
var PressInteractionEncoder = {
|
|
9
|
+
/**
|
|
10
|
+
* Encode an open article interaction
|
|
11
|
+
* @param args
|
|
12
|
+
* @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
|
|
13
|
+
*/
|
|
14
|
+
openArticle({ articleId }) {
|
|
15
|
+
const interactionData = concatHex([
|
|
16
|
+
interactionTypes.press.openArticle,
|
|
17
|
+
pad(articleId, { size: 32 })
|
|
18
|
+
]);
|
|
19
|
+
return {
|
|
20
|
+
handlerTypeDenominator: toHex(productTypes.press),
|
|
21
|
+
interactionData
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Encode a read article interaction
|
|
26
|
+
* @param args
|
|
27
|
+
* @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
|
|
28
|
+
*/
|
|
29
|
+
readArticle({ articleId }) {
|
|
30
|
+
const interactionData = concatHex([
|
|
31
|
+
interactionTypes.press.readArticle,
|
|
32
|
+
pad(articleId, { size: 32 })
|
|
33
|
+
]);
|
|
34
|
+
return {
|
|
35
|
+
handlerTypeDenominator: toHex(productTypes.press),
|
|
36
|
+
interactionData
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/interactions/referralEncoder.ts
|
|
42
|
+
import { concatHex as concatHex2, pad as pad2, toHex as toHex2 } from "viem";
|
|
43
|
+
var ReferralInteractionEncoder = {
|
|
44
|
+
/**
|
|
45
|
+
* Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
|
|
46
|
+
*/
|
|
47
|
+
createLink() {
|
|
48
|
+
const interactionData = concatHex2([
|
|
49
|
+
interactionTypes.referral.createLink,
|
|
50
|
+
"0x"
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
54
|
+
interactionData
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Encode a referred interaction
|
|
59
|
+
* @param args
|
|
60
|
+
* @param args.referrer - The Ethereum address of the user who made the referral
|
|
61
|
+
*/
|
|
62
|
+
referred({ referrer }) {
|
|
63
|
+
const interactionData = concatHex2([
|
|
64
|
+
interactionTypes.referral.referred,
|
|
65
|
+
pad2(referrer, { size: 32 })
|
|
66
|
+
]);
|
|
67
|
+
return {
|
|
68
|
+
handlerTypeDenominator: toHex2(productTypes.referral),
|
|
69
|
+
interactionData
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/interactions/purchaseEncoder.ts
|
|
75
|
+
import { concatHex as concatHex3, encodeAbiParameters, pad as pad3, toHex as toHex3 } from "viem";
|
|
76
|
+
var PurchaseInteractionEncoder = {
|
|
77
|
+
/**
|
|
78
|
+
* Encode a start purchase interaction
|
|
79
|
+
* @param args
|
|
80
|
+
* @param args.purchaseId - The id of the purchase that is being started.
|
|
81
|
+
*/
|
|
82
|
+
startPurchase({ purchaseId }) {
|
|
83
|
+
const interactionData = concatHex3([
|
|
84
|
+
interactionTypes.purchase.started,
|
|
85
|
+
pad3(purchaseId, { size: 32 })
|
|
86
|
+
]);
|
|
87
|
+
return {
|
|
88
|
+
handlerTypeDenominator: toHex3(productTypes.purchase),
|
|
89
|
+
interactionData
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Encode a complete purchase interaction
|
|
94
|
+
* @param args
|
|
95
|
+
* @param args.purchaseId - The id of the purchase that is being completed.
|
|
96
|
+
* @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
|
|
97
|
+
*/
|
|
98
|
+
completedPurchase({
|
|
99
|
+
purchaseId,
|
|
100
|
+
proof
|
|
101
|
+
}) {
|
|
102
|
+
const innerData = encodeAbiParameters(
|
|
103
|
+
[{ type: "uint256" }, { type: "bytes32[]" }],
|
|
104
|
+
[BigInt(purchaseId), proof]
|
|
105
|
+
);
|
|
106
|
+
const interactionData = concatHex3([
|
|
107
|
+
interactionTypes.purchase.completed,
|
|
108
|
+
innerData
|
|
109
|
+
]);
|
|
110
|
+
return {
|
|
111
|
+
handlerTypeDenominator: toHex3(productTypes.purchase),
|
|
112
|
+
interactionData
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/interactions/webshopEncoder.ts
|
|
118
|
+
import { concatHex as concatHex4, toHex as toHex4 } from "viem";
|
|
119
|
+
var WebShopInteractionEncoder = {
|
|
120
|
+
/**
|
|
121
|
+
* Encode an open webshop interaction
|
|
122
|
+
*/
|
|
123
|
+
open() {
|
|
124
|
+
const interactionData = concatHex4([
|
|
125
|
+
interactionTypes.webshop.open,
|
|
126
|
+
"0x"
|
|
127
|
+
]);
|
|
128
|
+
return {
|
|
129
|
+
handlerTypeDenominator: toHex4(productTypes.webshop),
|
|
130
|
+
interactionData
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export {
|
|
136
|
+
PressInteractionEncoder,
|
|
137
|
+
ReferralInteractionEncoder,
|
|
138
|
+
PurchaseInteractionEncoder,
|
|
139
|
+
WebShopInteractionEncoder
|
|
140
|
+
};
|