@imtbl/sdk 0.13.0 → 0.13.1-alpha

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/erc20.js ADDED
@@ -0,0 +1,371 @@
1
+ import { ContractFactory, utils, Contract } from 'ethers';
2
+
3
+ /* Autogenerated file. Do not edit manually. */
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ const _abi$5 = [
7
+ {
8
+ inputs: [
9
+ {
10
+ internalType: "string",
11
+ name: "name_",
12
+ type: "string",
13
+ },
14
+ {
15
+ internalType: "string",
16
+ name: "symbol_",
17
+ type: "string",
18
+ },
19
+ ],
20
+ stateMutability: "nonpayable",
21
+ type: "constructor",
22
+ },
23
+ {
24
+ anonymous: false,
25
+ inputs: [
26
+ {
27
+ indexed: true,
28
+ internalType: "address",
29
+ name: "owner",
30
+ type: "address",
31
+ },
32
+ {
33
+ indexed: true,
34
+ internalType: "address",
35
+ name: "spender",
36
+ type: "address",
37
+ },
38
+ {
39
+ indexed: false,
40
+ internalType: "uint256",
41
+ name: "value",
42
+ type: "uint256",
43
+ },
44
+ ],
45
+ name: "Approval",
46
+ type: "event",
47
+ },
48
+ {
49
+ anonymous: false,
50
+ inputs: [
51
+ {
52
+ indexed: true,
53
+ internalType: "address",
54
+ name: "from",
55
+ type: "address",
56
+ },
57
+ {
58
+ indexed: true,
59
+ internalType: "address",
60
+ name: "to",
61
+ type: "address",
62
+ },
63
+ {
64
+ indexed: false,
65
+ internalType: "uint256",
66
+ name: "value",
67
+ type: "uint256",
68
+ },
69
+ ],
70
+ name: "Transfer",
71
+ type: "event",
72
+ },
73
+ {
74
+ inputs: [
75
+ {
76
+ internalType: "address",
77
+ name: "owner",
78
+ type: "address",
79
+ },
80
+ {
81
+ internalType: "address",
82
+ name: "spender",
83
+ type: "address",
84
+ },
85
+ ],
86
+ name: "allowance",
87
+ outputs: [
88
+ {
89
+ internalType: "uint256",
90
+ name: "",
91
+ type: "uint256",
92
+ },
93
+ ],
94
+ stateMutability: "view",
95
+ type: "function",
96
+ },
97
+ {
98
+ inputs: [
99
+ {
100
+ internalType: "address",
101
+ name: "spender",
102
+ type: "address",
103
+ },
104
+ {
105
+ internalType: "uint256",
106
+ name: "amount",
107
+ type: "uint256",
108
+ },
109
+ ],
110
+ name: "approve",
111
+ outputs: [
112
+ {
113
+ internalType: "bool",
114
+ name: "",
115
+ type: "bool",
116
+ },
117
+ ],
118
+ stateMutability: "nonpayable",
119
+ type: "function",
120
+ },
121
+ {
122
+ inputs: [
123
+ {
124
+ internalType: "address",
125
+ name: "account",
126
+ type: "address",
127
+ },
128
+ ],
129
+ name: "balanceOf",
130
+ outputs: [
131
+ {
132
+ internalType: "uint256",
133
+ name: "",
134
+ type: "uint256",
135
+ },
136
+ ],
137
+ stateMutability: "view",
138
+ type: "function",
139
+ },
140
+ {
141
+ inputs: [],
142
+ name: "decimals",
143
+ outputs: [
144
+ {
145
+ internalType: "uint8",
146
+ name: "",
147
+ type: "uint8",
148
+ },
149
+ ],
150
+ stateMutability: "view",
151
+ type: "function",
152
+ },
153
+ {
154
+ inputs: [
155
+ {
156
+ internalType: "address",
157
+ name: "spender",
158
+ type: "address",
159
+ },
160
+ {
161
+ internalType: "uint256",
162
+ name: "subtractedValue",
163
+ type: "uint256",
164
+ },
165
+ ],
166
+ name: "decreaseAllowance",
167
+ outputs: [
168
+ {
169
+ internalType: "bool",
170
+ name: "",
171
+ type: "bool",
172
+ },
173
+ ],
174
+ stateMutability: "nonpayable",
175
+ type: "function",
176
+ },
177
+ {
178
+ inputs: [
179
+ {
180
+ internalType: "address",
181
+ name: "spender",
182
+ type: "address",
183
+ },
184
+ {
185
+ internalType: "uint256",
186
+ name: "addedValue",
187
+ type: "uint256",
188
+ },
189
+ ],
190
+ name: "increaseAllowance",
191
+ outputs: [
192
+ {
193
+ internalType: "bool",
194
+ name: "",
195
+ type: "bool",
196
+ },
197
+ ],
198
+ stateMutability: "nonpayable",
199
+ type: "function",
200
+ },
201
+ {
202
+ inputs: [],
203
+ name: "name",
204
+ outputs: [
205
+ {
206
+ internalType: "string",
207
+ name: "",
208
+ type: "string",
209
+ },
210
+ ],
211
+ stateMutability: "view",
212
+ type: "function",
213
+ },
214
+ {
215
+ inputs: [],
216
+ name: "symbol",
217
+ outputs: [
218
+ {
219
+ internalType: "string",
220
+ name: "",
221
+ type: "string",
222
+ },
223
+ ],
224
+ stateMutability: "view",
225
+ type: "function",
226
+ },
227
+ {
228
+ inputs: [],
229
+ name: "totalSupply",
230
+ outputs: [
231
+ {
232
+ internalType: "uint256",
233
+ name: "",
234
+ type: "uint256",
235
+ },
236
+ ],
237
+ stateMutability: "view",
238
+ type: "function",
239
+ },
240
+ {
241
+ inputs: [
242
+ {
243
+ internalType: "address",
244
+ name: "to",
245
+ type: "address",
246
+ },
247
+ {
248
+ internalType: "uint256",
249
+ name: "amount",
250
+ type: "uint256",
251
+ },
252
+ ],
253
+ name: "transfer",
254
+ outputs: [
255
+ {
256
+ internalType: "bool",
257
+ name: "",
258
+ type: "bool",
259
+ },
260
+ ],
261
+ stateMutability: "nonpayable",
262
+ type: "function",
263
+ },
264
+ {
265
+ inputs: [
266
+ {
267
+ internalType: "address",
268
+ name: "from",
269
+ type: "address",
270
+ },
271
+ {
272
+ internalType: "address",
273
+ name: "to",
274
+ type: "address",
275
+ },
276
+ {
277
+ internalType: "uint256",
278
+ name: "amount",
279
+ type: "uint256",
280
+ },
281
+ ],
282
+ name: "transferFrom",
283
+ outputs: [
284
+ {
285
+ internalType: "bool",
286
+ name: "",
287
+ type: "bool",
288
+ },
289
+ ],
290
+ stateMutability: "nonpayable",
291
+ type: "function",
292
+ },
293
+ ];
294
+ const _bytecode$3 = "0x60806040523480156200001157600080fd5b50604051620017ec380380620017ec8339818101604052810190620000379190620001f6565b8160039081620000489190620004c6565b5080600490816200005a9190620004c6565b505050620005ad565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620000cc8262000081565b810181811067ffffffffffffffff82111715620000ee57620000ed62000092565b5b80604052505050565b60006200010362000063565b9050620001118282620000c1565b919050565b600067ffffffffffffffff82111562000134576200013362000092565b5b6200013f8262000081565b9050602081019050919050565b60005b838110156200016c5780820151818401526020810190506200014f565b60008484015250505050565b60006200018f620001898462000116565b620000f7565b905082815260208101848484011115620001ae57620001ad6200007c565b5b620001bb8482856200014c565b509392505050565b600082601f830112620001db57620001da62000077565b5b8151620001ed84826020860162000178565b91505092915050565b6000806040838503121562000210576200020f6200006d565b5b600083015167ffffffffffffffff81111562000231576200023062000072565b5b6200023f85828601620001c3565b925050602083015167ffffffffffffffff81111562000263576200026262000072565b5b6200027185828601620001c3565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002ce57607f821691505b602082108103620002e457620002e362000286565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026200034e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200030f565b6200035a86836200030f565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003a7620003a16200039b8462000372565b6200037c565b62000372565b9050919050565b6000819050919050565b620003c38362000386565b620003db620003d282620003ae565b8484546200031c565b825550505050565b600090565b620003f2620003e3565b620003ff818484620003b8565b505050565b5b8181101562000427576200041b600082620003e8565b60018101905062000405565b5050565b601f82111562000476576200044081620002ea565b6200044b84620002ff565b810160208510156200045b578190505b620004736200046a85620002ff565b83018262000404565b50505b505050565b600082821c905092915050565b60006200049b600019846008026200047b565b1980831691505092915050565b6000620004b6838362000488565b9150826002028217905092915050565b620004d1826200027b565b67ffffffffffffffff811115620004ed57620004ec62000092565b5b620004f98254620002b5565b620005068282856200042b565b600060209050601f8311600181146200053e576000841562000529578287015190505b620005358582620004a8565b865550620005a5565b601f1984166200054e86620002ea565b60005b82811015620005785784890151825560018201915060208501945060208101905062000551565b8683101562000598578489015162000594601f89168262000488565b8355505b6001600288020188555050505b505050505050565b61122f80620005bd6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea26469706673582212204188b273199f085e1921ec1a1fa55abdee2e425960bda675a51fac85acd9972064736f6c63430008110033";
295
+ const isSuperArgs$3 = (xs) => xs.length > 1;
296
+ class ERC20__factory extends ContractFactory {
297
+ constructor(...args) {
298
+ if (isSuperArgs$3(args)) {
299
+ super(...args);
300
+ }
301
+ else {
302
+ super(_abi$5, _bytecode$3, args[0]);
303
+ }
304
+ }
305
+ deploy(name_, symbol_, overrides) {
306
+ return super.deploy(name_, symbol_, overrides || {});
307
+ }
308
+ getDeployTransaction(name_, symbol_, overrides) {
309
+ return super.getDeployTransaction(name_, symbol_, overrides || {});
310
+ }
311
+ attach(address) {
312
+ return super.attach(address);
313
+ }
314
+ connect(signer) {
315
+ return super.connect(signer);
316
+ }
317
+ static bytecode = _bytecode$3;
318
+ static abi = _abi$5;
319
+ static createInterface() {
320
+ return new utils.Interface(_abi$5);
321
+ }
322
+ static connect(address, signerOrProvider) {
323
+ return new Contract(address, _abi$5, signerOrProvider);
324
+ }
325
+ }
326
+
327
+ class ERC20 {
328
+ contract;
329
+ constructor(contractAddress) {
330
+ const factory = new ERC20__factory();
331
+ this.contract = factory.attach(contractAddress);
332
+ }
333
+ /**
334
+ * @returns a promise that resolves with a BigNumber that represents the amount of tokens in existence
335
+ */
336
+ async totalSupply(provider, overrides = {}) {
337
+ return this.contract.connect(provider).totalSupply(overrides);
338
+ }
339
+ /**
340
+ * @returns a promise that resolves with a BigNumber that represents the amount of tokens owned by account
341
+ */
342
+ async balanceOf(provider, account, overrides = {}) {
343
+ return this.contract.connect(provider).balanceOf(account, overrides);
344
+ }
345
+ /**
346
+ * @returns a promise that resolves with a BigNumber that represents the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom
347
+ */
348
+ async allowance(provider, owner, spender, overrides = {}) {
349
+ return this.contract.connect(provider).allowance(owner, spender, overrides);
350
+ }
351
+ /**
352
+ * @returns a promise that resolves with a populated transaction
353
+ */
354
+ async populateTransfer(to, amount, overrides) {
355
+ return this.contract.populateTransaction.transfer(to, amount, overrides);
356
+ }
357
+ /**
358
+ * @returns a promise that resolves with a populated transaction
359
+ */
360
+ async populateApprove(spender, amount, overrides = {}) {
361
+ return this.contract.populateTransaction.approve(spender, amount, overrides);
362
+ }
363
+ /**
364
+ * @returns a promise that resolves with a populated transaction
365
+ */
366
+ async populateTransferFrom(from, to, amount, overrides = {}) {
367
+ return this.contract.populateTransaction.transferFrom(from, to, amount, overrides);
368
+ }
369
+ }
370
+
371
+ export { ERC20 };