@abbababa/sdk 0.1.0
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 +90 -0
- package/dist/buyer.d.ts +78 -0
- package/dist/buyer.d.ts.map +1 -0
- package/dist/buyer.js +146 -0
- package/dist/buyer.js.map +1 -0
- package/dist/checkout.d.ts +8 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +10 -0
- package/dist/checkout.js.map +1 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +103 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +43 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/register.d.ts +21 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +37 -0
- package/dist/register.js.map +1 -0
- package/dist/seller.d.ts +20 -0
- package/dist/seller.d.ts.map +1 -0
- package/dist/seller.js +62 -0
- package/dist/seller.js.map +1 -0
- package/dist/services.d.ts +14 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +39 -0
- package/dist/services.js.map +1 -0
- package/dist/transactions.d.ts +14 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +35 -0
- package/dist/transactions.js.map +1 -0
- package/dist/types.d.ts +276 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet/abi.d.ts +265 -0
- package/dist/wallet/abi.d.ts.map +1 -0
- package/dist/wallet/abi.js +181 -0
- package/dist/wallet/abi.js.map +1 -0
- package/dist/wallet/constants.d.ts +29 -0
- package/dist/wallet/constants.d.ts.map +1 -0
- package/dist/wallet/constants.js +81 -0
- package/dist/wallet/constants.js.map +1 -0
- package/dist/wallet/escrow.d.ts +45 -0
- package/dist/wallet/escrow.d.ts.map +1 -0
- package/dist/wallet/escrow.js +184 -0
- package/dist/wallet/escrow.js.map +1 -0
- package/dist/wallet/index.d.ts +6 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +17 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/session-keys.d.ts +58 -0
- package/dist/wallet/session-keys.d.ts.map +1 -0
- package/dist/wallet/session-keys.js +313 -0
- package/dist/wallet/session-keys.js.map +1 -0
- package/dist/wallet/smart-account.d.ts +30 -0
- package/dist/wallet/smart-account.d.ts.map +1 -0
- package/dist/wallet/smart-account.js +126 -0
- package/dist/wallet/smart-account.js.map +1 -0
- package/dist/webhook.d.ts +15 -0
- package/dist/webhook.d.ts.map +1 -0
- package/dist/webhook.js +62 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
export declare const SERVICE_ESCROW_V2_ABI: readonly [{
|
|
2
|
+
readonly name: "createEscrow";
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly stateMutability: "nonpayable";
|
|
5
|
+
readonly inputs: readonly [{
|
|
6
|
+
readonly name: "escrowId";
|
|
7
|
+
readonly type: "bytes32";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "seller";
|
|
10
|
+
readonly type: "address";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "amount";
|
|
13
|
+
readonly type: "uint256";
|
|
14
|
+
}];
|
|
15
|
+
readonly outputs: readonly [];
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "release";
|
|
18
|
+
readonly type: "function";
|
|
19
|
+
readonly stateMutability: "nonpayable";
|
|
20
|
+
readonly inputs: readonly [{
|
|
21
|
+
readonly name: "escrowId";
|
|
22
|
+
readonly type: "bytes32";
|
|
23
|
+
}];
|
|
24
|
+
readonly outputs: readonly [];
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "refund";
|
|
27
|
+
readonly type: "function";
|
|
28
|
+
readonly stateMutability: "nonpayable";
|
|
29
|
+
readonly inputs: readonly [{
|
|
30
|
+
readonly name: "escrowId";
|
|
31
|
+
readonly type: "bytes32";
|
|
32
|
+
}];
|
|
33
|
+
readonly outputs: readonly [];
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "getEscrow";
|
|
36
|
+
readonly type: "function";
|
|
37
|
+
readonly stateMutability: "view";
|
|
38
|
+
readonly inputs: readonly [{
|
|
39
|
+
readonly name: "escrowId";
|
|
40
|
+
readonly type: "bytes32";
|
|
41
|
+
}];
|
|
42
|
+
readonly outputs: readonly [{
|
|
43
|
+
readonly name: "buyer";
|
|
44
|
+
readonly type: "address";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "seller";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "amount";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "buyerFee";
|
|
53
|
+
readonly type: "uint256";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "status";
|
|
56
|
+
readonly type: "uint8";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "createdAt";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "expiresAt";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}];
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "isExpired";
|
|
66
|
+
readonly type: "function";
|
|
67
|
+
readonly stateMutability: "view";
|
|
68
|
+
readonly inputs: readonly [{
|
|
69
|
+
readonly name: "escrowId";
|
|
70
|
+
readonly type: "bytes32";
|
|
71
|
+
}];
|
|
72
|
+
readonly outputs: readonly [{
|
|
73
|
+
readonly name: "";
|
|
74
|
+
readonly type: "bool";
|
|
75
|
+
}];
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "usdc";
|
|
78
|
+
readonly type: "function";
|
|
79
|
+
readonly stateMutability: "view";
|
|
80
|
+
readonly inputs: readonly [];
|
|
81
|
+
readonly outputs: readonly [{
|
|
82
|
+
readonly name: "";
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
}];
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "BUYER_FEE_BPS";
|
|
87
|
+
readonly type: "function";
|
|
88
|
+
readonly stateMutability: "view";
|
|
89
|
+
readonly inputs: readonly [];
|
|
90
|
+
readonly outputs: readonly [{
|
|
91
|
+
readonly name: "";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}];
|
|
94
|
+
}];
|
|
95
|
+
export declare const SERVICE_ESCROW_V3_ABI: readonly [{
|
|
96
|
+
readonly name: "createEscrow";
|
|
97
|
+
readonly type: "function";
|
|
98
|
+
readonly stateMutability: "nonpayable";
|
|
99
|
+
readonly inputs: readonly [{
|
|
100
|
+
readonly name: "escrowId";
|
|
101
|
+
readonly type: "bytes32";
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "seller";
|
|
104
|
+
readonly type: "address";
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "amount";
|
|
107
|
+
readonly type: "uint256";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "token";
|
|
110
|
+
readonly type: "address";
|
|
111
|
+
}];
|
|
112
|
+
readonly outputs: readonly [];
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "release";
|
|
115
|
+
readonly type: "function";
|
|
116
|
+
readonly stateMutability: "nonpayable";
|
|
117
|
+
readonly inputs: readonly [{
|
|
118
|
+
readonly name: "escrowId";
|
|
119
|
+
readonly type: "bytes32";
|
|
120
|
+
}];
|
|
121
|
+
readonly outputs: readonly [];
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "refund";
|
|
124
|
+
readonly type: "function";
|
|
125
|
+
readonly stateMutability: "nonpayable";
|
|
126
|
+
readonly inputs: readonly [{
|
|
127
|
+
readonly name: "escrowId";
|
|
128
|
+
readonly type: "bytes32";
|
|
129
|
+
}];
|
|
130
|
+
readonly outputs: readonly [];
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "getEscrow";
|
|
133
|
+
readonly type: "function";
|
|
134
|
+
readonly stateMutability: "view";
|
|
135
|
+
readonly inputs: readonly [{
|
|
136
|
+
readonly name: "escrowId";
|
|
137
|
+
readonly type: "bytes32";
|
|
138
|
+
}];
|
|
139
|
+
readonly outputs: readonly [{
|
|
140
|
+
readonly name: "token";
|
|
141
|
+
readonly type: "address";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "buyer";
|
|
144
|
+
readonly type: "address";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "seller";
|
|
147
|
+
readonly type: "address";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "amount";
|
|
150
|
+
readonly type: "uint256";
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "buyerFee";
|
|
153
|
+
readonly type: "uint256";
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "status";
|
|
156
|
+
readonly type: "uint8";
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "createdAt";
|
|
159
|
+
readonly type: "uint256";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "expiresAt";
|
|
162
|
+
readonly type: "uint256";
|
|
163
|
+
}];
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "isExpired";
|
|
166
|
+
readonly type: "function";
|
|
167
|
+
readonly stateMutability: "view";
|
|
168
|
+
readonly inputs: readonly [{
|
|
169
|
+
readonly name: "escrowId";
|
|
170
|
+
readonly type: "bytes32";
|
|
171
|
+
}];
|
|
172
|
+
readonly outputs: readonly [{
|
|
173
|
+
readonly name: "";
|
|
174
|
+
readonly type: "bool";
|
|
175
|
+
}];
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "supportedTokens";
|
|
178
|
+
readonly type: "function";
|
|
179
|
+
readonly stateMutability: "view";
|
|
180
|
+
readonly inputs: readonly [{
|
|
181
|
+
readonly name: "token";
|
|
182
|
+
readonly type: "address";
|
|
183
|
+
}];
|
|
184
|
+
readonly outputs: readonly [{
|
|
185
|
+
readonly name: "";
|
|
186
|
+
readonly type: "bool";
|
|
187
|
+
}];
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "isTokenSupported";
|
|
190
|
+
readonly type: "function";
|
|
191
|
+
readonly stateMutability: "view";
|
|
192
|
+
readonly inputs: readonly [{
|
|
193
|
+
readonly name: "token";
|
|
194
|
+
readonly type: "address";
|
|
195
|
+
}];
|
|
196
|
+
readonly outputs: readonly [{
|
|
197
|
+
readonly name: "";
|
|
198
|
+
readonly type: "bool";
|
|
199
|
+
}];
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "BUYER_FEE_BPS";
|
|
202
|
+
readonly type: "function";
|
|
203
|
+
readonly stateMutability: "view";
|
|
204
|
+
readonly inputs: readonly [];
|
|
205
|
+
readonly outputs: readonly [{
|
|
206
|
+
readonly name: "";
|
|
207
|
+
readonly type: "uint256";
|
|
208
|
+
}];
|
|
209
|
+
}];
|
|
210
|
+
export declare const ERC20_ABI: readonly [{
|
|
211
|
+
readonly name: "approve";
|
|
212
|
+
readonly type: "function";
|
|
213
|
+
readonly stateMutability: "nonpayable";
|
|
214
|
+
readonly inputs: readonly [{
|
|
215
|
+
readonly name: "spender";
|
|
216
|
+
readonly type: "address";
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "amount";
|
|
219
|
+
readonly type: "uint256";
|
|
220
|
+
}];
|
|
221
|
+
readonly outputs: readonly [{
|
|
222
|
+
readonly name: "";
|
|
223
|
+
readonly type: "bool";
|
|
224
|
+
}];
|
|
225
|
+
}, {
|
|
226
|
+
readonly name: "balanceOf";
|
|
227
|
+
readonly type: "function";
|
|
228
|
+
readonly stateMutability: "view";
|
|
229
|
+
readonly inputs: readonly [{
|
|
230
|
+
readonly name: "account";
|
|
231
|
+
readonly type: "address";
|
|
232
|
+
}];
|
|
233
|
+
readonly outputs: readonly [{
|
|
234
|
+
readonly name: "";
|
|
235
|
+
readonly type: "uint256";
|
|
236
|
+
}];
|
|
237
|
+
}, {
|
|
238
|
+
readonly name: "allowance";
|
|
239
|
+
readonly type: "function";
|
|
240
|
+
readonly stateMutability: "view";
|
|
241
|
+
readonly inputs: readonly [{
|
|
242
|
+
readonly name: "owner";
|
|
243
|
+
readonly type: "address";
|
|
244
|
+
}, {
|
|
245
|
+
readonly name: "spender";
|
|
246
|
+
readonly type: "address";
|
|
247
|
+
}];
|
|
248
|
+
readonly outputs: readonly [{
|
|
249
|
+
readonly name: "";
|
|
250
|
+
readonly type: "uint256";
|
|
251
|
+
}];
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "mint";
|
|
254
|
+
readonly type: "function";
|
|
255
|
+
readonly stateMutability: "nonpayable";
|
|
256
|
+
readonly inputs: readonly [{
|
|
257
|
+
readonly name: "to";
|
|
258
|
+
readonly type: "address";
|
|
259
|
+
}, {
|
|
260
|
+
readonly name: "amount";
|
|
261
|
+
readonly type: "uint256";
|
|
262
|
+
}];
|
|
263
|
+
readonly outputs: readonly [];
|
|
264
|
+
}];
|
|
265
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../src/wallet/abi.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DxB,CAAA;AAIV,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuExB,CAAA;AAGV,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCZ,CAAA"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// ServiceEscrowV2 ABI - minimal interface for SDK operations
|
|
2
|
+
// Source: contracts/contracts/ServiceEscrowV2.sol
|
|
3
|
+
export const SERVICE_ESCROW_V2_ABI = [
|
|
4
|
+
{
|
|
5
|
+
name: 'createEscrow',
|
|
6
|
+
type: 'function',
|
|
7
|
+
stateMutability: 'nonpayable',
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'escrowId', type: 'bytes32' },
|
|
10
|
+
{ name: 'seller', type: 'address' },
|
|
11
|
+
{ name: 'amount', type: 'uint256' },
|
|
12
|
+
],
|
|
13
|
+
outputs: [],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'release',
|
|
17
|
+
type: 'function',
|
|
18
|
+
stateMutability: 'nonpayable',
|
|
19
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
20
|
+
outputs: [],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'refund',
|
|
24
|
+
type: 'function',
|
|
25
|
+
stateMutability: 'nonpayable',
|
|
26
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
27
|
+
outputs: [],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'getEscrow',
|
|
31
|
+
type: 'function',
|
|
32
|
+
stateMutability: 'view',
|
|
33
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
34
|
+
outputs: [
|
|
35
|
+
{ name: 'buyer', type: 'address' },
|
|
36
|
+
{ name: 'seller', type: 'address' },
|
|
37
|
+
{ name: 'amount', type: 'uint256' },
|
|
38
|
+
{ name: 'buyerFee', type: 'uint256' },
|
|
39
|
+
{ name: 'status', type: 'uint8' },
|
|
40
|
+
{ name: 'createdAt', type: 'uint256' },
|
|
41
|
+
{ name: 'expiresAt', type: 'uint256' },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'isExpired',
|
|
46
|
+
type: 'function',
|
|
47
|
+
stateMutability: 'view',
|
|
48
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
49
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'usdc',
|
|
53
|
+
type: 'function',
|
|
54
|
+
stateMutability: 'view',
|
|
55
|
+
inputs: [],
|
|
56
|
+
outputs: [{ name: '', type: 'address' }],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'BUYER_FEE_BPS',
|
|
60
|
+
type: 'function',
|
|
61
|
+
stateMutability: 'view',
|
|
62
|
+
inputs: [],
|
|
63
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
// ServiceEscrowV3 ABI - multi-token escrow
|
|
67
|
+
// Source: contracts/contracts/ServiceEscrowV3.sol
|
|
68
|
+
export const SERVICE_ESCROW_V3_ABI = [
|
|
69
|
+
{
|
|
70
|
+
name: 'createEscrow',
|
|
71
|
+
type: 'function',
|
|
72
|
+
stateMutability: 'nonpayable',
|
|
73
|
+
inputs: [
|
|
74
|
+
{ name: 'escrowId', type: 'bytes32' },
|
|
75
|
+
{ name: 'seller', type: 'address' },
|
|
76
|
+
{ name: 'amount', type: 'uint256' },
|
|
77
|
+
{ name: 'token', type: 'address' },
|
|
78
|
+
],
|
|
79
|
+
outputs: [],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'release',
|
|
83
|
+
type: 'function',
|
|
84
|
+
stateMutability: 'nonpayable',
|
|
85
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
86
|
+
outputs: [],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'refund',
|
|
90
|
+
type: 'function',
|
|
91
|
+
stateMutability: 'nonpayable',
|
|
92
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
93
|
+
outputs: [],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'getEscrow',
|
|
97
|
+
type: 'function',
|
|
98
|
+
stateMutability: 'view',
|
|
99
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
100
|
+
outputs: [
|
|
101
|
+
{ name: 'token', type: 'address' },
|
|
102
|
+
{ name: 'buyer', type: 'address' },
|
|
103
|
+
{ name: 'seller', type: 'address' },
|
|
104
|
+
{ name: 'amount', type: 'uint256' },
|
|
105
|
+
{ name: 'buyerFee', type: 'uint256' },
|
|
106
|
+
{ name: 'status', type: 'uint8' },
|
|
107
|
+
{ name: 'createdAt', type: 'uint256' },
|
|
108
|
+
{ name: 'expiresAt', type: 'uint256' },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'isExpired',
|
|
113
|
+
type: 'function',
|
|
114
|
+
stateMutability: 'view',
|
|
115
|
+
inputs: [{ name: 'escrowId', type: 'bytes32' }],
|
|
116
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'supportedTokens',
|
|
120
|
+
type: 'function',
|
|
121
|
+
stateMutability: 'view',
|
|
122
|
+
inputs: [{ name: 'token', type: 'address' }],
|
|
123
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'isTokenSupported',
|
|
127
|
+
type: 'function',
|
|
128
|
+
stateMutability: 'view',
|
|
129
|
+
inputs: [{ name: 'token', type: 'address' }],
|
|
130
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'BUYER_FEE_BPS',
|
|
134
|
+
type: 'function',
|
|
135
|
+
stateMutability: 'view',
|
|
136
|
+
inputs: [],
|
|
137
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
// Standard ERC20 ABI - approve and balanceOf
|
|
141
|
+
export const ERC20_ABI = [
|
|
142
|
+
{
|
|
143
|
+
name: 'approve',
|
|
144
|
+
type: 'function',
|
|
145
|
+
stateMutability: 'nonpayable',
|
|
146
|
+
inputs: [
|
|
147
|
+
{ name: 'spender', type: 'address' },
|
|
148
|
+
{ name: 'amount', type: 'uint256' },
|
|
149
|
+
],
|
|
150
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'balanceOf',
|
|
154
|
+
type: 'function',
|
|
155
|
+
stateMutability: 'view',
|
|
156
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
157
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'allowance',
|
|
161
|
+
type: 'function',
|
|
162
|
+
stateMutability: 'view',
|
|
163
|
+
inputs: [
|
|
164
|
+
{ name: 'owner', type: 'address' },
|
|
165
|
+
{ name: 'spender', type: 'address' },
|
|
166
|
+
],
|
|
167
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
168
|
+
},
|
|
169
|
+
// MockERC20 mint — available on testnet only
|
|
170
|
+
{
|
|
171
|
+
name: 'mint',
|
|
172
|
+
type: 'function',
|
|
173
|
+
stateMutability: 'nonpayable',
|
|
174
|
+
inputs: [
|
|
175
|
+
{ name: 'to', type: 'address' },
|
|
176
|
+
{ name: 'amount', type: 'uint256' },
|
|
177
|
+
],
|
|
178
|
+
outputs: [],
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
//# sourceMappingURL=abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../../src/wallet/abi.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;QACE,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,E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,MAAM;QACvB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACzC;IACD,6CAA6C;IAC7C;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YAC/B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;SACpC;QACD,OAAO,EAAE,EAAE;KACZ;CACO,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const POLYGON_AMOY_CHAIN_ID = 80002;
|
|
2
|
+
export declare const POLYGON_MAINNET_CHAIN_ID = 137;
|
|
3
|
+
export declare const BASE_SEPOLIA_CHAIN_ID = 84532;
|
|
4
|
+
export declare const BASE_MAINNET_CHAIN_ID = 8453;
|
|
5
|
+
/** ServiceEscrowV2 — single-token (USDC only). Legacy, kept for in-flight escrows. */
|
|
6
|
+
export declare const ESCROW_V2_ADDRESSES: Record<number, string>;
|
|
7
|
+
/** ServiceEscrowV3 — multi-token escrow with per-escrow token selection. */
|
|
8
|
+
export declare const ESCROW_ADDRESSES: Record<number, string>;
|
|
9
|
+
export interface TokenInfo {
|
|
10
|
+
symbol: string;
|
|
11
|
+
address: string;
|
|
12
|
+
decimals: number;
|
|
13
|
+
tier: 1 | 2 | 3;
|
|
14
|
+
}
|
|
15
|
+
export declare const TOKEN_REGISTRY: Record<number, Record<string, TokenInfo>>;
|
|
16
|
+
/** Look up a token by chain and symbol. */
|
|
17
|
+
export declare function getToken(chainId: number, symbol: string): TokenInfo | undefined;
|
|
18
|
+
/** Get all tokens for a chain filtered by tier. */
|
|
19
|
+
export declare function getTokensByTier(chainId: number, tier: 1 | 2 | 3): TokenInfo[];
|
|
20
|
+
/** Check if a token symbol is supported on a given chain. */
|
|
21
|
+
export declare function isTokenSupported(chainId: number, symbol: string): boolean;
|
|
22
|
+
/** @deprecated Use TOKEN_REGISTRY instead. */
|
|
23
|
+
export declare const USDC_ADDRESSES: Record<number, string>;
|
|
24
|
+
/** @deprecated Use getToken(chainId, symbol).decimals instead. */
|
|
25
|
+
export declare const USDC_DECIMALS = 6;
|
|
26
|
+
export declare const MIN_GAS_BALANCE = 10000000000000000n;
|
|
27
|
+
export declare const ZERODEV_BUNDLER_URL = "https://rpc.zerodev.app/api/v3/bundler";
|
|
28
|
+
export declare const ZERODEV_PAYMASTER_URL = "https://rpc.zerodev.app/api/v3/paymaster";
|
|
29
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/wallet/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAC1C,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAC3C,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAC1C,eAAO,MAAM,qBAAqB,OAAO,CAAA;AAMzC,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEtD,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGnD,CAAA;AAMD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAChB;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CA2BpE,CAAA;AAED,2CAA2C;AAC3C,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE/E;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,EAAE,CAI7E;AAED,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzE;AAMD,8CAA8C;AAC9C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKjD,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,aAAa,IAAI,CAAA;AAS9B,eAAO,MAAM,eAAe,qBAA0B,CAAA;AAEtD,eAAO,MAAM,mBAAmB,2CAA2C,CAAA;AAC3E,eAAO,MAAM,qBAAqB,6CAA6C,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const POLYGON_AMOY_CHAIN_ID = 80002;
|
|
2
|
+
export const POLYGON_MAINNET_CHAIN_ID = 137;
|
|
3
|
+
export const BASE_SEPOLIA_CHAIN_ID = 84532;
|
|
4
|
+
export const BASE_MAINNET_CHAIN_ID = 8453;
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Escrow Contract Addresses
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/** ServiceEscrowV2 — single-token (USDC only). Legacy, kept for in-flight escrows. */
|
|
9
|
+
export const ESCROW_V2_ADDRESSES = {
|
|
10
|
+
[POLYGON_AMOY_CHAIN_ID]: '0x8a05DeB083A708Fd7ea3ACCfd375a58008855655',
|
|
11
|
+
};
|
|
12
|
+
/** ServiceEscrowV3 — multi-token escrow with per-escrow token selection. */
|
|
13
|
+
export const ESCROW_ADDRESSES = {
|
|
14
|
+
[POLYGON_AMOY_CHAIN_ID]: '0xAA74588b47a93ED00d6f14FE5B29b80c305EDc9f',
|
|
15
|
+
[BASE_SEPOLIA_CHAIN_ID]: '0xdef9512f8093984C66439DAB1f1126a046918583',
|
|
16
|
+
};
|
|
17
|
+
export const TOKEN_REGISTRY = {
|
|
18
|
+
[POLYGON_AMOY_CHAIN_ID]: {
|
|
19
|
+
// Tier 1 — Phase 1 (must-have)
|
|
20
|
+
USDC: { symbol: 'USDC', address: '0x9DCE328784A6B24fbe84eC05e9Ea3C6Cce782529', decimals: 6, tier: 1 },
|
|
21
|
+
// WPOL, USDT, DAI addresses on Amoy TBD (deploy MockERC20 instances or use testnet faucets)
|
|
22
|
+
},
|
|
23
|
+
[POLYGON_MAINNET_CHAIN_ID]: {
|
|
24
|
+
// Tier 1 — Phase 1
|
|
25
|
+
USDC: { symbol: 'USDC', address: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', decimals: 6, tier: 1 },
|
|
26
|
+
WPOL: { symbol: 'WPOL', address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', decimals: 18, tier: 1 },
|
|
27
|
+
USDT: { symbol: 'USDT', address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', decimals: 6, tier: 1 },
|
|
28
|
+
DAI: { symbol: 'DAI', address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', decimals: 18, tier: 1 },
|
|
29
|
+
// Tier 2 — Phase 2 (high value)
|
|
30
|
+
AAVE: { symbol: 'AAVE', address: '0xD6DF932A45C0f255f85145f286eA0b292B21C90B', decimals: 18, tier: 2 },
|
|
31
|
+
WETH: { symbol: 'WETH', address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', decimals: 18, tier: 2 },
|
|
32
|
+
UNI: { symbol: 'UNI', address: '0xb33EaAd8d922B1083446DC23f610c2567fB5180f', decimals: 18, tier: 2 },
|
|
33
|
+
// Tier 3 — Future (ecosystem)
|
|
34
|
+
WBTC: { symbol: 'WBTC', address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', decimals: 8, tier: 3 },
|
|
35
|
+
},
|
|
36
|
+
[BASE_SEPOLIA_CHAIN_ID]: {
|
|
37
|
+
// Official Circle USDC on Base Sepolia
|
|
38
|
+
USDC: { symbol: 'USDC', address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', decimals: 6, tier: 1 },
|
|
39
|
+
},
|
|
40
|
+
[BASE_MAINNET_CHAIN_ID]: {
|
|
41
|
+
// Official Circle USDC on Base
|
|
42
|
+
USDC: { symbol: 'USDC', address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', decimals: 6, tier: 1 },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
/** Look up a token by chain and symbol. */
|
|
46
|
+
export function getToken(chainId, symbol) {
|
|
47
|
+
return TOKEN_REGISTRY[chainId]?.[symbol];
|
|
48
|
+
}
|
|
49
|
+
/** Get all tokens for a chain filtered by tier. */
|
|
50
|
+
export function getTokensByTier(chainId, tier) {
|
|
51
|
+
const tokens = TOKEN_REGISTRY[chainId];
|
|
52
|
+
if (!tokens)
|
|
53
|
+
return [];
|
|
54
|
+
return Object.values(tokens).filter(t => t.tier <= tier);
|
|
55
|
+
}
|
|
56
|
+
/** Check if a token symbol is supported on a given chain. */
|
|
57
|
+
export function isTokenSupported(chainId, symbol) {
|
|
58
|
+
return TOKEN_REGISTRY[chainId]?.[symbol] !== undefined;
|
|
59
|
+
}
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Legacy Compat — keep USDC_ADDRESSES for existing code that references it
|
|
62
|
+
// ============================================================================
|
|
63
|
+
/** @deprecated Use TOKEN_REGISTRY instead. */
|
|
64
|
+
export const USDC_ADDRESSES = {
|
|
65
|
+
[POLYGON_AMOY_CHAIN_ID]: '0x9DCE328784A6B24fbe84eC05e9Ea3C6Cce782529',
|
|
66
|
+
[POLYGON_MAINNET_CHAIN_ID]: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
|
|
67
|
+
[BASE_SEPOLIA_CHAIN_ID]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
68
|
+
[BASE_MAINNET_CHAIN_ID]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
69
|
+
};
|
|
70
|
+
/** @deprecated Use getToken(chainId, symbol).decimals instead. */
|
|
71
|
+
export const USDC_DECIMALS = 6;
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// Gas & Infrastructure
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// Minimum native token (POL) balance for self-funded gas.
|
|
76
|
+
// If balance is below this, 'auto' strategy falls back to ERC-20 paymaster.
|
|
77
|
+
// 0.01 POL in wei — enough for ~1-10 UserOperations on Polygon.
|
|
78
|
+
export const MIN_GAS_BALANCE = 10000000000000000n;
|
|
79
|
+
export const ZERODEV_BUNDLER_URL = 'https://rpc.zerodev.app/api/v3/bundler';
|
|
80
|
+
export const ZERODEV_PAYMASTER_URL = 'https://rpc.zerodev.app/api/v3/paymaster';
|
|
81
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/wallet/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAEzC,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,sFAAsF;AACtF,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,CAAC,qBAAqB,CAAC,EAAE,4CAA4C;CACtE,CAAA;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,CAAC,qBAAqB,CAAC,EAAE,4CAA4C;IACrE,CAAC,qBAAqB,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BAAwB,CAAC,EAAE,4CAA4C;IACxE,CAAC,qBAAqB,CAAC,EAAE,4CAA4C;IACrE,CAAC,qBAAqB,CAAC,EAAE,4CAA4C;CACtE,CAAA;AAED,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAA;AAE9B,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,0DAA0D;AAC1D,4EAA4E;AAC5E,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAuB,CAAA;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,wCAAwC,CAAA;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,0CAA0C,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type TokenInfo } from './constants.js';
|
|
2
|
+
import type { EscrowDetails } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Client for interacting with the ServiceEscrow smart contracts.
|
|
5
|
+
* Supports V3 (multi-token) with automatic fallback to V2 (USDC only).
|
|
6
|
+
* Uses a ZeroDev Kernel account client for sending UserOperations.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EscrowClient {
|
|
9
|
+
private kernelClient;
|
|
10
|
+
private chainId;
|
|
11
|
+
private escrowAddress;
|
|
12
|
+
private escrowVersion;
|
|
13
|
+
private tokenAddress;
|
|
14
|
+
private tokenDecimals;
|
|
15
|
+
constructor(kernelClient: unknown, token?: TokenInfo, chainId?: number);
|
|
16
|
+
/**
|
|
17
|
+
* Convert a platform transaction ID (CUID string) to a bytes32 escrow ID.
|
|
18
|
+
* Uses keccak256, matching the existing backend pattern in escrow.ts (ethers.id).
|
|
19
|
+
*/
|
|
20
|
+
static toEscrowId(transactionId: string): `0x${string}`;
|
|
21
|
+
/**
|
|
22
|
+
* Approve the escrow contract to spend the settlement token on behalf of the smart account.
|
|
23
|
+
* Must be called before fundEscrow.
|
|
24
|
+
*/
|
|
25
|
+
approveToken(amount: bigint): Promise<string>;
|
|
26
|
+
/** @deprecated Use approveToken() instead. */
|
|
27
|
+
approveUSDC(amount: bigint): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Fund an escrow. Calls createEscrow on the escrow contract.
|
|
30
|
+
* V3: passes token address as 4th argument.
|
|
31
|
+
* V2 fallback: USDC only (3 arguments).
|
|
32
|
+
* The contract will safeTransferFrom the token (amount + 1% buyer fee) from the caller.
|
|
33
|
+
*/
|
|
34
|
+
fundEscrow(transactionId: string, sellerAddress: string, amount: bigint): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Release escrow funds to the seller.
|
|
37
|
+
* Callable by the buyer or an arbitrator.
|
|
38
|
+
*/
|
|
39
|
+
releaseEscrow(transactionId: string): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Read escrow details from the contract (view function, no gas needed).
|
|
42
|
+
*/
|
|
43
|
+
getEscrow(transactionId: string): Promise<EscrowDetails | null>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=escrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../../src/wallet/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAShD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAO;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAQ;gBAEjB,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,SAAwB;IA6BrF;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE;IAIvD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBnD,8CAA8C;IACxC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD;;;;;OAKG;IACG,UAAU,CACd,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IA0BlB;;;OAGG;IACG,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkB3D;;OAEG;IACG,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;CA+DtE"}
|