@kiwarilabs/chidori-sdk 1.0.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/dist/blockchain/chidori-provider.d.ts +15 -0
- package/dist/blockchain/chidori.d.ts +8 -0
- package/dist/blockchain/erc7818-namespace.d.ts +102 -0
- package/dist/cjs/blockchain/chidori-provider.d.ts +15 -0
- package/dist/cjs/blockchain/chidori.d.ts +8 -0
- package/dist/cjs/blockchain/erc7818-namespace.d.ts +102 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +614 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internal/erc7818.d.ts +12 -0
- package/dist/cjs/test/unit/erc7818Expirable.test.d.ts +1 -0
- package/dist/cjs/types/ethers-types.d.ts +2 -0
- package/dist/cjs/types/types.d.ts +55 -0
- package/dist/es/blockchain/chidori-provider.d.ts +15 -0
- package/dist/es/blockchain/chidori.d.ts +8 -0
- package/dist/es/blockchain/erc7818-namespace.d.ts +102 -0
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +610 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/internal/erc7818.d.ts +12 -0
- package/dist/es/test/unit/erc7818Expirable.test.d.ts +1 -0
- package/dist/es/types/ethers-types.d.ts +2 -0
- package/dist/es/types/types.d.ts +55 -0
- package/dist/esm/blockchain/chidori-provider.d.ts +15 -0
- package/dist/esm/blockchain/chidori.d.ts +8 -0
- package/dist/esm/blockchain/erc7818-namespace.d.ts +102 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +610 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/erc7818.d.ts +12 -0
- package/dist/esm/test/unit/erc7818Expirable.test.d.ts +1 -0
- package/dist/esm/types/ethers-types.d.ts +2 -0
- package/dist/esm/types/types.d.ts +55 -0
- package/dist/index.d.ts +1 -0
- package/dist/internal/erc7818.d.ts +12 -0
- package/dist/test/unit/erc7818Expirable.test.d.ts +1 -0
- package/dist/types/ethers-types.d.ts +2 -0
- package/dist/types/types.d.ts +55 -0
- package/package.json +93 -0
@@ -0,0 +1,614 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var providers = require('@ethersproject/providers');
|
6
|
+
var ethersV6 = require('ethers-v6');
|
7
|
+
var contracts = require('@ethersproject/contracts');
|
8
|
+
|
9
|
+
/******************************************************************************
|
10
|
+
Copyright (c) Microsoft Corporation.
|
11
|
+
|
12
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
13
|
+
purpose with or without fee is hereby granted.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
16
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
17
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
18
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
19
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
20
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
21
|
+
PERFORMANCE OF THIS SOFTWARE.
|
22
|
+
***************************************************************************** */
|
23
|
+
|
24
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
25
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
26
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
27
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
28
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
29
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
30
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
35
|
+
var e = new Error(message);
|
36
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
37
|
+
};
|
38
|
+
|
39
|
+
class ChidoriProvider {
|
40
|
+
constructor(config) {
|
41
|
+
this.provider = this.wrapInputProviderLike(config.provider);
|
42
|
+
}
|
43
|
+
wrapInputProviderLike(input) {
|
44
|
+
// 1. detect Ethers.js Signer
|
45
|
+
if (typeof input === 'object' &&
|
46
|
+
typeof input.signTransaction === 'function') {
|
47
|
+
const providerFromSigner = input.provider;
|
48
|
+
if (providerFromSigner == null) {
|
49
|
+
throw new Error('signer not connected');
|
50
|
+
}
|
51
|
+
if (providers.JsonRpcProvider.isProvider(providerFromSigner)) {
|
52
|
+
return {
|
53
|
+
provider: providerFromSigner,
|
54
|
+
signer: input
|
55
|
+
};
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
// this seems to be Ethers v6 signer input - wrapping its provider's "send" function
|
59
|
+
const provider = new providers.Web3Provider((method, params) => __awaiter(this, void 0, void 0, function* () {
|
60
|
+
const providerIn = input.provider;
|
61
|
+
return providerIn.send.bind(providerIn)(method, params);
|
62
|
+
}));
|
63
|
+
// @ts-ignore
|
64
|
+
input._isSigner = true;
|
65
|
+
return {
|
66
|
+
provider,
|
67
|
+
signer: input
|
68
|
+
};
|
69
|
+
}
|
70
|
+
}
|
71
|
+
// 2. detect Ethers.js Provider
|
72
|
+
if (typeof input === 'object' &&
|
73
|
+
typeof input.getSigner === 'function') {
|
74
|
+
if (providers.JsonRpcProvider.isProvider(input)) {
|
75
|
+
return {
|
76
|
+
provider: input,
|
77
|
+
signer: input.getSigner()
|
78
|
+
};
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
// this seems to be Ethers v6 provider input - wrapping its "send" function
|
82
|
+
const provider = new providers.Web3Provider((method, params) => __awaiter(this, void 0, void 0, function* () {
|
83
|
+
return input.send.bind(input)(method, params);
|
84
|
+
}));
|
85
|
+
return {
|
86
|
+
provider,
|
87
|
+
signer: provider.getSigner()
|
88
|
+
};
|
89
|
+
}
|
90
|
+
}
|
91
|
+
throw new Error('wrapInputProviderLike: input provider type is not detected.');
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
var ERC7818_ABI = [
|
96
|
+
{
|
97
|
+
inputs: [
|
98
|
+
],
|
99
|
+
name: "currentEpoch",
|
100
|
+
outputs: [
|
101
|
+
{
|
102
|
+
internalType: "uint256",
|
103
|
+
name: "",
|
104
|
+
type: "uint256"
|
105
|
+
}
|
106
|
+
],
|
107
|
+
stateMutability: "view",
|
108
|
+
type: "function"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
inputs: [
|
112
|
+
{
|
113
|
+
internalType: "uint256",
|
114
|
+
name: "epoch",
|
115
|
+
type: "uint256"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
internalType: "address",
|
119
|
+
name: "account",
|
120
|
+
type: "address"
|
121
|
+
}
|
122
|
+
],
|
123
|
+
name: "balanceOfAtEpoch",
|
124
|
+
outputs: [
|
125
|
+
{
|
126
|
+
internalType: "uint256",
|
127
|
+
name: "",
|
128
|
+
type: "uint256"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
stateMutability: "view",
|
132
|
+
type: "function"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
inputs: [
|
136
|
+
],
|
137
|
+
name: "epochLength",
|
138
|
+
outputs: [
|
139
|
+
{
|
140
|
+
internalType: "uint256",
|
141
|
+
name: "",
|
142
|
+
type: "uint256"
|
143
|
+
}
|
144
|
+
],
|
145
|
+
stateMutability: "view",
|
146
|
+
type: "function"
|
147
|
+
},
|
148
|
+
{
|
149
|
+
inputs: [
|
150
|
+
],
|
151
|
+
name: "epochType",
|
152
|
+
outputs: [
|
153
|
+
{
|
154
|
+
internalType: "uint8",
|
155
|
+
name: "",
|
156
|
+
type: "uint8"
|
157
|
+
}
|
158
|
+
],
|
159
|
+
stateMutability: "view",
|
160
|
+
type: "function"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
inputs: [
|
164
|
+
{
|
165
|
+
internalType: "uint256",
|
166
|
+
name: "epoch",
|
167
|
+
type: "uint256"
|
168
|
+
}
|
169
|
+
],
|
170
|
+
name: "isEpochExpired",
|
171
|
+
outputs: [
|
172
|
+
{
|
173
|
+
internalType: "bool",
|
174
|
+
name: "",
|
175
|
+
type: "bool"
|
176
|
+
}
|
177
|
+
],
|
178
|
+
stateMutability: "view",
|
179
|
+
type: "function"
|
180
|
+
},
|
181
|
+
{
|
182
|
+
inputs: [
|
183
|
+
],
|
184
|
+
name: "validityDuration",
|
185
|
+
outputs: [
|
186
|
+
{
|
187
|
+
internalType: "uint256",
|
188
|
+
name: "",
|
189
|
+
type: "uint256"
|
190
|
+
}
|
191
|
+
],
|
192
|
+
stateMutability: "view",
|
193
|
+
type: "function"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
inputs: [
|
197
|
+
{
|
198
|
+
internalType: "uint256",
|
199
|
+
name: "epoch",
|
200
|
+
type: "uint256"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
internalType: "address",
|
204
|
+
name: "to",
|
205
|
+
type: "address"
|
206
|
+
},
|
207
|
+
{
|
208
|
+
internalType: "uint256",
|
209
|
+
name: "value",
|
210
|
+
type: "uint256"
|
211
|
+
}
|
212
|
+
],
|
213
|
+
name: "transferAtEpoch",
|
214
|
+
outputs: [
|
215
|
+
{
|
216
|
+
internalType: "bool",
|
217
|
+
name: "",
|
218
|
+
type: "bool"
|
219
|
+
}
|
220
|
+
],
|
221
|
+
stateMutability: "nonpayable",
|
222
|
+
type: "function"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
inputs: [
|
226
|
+
{
|
227
|
+
internalType: "uint256",
|
228
|
+
name: "epoch",
|
229
|
+
type: "uint256"
|
230
|
+
},
|
231
|
+
{
|
232
|
+
internalType: "address",
|
233
|
+
name: "from",
|
234
|
+
type: "address"
|
235
|
+
},
|
236
|
+
{
|
237
|
+
internalType: "address",
|
238
|
+
name: "to",
|
239
|
+
type: "address"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
internalType: "uint256",
|
243
|
+
name: "value",
|
244
|
+
type: "uint256"
|
245
|
+
}
|
246
|
+
],
|
247
|
+
name: "transferFromAtEpoch",
|
248
|
+
outputs: [
|
249
|
+
{
|
250
|
+
internalType: "bool",
|
251
|
+
name: "",
|
252
|
+
type: "bool"
|
253
|
+
}
|
254
|
+
],
|
255
|
+
stateMutability: "nonpayable",
|
256
|
+
type: "function"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
inputs: [
|
260
|
+
],
|
261
|
+
name: "name",
|
262
|
+
outputs: [
|
263
|
+
{
|
264
|
+
internalType: "string",
|
265
|
+
name: "",
|
266
|
+
type: "string"
|
267
|
+
}
|
268
|
+
],
|
269
|
+
stateMutability: "view",
|
270
|
+
type: "function"
|
271
|
+
},
|
272
|
+
{
|
273
|
+
inputs: [
|
274
|
+
],
|
275
|
+
name: "symbol",
|
276
|
+
outputs: [
|
277
|
+
{
|
278
|
+
internalType: "string",
|
279
|
+
name: "",
|
280
|
+
type: "string"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
stateMutability: "view",
|
284
|
+
type: "function"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
inputs: [
|
288
|
+
],
|
289
|
+
name: "decimals",
|
290
|
+
outputs: [
|
291
|
+
{
|
292
|
+
internalType: "uint8",
|
293
|
+
name: "",
|
294
|
+
type: "uint8"
|
295
|
+
}
|
296
|
+
],
|
297
|
+
stateMutability: "view",
|
298
|
+
type: "function"
|
299
|
+
},
|
300
|
+
{
|
301
|
+
inputs: [
|
302
|
+
{
|
303
|
+
internalType: "address",
|
304
|
+
name: "owner",
|
305
|
+
type: "address"
|
306
|
+
}
|
307
|
+
],
|
308
|
+
name: "balanceOf",
|
309
|
+
outputs: [
|
310
|
+
{
|
311
|
+
internalType: "uint256",
|
312
|
+
name: "",
|
313
|
+
type: "uint256"
|
314
|
+
}
|
315
|
+
],
|
316
|
+
stateMutability: "view",
|
317
|
+
type: "function"
|
318
|
+
},
|
319
|
+
{
|
320
|
+
inputs: [
|
321
|
+
],
|
322
|
+
name: "totalSupply",
|
323
|
+
outputs: [
|
324
|
+
{
|
325
|
+
internalType: "uint256",
|
326
|
+
name: "",
|
327
|
+
type: "uint256"
|
328
|
+
}
|
329
|
+
],
|
330
|
+
stateMutability: "view",
|
331
|
+
type: "function"
|
332
|
+
},
|
333
|
+
{
|
334
|
+
inputs: [
|
335
|
+
{
|
336
|
+
internalType: "address",
|
337
|
+
name: "spender",
|
338
|
+
type: "address"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
internalType: "uint256",
|
342
|
+
name: "amount",
|
343
|
+
type: "uint256"
|
344
|
+
}
|
345
|
+
],
|
346
|
+
name: "approve",
|
347
|
+
outputs: [
|
348
|
+
{
|
349
|
+
internalType: "bool",
|
350
|
+
name: "",
|
351
|
+
type: "bool"
|
352
|
+
}
|
353
|
+
],
|
354
|
+
stateMutability: "nonpayable",
|
355
|
+
type: "function"
|
356
|
+
},
|
357
|
+
{
|
358
|
+
inputs: [
|
359
|
+
{
|
360
|
+
internalType: "address",
|
361
|
+
name: "owner",
|
362
|
+
type: "address"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
internalType: "address",
|
366
|
+
name: "spender",
|
367
|
+
type: "address"
|
368
|
+
}
|
369
|
+
],
|
370
|
+
name: "allowance",
|
371
|
+
outputs: [
|
372
|
+
{
|
373
|
+
internalType: "uint256",
|
374
|
+
name: "",
|
375
|
+
type: "uint256"
|
376
|
+
}
|
377
|
+
],
|
378
|
+
stateMutability: "view",
|
379
|
+
type: "function"
|
380
|
+
}
|
381
|
+
];
|
382
|
+
|
383
|
+
function getName({ provider }, contractAddress) {
|
384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
385
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
386
|
+
const name = yield contract.name();
|
387
|
+
return name;
|
388
|
+
});
|
389
|
+
}
|
390
|
+
function getSymbol({ provider }, contractAddress) {
|
391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
392
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
393
|
+
const symbol = yield contract.symbol();
|
394
|
+
return symbol;
|
395
|
+
});
|
396
|
+
}
|
397
|
+
function getDecimals({ provider }, contractAddress) {
|
398
|
+
return __awaiter(this, void 0, void 0, function* () {
|
399
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
400
|
+
const decimals = yield contract.decimals();
|
401
|
+
return decimals;
|
402
|
+
});
|
403
|
+
}
|
404
|
+
function getBalanceOf({ provider }, contractAddress, accountAddress) {
|
405
|
+
return __awaiter(this, void 0, void 0, function* () {
|
406
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
407
|
+
const balance = yield contract.balanceOf(accountAddress);
|
408
|
+
const formattedBalance = ethersV6.ethers.formatEther(balance.toString());
|
409
|
+
return formattedBalance;
|
410
|
+
});
|
411
|
+
}
|
412
|
+
function getTotalSupply({ provider }, contractAddress) {
|
413
|
+
return __awaiter(this, void 0, void 0, function* () {
|
414
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
415
|
+
const totalSupply = yield contract.totalSupply();
|
416
|
+
return totalSupply;
|
417
|
+
});
|
418
|
+
}
|
419
|
+
function getBalanceOfAtEpoch({ provider }, contractAddress, accountAddress, epoch) {
|
420
|
+
return __awaiter(this, void 0, void 0, function* () {
|
421
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
422
|
+
const balance = yield contract.balanceOfAtEpoch(accountAddress, epoch);
|
423
|
+
return balance;
|
424
|
+
});
|
425
|
+
}
|
426
|
+
function getCurrentEpoch({ provider }, contractAddress) {
|
427
|
+
return __awaiter(this, void 0, void 0, function* () {
|
428
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
429
|
+
const currentEpoch = yield contract.currentEpoch();
|
430
|
+
return currentEpoch;
|
431
|
+
});
|
432
|
+
}
|
433
|
+
function getEpochLength({ provider }, contractAddress) {
|
434
|
+
return __awaiter(this, void 0, void 0, function* () {
|
435
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
436
|
+
const epochLength = yield contract.epochLength();
|
437
|
+
return epochLength;
|
438
|
+
});
|
439
|
+
}
|
440
|
+
function getValidityDuration({ provider }, contractAddress) {
|
441
|
+
return __awaiter(this, void 0, void 0, function* () {
|
442
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
443
|
+
const duration = yield contract.validityDuration();
|
444
|
+
return duration;
|
445
|
+
});
|
446
|
+
}
|
447
|
+
function getIsExpochExpire({ provider }, contractAddress, epoch) {
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
449
|
+
const contract = new contracts.Contract(contractAddress, ERC7818_ABI, provider.provider || provider.signer);
|
450
|
+
const isExpire = yield contract.isEpochExpired(epoch);
|
451
|
+
return isExpire;
|
452
|
+
});
|
453
|
+
}
|
454
|
+
// export async function transfer(
|
455
|
+
// { provider }: KiwariProvider,
|
456
|
+
// contractAddress: string,
|
457
|
+
// to: string,
|
458
|
+
// identifier: number,
|
459
|
+
// value: number
|
460
|
+
// ): Promise<string> {
|
461
|
+
// const signer = provider.signer;
|
462
|
+
// const contract = new Contract(contractAddress, ERC20_ABI, signer);
|
463
|
+
// const contractWithSigner = contract.connect(signer) as any;
|
464
|
+
// const tx = await contractWithSigner['transfer'](to, identifier, value);
|
465
|
+
// await tx.wait();
|
466
|
+
// return tx.hash;
|
467
|
+
// }
|
468
|
+
// export async function transferFrom(
|
469
|
+
// { provider }: KiwariProvider,
|
470
|
+
// contractAddress: string,
|
471
|
+
// from: string,
|
472
|
+
// to: string,
|
473
|
+
// identifier: number,
|
474
|
+
// value: number
|
475
|
+
// ): Promise<string> {
|
476
|
+
// const contract = new Contract(
|
477
|
+
// contractAddress,
|
478
|
+
// ERC20_ABI,
|
479
|
+
// provider.provider || provider.signer
|
480
|
+
// );
|
481
|
+
// const tx = await contract.transferFrom(from, to, identifier, value);
|
482
|
+
// await tx.wait();
|
483
|
+
// return tx.hash;
|
484
|
+
// }
|
485
|
+
|
486
|
+
class ERC7818Namespace {
|
487
|
+
constructor(chidoriProvider) {
|
488
|
+
this.chidoriProvider = chidoriProvider;
|
489
|
+
}
|
490
|
+
/**
|
491
|
+
* Get balance of owner.
|
492
|
+
*
|
493
|
+
* This method returns the balance of user.
|
494
|
+
*
|
495
|
+
* @param contractAddress - The address of the contract.
|
496
|
+
* @param accountAddress - The address of the account.
|
497
|
+
* @public
|
498
|
+
*/
|
499
|
+
getBalanceOf({ contractAddress, accountAddress }) {
|
500
|
+
return getBalanceOf(this.chidoriProvider, contractAddress, accountAddress);
|
501
|
+
}
|
502
|
+
/**
|
503
|
+
* Get balance at epoch of owner by identifier.
|
504
|
+
*
|
505
|
+
* This method returns the balance of user.
|
506
|
+
*
|
507
|
+
* @param contractAddress - The address of the contract.
|
508
|
+
* @param accountAddress - The address of the account.
|
509
|
+
* @param identifier - The Identifier "MAY" represents an epoch, round, period, or token identifier.
|
510
|
+
* @public
|
511
|
+
*/
|
512
|
+
getBalanceOfAtEpoch({ contractAddress, accountAddress, epoch }) {
|
513
|
+
return getBalanceOfAtEpoch(this.chidoriProvider, contractAddress, accountAddress, epoch);
|
514
|
+
}
|
515
|
+
/**
|
516
|
+
* Get decimals of token.
|
517
|
+
*
|
518
|
+
* This method returns the decimals of token.
|
519
|
+
*
|
520
|
+
* @param contractAddress - The address of the contract.
|
521
|
+
* @public
|
522
|
+
*/
|
523
|
+
getDecimals({ contractAddress }) {
|
524
|
+
return getDecimals(this.chidoriProvider, contractAddress);
|
525
|
+
}
|
526
|
+
/**
|
527
|
+
* Get validity duration.
|
528
|
+
*
|
529
|
+
* This method returns validity duration in blocks or the time in seconds.
|
530
|
+
*
|
531
|
+
* @param contractAddress - The address of the contract.
|
532
|
+
* @public
|
533
|
+
*/
|
534
|
+
getValidityDuration({ contractAddress }) {
|
535
|
+
return getValidityDuration(this.chidoriProvider, contractAddress);
|
536
|
+
}
|
537
|
+
/**
|
538
|
+
* Get current epoch.
|
539
|
+
*
|
540
|
+
* This method returns current epoch of the token contract, often used for determining active/expired states.
|
541
|
+
*
|
542
|
+
* @param contractAddress - The address of the contract.
|
543
|
+
* @public
|
544
|
+
*/
|
545
|
+
getCurrentEpoch({ contractAddress }) {
|
546
|
+
return getEpochLength(this.chidoriProvider, contractAddress);
|
547
|
+
}
|
548
|
+
/**
|
549
|
+
* Get epoch length.
|
550
|
+
*
|
551
|
+
* This method returns dulation of single epoch.
|
552
|
+
*
|
553
|
+
* @param contractAddress - The address of the contract.
|
554
|
+
* @public
|
555
|
+
*/
|
556
|
+
getEpochLength({ contractAddress }) {
|
557
|
+
return getCurrentEpoch(this.chidoriProvider, contractAddress);
|
558
|
+
}
|
559
|
+
/**
|
560
|
+
* Get is epoch expire.
|
561
|
+
*
|
562
|
+
* This method returns boolean of the token contract, True if the token is expired, false otherwise.
|
563
|
+
*
|
564
|
+
* @param contractAddress - The address of the contract.
|
565
|
+
* @param identifier - The Identifier "MAY" represents an epoch, round, period, or token identifier.
|
566
|
+
* @public
|
567
|
+
*/
|
568
|
+
getIsExpochExpire({ contractAddress, identifier }) {
|
569
|
+
return getIsExpochExpire(this.chidoriProvider, contractAddress, identifier);
|
570
|
+
}
|
571
|
+
/**
|
572
|
+
* Get name of token.
|
573
|
+
*
|
574
|
+
* This method returns the name of token.
|
575
|
+
*
|
576
|
+
* @param contractAddress - The address of the contract.
|
577
|
+
* @public
|
578
|
+
*/
|
579
|
+
getName({ contractAddress }) {
|
580
|
+
return getName(this.chidoriProvider, contractAddress);
|
581
|
+
}
|
582
|
+
/**
|
583
|
+
* Get symbol of token.
|
584
|
+
*
|
585
|
+
* This method returns the symbol of token.
|
586
|
+
*
|
587
|
+
* @param contractAddress - The address of the contract.
|
588
|
+
* @public
|
589
|
+
*/
|
590
|
+
getSymbol({ contractAddress }) {
|
591
|
+
return getSymbol(this.chidoriProvider, contractAddress);
|
592
|
+
}
|
593
|
+
/**
|
594
|
+
* Get total supply of token.
|
595
|
+
*
|
596
|
+
* This method returns the total supply of token.
|
597
|
+
*
|
598
|
+
* @param contractAddress - The address of the contract.
|
599
|
+
* @public
|
600
|
+
*/
|
601
|
+
getTotalSupply({ contractAddress }) {
|
602
|
+
return getTotalSupply(this.chidoriProvider, contractAddress);
|
603
|
+
}
|
604
|
+
}
|
605
|
+
|
606
|
+
class Chidori {
|
607
|
+
constructor(providers) {
|
608
|
+
this.chidoriProvider = new ChidoriProvider({ provider: providers });
|
609
|
+
this.erc7818Expirable = new ERC7818Namespace(this.chidoriProvider);
|
610
|
+
}
|
611
|
+
}
|
612
|
+
|
613
|
+
exports.Chidori = Chidori;
|
614
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/blockchain/chidori-provider.ts","../../src/internal/erc7818.ts","../../src/blockchain/erc7818-namespace.ts","../../src/blockchain/chidori.ts"],"sourcesContent":["import {\n JsonRpcProvider,\n JsonRpcSigner,\n Web3Provider\n} from '@ethersproject/providers';\n\nimport { Providers } from '../types/types';\n\nexport class ChidoriProvider {\n readonly provider: {\n provider: JsonRpcProvider;\n signer: JsonRpcSigner;\n };\n\n constructor(config: { provider: Providers }) {\n this.provider = this.wrapInputProviderLike(config.provider);\n }\n\n wrapInputProviderLike(input: Providers): {\n provider: JsonRpcProvider;\n signer: JsonRpcSigner;\n } {\n // 1. detect Ethers.js Signer\n\n if (\n typeof input === 'object' &&\n typeof (input as any).signTransaction === 'function'\n ) {\n const providerFromSigner = (input as any).provider;\n\n if (providerFromSigner == null) {\n throw new Error('signer not connected');\n }\n\n if (JsonRpcProvider.isProvider(providerFromSigner)) {\n return {\n provider: providerFromSigner as any,\n signer: input as any\n };\n } else {\n // this seems to be Ethers v6 signer input - wrapping its provider's \"send\" function\n const provider = new Web3Provider(\n async (method: string, params?: any[]) => {\n const providerIn = (input as any).provider;\n return providerIn.send.bind(providerIn)(method, params);\n }\n );\n // @ts-ignore\n input._isSigner = true;\n return {\n provider,\n signer: input as any\n };\n }\n }\n // 2. detect Ethers.js Provider\n\n if (\n typeof input === 'object' &&\n typeof (input as any).getSigner === 'function'\n ) {\n if (JsonRpcProvider.isProvider(input)) {\n return {\n provider: input as any,\n signer: (input as any).getSigner()\n };\n } else {\n // this seems to be Ethers v6 provider input - wrapping its \"send\" function\n const provider = new Web3Provider(\n async (method: string, params?: any[]) => {\n return (input as any).send.bind(input)(method, params);\n }\n );\n return {\n provider,\n signer: provider.getSigner()\n };\n }\n }\n\n throw new Error(\n 'wrapInputProviderLike: input provider type is not detected.'\n );\n }\n}\n","import { ethers } from 'ethers-v6';\n\nimport { BigNumber } from '@ethersproject/bignumber';\nimport { Contract } from '@ethersproject/contracts';\n\nimport ERC7818_ABI from '../abis/ERC7818_ABI.json';\nimport { ChidoriProvider } from '../blockchain/chidori-provider';\n\nexport async function getName(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<string> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const name = await contract.name();\n\n return name;\n}\n\nexport async function getSymbol(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<string> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const symbol = await contract.symbol();\n\n return symbol;\n}\n\nexport async function getDecimals(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<Number> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const decimals = await contract.decimals();\n\n return decimals;\n}\n\nexport async function getBalanceOf(\n { provider }: ChidoriProvider,\n contractAddress: string,\n accountAddress: string\n): Promise<string> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const balance = await contract.balanceOf(accountAddress);\n\n const formattedBalance = ethers.formatEther(balance.toString());\n\n return formattedBalance;\n}\n\nexport async function getTotalSupply(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<BigNumber> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const totalSupply = await contract.totalSupply();\n\n return totalSupply;\n}\n\nexport async function getBalanceOfAtEpoch(\n { provider }: ChidoriProvider,\n contractAddress: string,\n accountAddress: string,\n epoch: number\n): Promise<BigNumber> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const balance = await contract.balanceOfAtEpoch(accountAddress, epoch);\n\n return balance;\n}\n\nexport async function getCurrentEpoch(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<BigNumber> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const currentEpoch = await contract.currentEpoch();\n\n return currentEpoch;\n}\n\nexport async function getEpochLength(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<BigNumber> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const epochLength = await contract.epochLength();\n\n return epochLength;\n}\n\nexport async function getValidityDuration(\n { provider }: ChidoriProvider,\n contractAddress: string\n): Promise<BigNumber> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const duration = await contract.validityDuration();\n\n return duration;\n}\n\nexport async function getIsExpochExpire(\n { provider }: ChidoriProvider,\n contractAddress: string,\n epoch: number\n): Promise<Boolean> {\n const contract = new Contract(\n contractAddress,\n ERC7818_ABI,\n provider.provider || provider.signer\n );\n\n const isExpire = await contract.isEpochExpired(epoch);\n\n return isExpire;\n}\n\n// export async function transfer(\n// { provider }: KiwariProvider,\n// contractAddress: string,\n// to: string,\n// identifier: number,\n// value: number\n// ): Promise<string> {\n// const signer = provider.signer;\n// const contract = new Contract(contractAddress, ERC20_ABI, signer);\n\n// const contractWithSigner = contract.connect(signer) as any;\n\n// const tx = await contractWithSigner['transfer'](to, identifier, value);\n// await tx.wait();\n\n// return tx.hash;\n// }\n\n// export async function transferFrom(\n// { provider }: KiwariProvider,\n// contractAddress: string,\n// from: string,\n// to: string,\n// identifier: number,\n// value: number\n// ): Promise<string> {\n// const contract = new Contract(\n// contractAddress,\n// ERC20_ABI,\n// provider.provider || provider.signer\n// );\n\n// const tx = await contract.transferFrom(from, to, identifier, value);\n// await tx.wait();\n\n// return tx.hash;\n// }\n","import { BigNumber } from '@ethersproject/bignumber';\n\nimport {\n getBalanceOf,\n getBalanceOfAtEpoch,\n getCurrentEpoch,\n getDecimals,\n getEpochLength,\n getIsExpochExpire,\n getName,\n getSymbol,\n getTotalSupply,\n getValidityDuration\n} from '../internal/erc7818';\nimport {\n GetBalanceOfAtEpochInterface,\n GetBalanceOfInterface,\n GetCurrentEpochInterface,\n GetDecimalsInterface,\n GetEpochLengthInterface,\n GetIsEpochExpireInterface,\n GetNameInterface,\n GetSymbolInterface,\n GetTotalSupplyInterface, // TransferFromInterface,\n // TransferInterface\n GetValidityDurationInterface\n} from '../types/types';\nimport { ChidoriProvider } from './chidori-provider';\n\nexport class ERC7818Namespace {\n constructor(private readonly chidoriProvider: ChidoriProvider) {}\n\n /**\n * Get balance of owner.\n *\n * This method returns the balance of user.\n *\n * @param contractAddress - The address of the contract.\n * @param accountAddress - The address of the account.\n * @public\n */\n\n getBalanceOf({\n contractAddress,\n accountAddress\n }: GetBalanceOfInterface): Promise<string> {\n return getBalanceOf(this.chidoriProvider, contractAddress, accountAddress);\n }\n\n /**\n * Get balance at epoch of owner by identifier.\n *\n * This method returns the balance of user.\n *\n * @param contractAddress - The address of the contract.\n * @param accountAddress - The address of the account.\n * @param identifier - The Identifier \"MAY\" represents an epoch, round, period, or token identifier.\n * @public\n */\n\n getBalanceOfAtEpoch({\n contractAddress,\n accountAddress,\n epoch\n }: GetBalanceOfAtEpochInterface): Promise<BigNumber> {\n return getBalanceOfAtEpoch(\n this.chidoriProvider,\n contractAddress,\n accountAddress,\n epoch\n );\n }\n\n /**\n * Get decimals of token.\n *\n * This method returns the decimals of token.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getDecimals({ contractAddress }: GetDecimalsInterface): Promise<Number> {\n return getDecimals(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get validity duration.\n *\n * This method returns validity duration in blocks or the time in seconds.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getValidityDuration({\n contractAddress\n }: GetValidityDurationInterface): Promise<BigNumber> {\n return getValidityDuration(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get current epoch.\n *\n * This method returns current epoch of the token contract, often used for determining active/expired states.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getCurrentEpoch({\n contractAddress\n }: GetCurrentEpochInterface): Promise<BigNumber> {\n return getEpochLength(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get epoch length.\n *\n * This method returns dulation of single epoch.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getEpochLength({\n contractAddress\n }: GetEpochLengthInterface): Promise<BigNumber> {\n return getCurrentEpoch(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get is epoch expire.\n *\n * This method returns boolean of the token contract, True if the token is expired, false otherwise.\n *\n * @param contractAddress - The address of the contract.\n * @param identifier - The Identifier \"MAY\" represents an epoch, round, period, or token identifier.\n * @public\n */\n\n getIsExpochExpire({\n contractAddress,\n identifier\n }: GetIsEpochExpireInterface): Promise<Boolean> {\n return getIsExpochExpire(this.chidoriProvider, contractAddress, identifier);\n }\n\n /**\n * Get name of token.\n *\n * This method returns the name of token.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getName({ contractAddress }: GetNameInterface): Promise<string> {\n return getName(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get symbol of token.\n *\n * This method returns the symbol of token.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getSymbol({ contractAddress }: GetSymbolInterface): Promise<string> {\n return getSymbol(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Get total supply of token.\n *\n * This method returns the total supply of token.\n *\n * @param contractAddress - The address of the contract.\n * @public\n */\n\n getTotalSupply({\n contractAddress\n }: GetTotalSupplyInterface): Promise<BigNumber> {\n return getTotalSupply(this.chidoriProvider, contractAddress);\n }\n\n /**\n * Transfer Tokens.\n *\n * This method transfer token to recipient address.\n *\n * @param contractAddress - The address of the contract.\n * @param to - The recipient address.\n * @param identifier - The Identifier \"MAY\" represents an epoch, round, period, or token identifier.\n * @param value - The amount to transfer.\n * @public\n */\n\n // transfer({\n // contractAddress,\n // to,\n // identifier,\n // value\n // }: TransferInterface): Promise<string> {\n // return transfer(\n // this.kiwariProvider,\n // contractAddress,\n // to,\n // identifier,\n // value\n // );\n // }\n\n /**\n * Transfer From Tokens.\n *\n * This method transfer token to recipient address.\n *\n * @param contractAddress - The address of the contract.\n * @param from - The sender address.\n * @param to - The recipient address.\n * @param identifier - The Identifier \"MAY\" represents an epoch, round, period, or token identifier.\n * @param value - The amount to transfer.\n * @public\n */\n\n // transferFrom({\n // contractAddress,\n // from,\n // to,\n // identifier,\n // value\n // }: TransferFromInterface): Promise<string> {\n // return transferFrom(\n // this.kiwariProvider,\n // contractAddress,\n // from,\n // to,\n // identifier,\n // value\n // );\n // }\n}\n","import { Providers } from '../types/types';\nimport { ChidoriProvider } from './chidori-provider';\nimport { ERC7818Namespace } from './erc7818-namespace';\n\nexport class Chidori {\n readonly erc7818Expirable: ERC7818Namespace;\n\n readonly chidoriProvider: ChidoriProvider;\n\n constructor(providers: Providers) {\n this.chidoriProvider = new ChidoriProvider({ provider: providers });\n this.erc7818Expirable = new ERC7818Namespace(this.chidoriProvider);\n }\n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,EAAA;QACxB,OAAO,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;KAC9D;AA0DF;;MCjPY,OAAO,CAAA;AAKlB,IAAA,WAAA,CAAY,SAAoB,EAAA;AAC9B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KACpE;AACF;;;;"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
2
|
+
import { ChidoriProvider } from '../blockchain/chidori-provider';
|
3
|
+
export declare function getName({ provider }: ChidoriProvider, contractAddress: string): Promise<string>;
|
4
|
+
export declare function getSymbol({ provider }: ChidoriProvider, contractAddress: string): Promise<string>;
|
5
|
+
export declare function getDecimals({ provider }: ChidoriProvider, contractAddress: string): Promise<Number>;
|
6
|
+
export declare function getBalanceOf({ provider }: ChidoriProvider, contractAddress: string, accountAddress: string): Promise<string>;
|
7
|
+
export declare function getTotalSupply({ provider }: ChidoriProvider, contractAddress: string): Promise<BigNumber>;
|
8
|
+
export declare function getBalanceOfAtEpoch({ provider }: ChidoriProvider, contractAddress: string, accountAddress: string, epoch: number): Promise<BigNumber>;
|
9
|
+
export declare function getCurrentEpoch({ provider }: ChidoriProvider, contractAddress: string): Promise<BigNumber>;
|
10
|
+
export declare function getEpochLength({ provider }: ChidoriProvider, contractAddress: string): Promise<BigNumber>;
|
11
|
+
export declare function getValidityDuration({ provider }: ChidoriProvider, contractAddress: string): Promise<BigNumber>;
|
12
|
+
export declare function getIsExpochExpire({ provider }: ChidoriProvider, contractAddress: string, epoch: number): Promise<Boolean>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|