@frak-labs/core-sdk 0.0.2 → 0.0.5

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.
@@ -1,140 +0,0 @@
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;