@verified-network/verified-sdk 2.2.7 → 2.2.9
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/abi/custody/Vault.json +11 -38253
- package/dist/abi/payments/Bond.json +1 -66239
- package/dist/abi/payments/Cash.json +1 -62805
- package/dist/abi/payments/ERC20.json +1 -12827
- package/dist/abi/payments/Factory.json +1 -23409
- package/dist/abi/payments/Rates.json +1 -5712
- package/dist/abi/payments/Token.json +3 -9802
- package/dist/contract/custody/index.d.ts +13 -15
- package/dist/contract/custody/index.js +26 -53
- package/dist/contract/index.js +12 -69
- package/dist/contractAddress/index.js +16 -16
- package/package.json +1 -1
|
@@ -11,22 +11,20 @@ export default class Custody extends VerifiedContract {
|
|
|
11
11
|
chainId: number;
|
|
12
12
|
functionName: string;
|
|
13
13
|
}>;
|
|
14
|
-
createVault(_creator: string,
|
|
15
|
-
resetPin(_creator: string, _id: string, _new: string, options?: Options): any;
|
|
14
|
+
createVault(_creator: string, options?: Options): any;
|
|
16
15
|
getVaults(): any;
|
|
17
|
-
transferVault(_creator: string,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
calculateAverageBalance(_creator: string, _id: string, _token: string, _fromTime: string, _toTime: string, options?: Options): any;
|
|
16
|
+
transferVault(_creator: string, _transferee: string, options?: Options): any;
|
|
17
|
+
addParticipant(_creator: string, _participant: string, _shard: string, options?: Options): any;
|
|
18
|
+
removeParticipant(_creator: string, _participant: string, options?: Options): any;
|
|
19
|
+
confirmParticipant(_creator: string, _participant: string, _confirmation: string, options?: Options): any;
|
|
20
|
+
defineQuorum(_creator: string, _minParticipants: string, options?: Options): any;
|
|
21
|
+
getQuorum(_creator: string, options?: Options): any;
|
|
22
|
+
promptSignatures(_creator: string, options?: Options): any;
|
|
23
|
+
signTransaction(_creator: string, _participant: string, _tx: string, options?: Options): any;
|
|
24
|
+
checkQuorum(_creator: string, _txid: string, options?: Options): any;
|
|
25
|
+
getShards(_creator: string, _txid: string, options?: Options): any;
|
|
26
|
+
snapshotBalance(_creator: string, _token: string, options?: Options): any;
|
|
27
|
+
calculateAverageBalance(_creator: string, _token: string, _fromTime: string, _toTime: string, options?: Options): any;
|
|
30
28
|
collectCustodyFee(_token: string, options?: Options): any;
|
|
31
29
|
setDistributor(_nominee: string, options?: Options): any;
|
|
32
30
|
setCustodyFee(_fee: string, options?: Options): any;
|
|
@@ -38,102 +38,75 @@ class Custody extends index_1.VerifiedContract {
|
|
|
38
38
|
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
39
39
|
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
40
40
|
}
|
|
41
|
-
async createVault(_creator,
|
|
41
|
+
async createVault(_creator, options) {
|
|
42
42
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
43
|
-
|
|
44
|
-
return this.callContract(FUNCTIONS.CREATEVAULT, _creator, _id, options);
|
|
45
|
-
}
|
|
46
|
-
async resetPin(_creator, _id, _new, options) {
|
|
47
|
-
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
48
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
49
|
-
await this.validateInput(index_1.DATATYPES.STRING, _new);
|
|
50
|
-
return this.callContract(FUNCTIONS.RESETPIN, _creator, _id, _new, options);
|
|
43
|
+
return this.callContract(FUNCTIONS.CREATEVAULT, _creator, options);
|
|
51
44
|
}
|
|
52
45
|
async getVaults() {
|
|
53
46
|
return this.callContract(FUNCTIONS.GETVAULTS);
|
|
54
47
|
}
|
|
55
|
-
async transferVault(_creator,
|
|
48
|
+
async transferVault(_creator, _transferee, options) {
|
|
56
49
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
57
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
58
50
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _transferee);
|
|
59
|
-
return this.callContract(FUNCTIONS.TRANSFERVAULT, _creator,
|
|
51
|
+
return this.callContract(FUNCTIONS.TRANSFERVAULT, _creator, _transferee, options);
|
|
60
52
|
}
|
|
61
|
-
async
|
|
53
|
+
async addParticipant(_creator, _participant, _shard, options) {
|
|
62
54
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
63
|
-
await this.validateInput(index_1.DATATYPES.STRING, _pin);
|
|
64
|
-
return this.callContract(FUNCTIONS.GETCREATOR, _creator, _pin, options);
|
|
65
|
-
}
|
|
66
|
-
async addParticipant(_creator, _id, _participant, _shard, options) {
|
|
67
|
-
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
68
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
69
55
|
await this.validateInput(index_1.DATATYPES.BYTE32, _participant);
|
|
70
56
|
await this.validateInput(index_1.DATATYPES.STRING, _shard);
|
|
71
|
-
return this.callContract(FUNCTIONS.ADDPARTICIPANT, _creator,
|
|
57
|
+
return this.callContract(FUNCTIONS.ADDPARTICIPANT, _creator, _participant, _shard, options);
|
|
72
58
|
}
|
|
73
|
-
async removeParticipant(_creator,
|
|
59
|
+
async removeParticipant(_creator, _participant, options) {
|
|
74
60
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
75
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
76
61
|
await this.validateInput(index_1.DATATYPES.BYTE32, _participant);
|
|
77
|
-
return this.callContract(FUNCTIONS.REMOVEPARTICIPANT, _creator,
|
|
62
|
+
return this.callContract(FUNCTIONS.REMOVEPARTICIPANT, _creator, _participant, options);
|
|
78
63
|
}
|
|
79
|
-
async confirmParticipant(_creator,
|
|
64
|
+
async confirmParticipant(_creator, _participant, _confirmation, options) {
|
|
80
65
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
81
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
82
66
|
await this.validateInput(index_1.DATATYPES.BYTE32, _participant);
|
|
83
|
-
await this.validateInput(index_1.DATATYPES.STRING, _pin);
|
|
84
67
|
await this.validateInput(index_1.DATATYPES.BOOLEAN, _confirmation);
|
|
85
|
-
return this.callContract(FUNCTIONS.CONFIRMPARTICIPANT, _creator,
|
|
68
|
+
return this.callContract(FUNCTIONS.CONFIRMPARTICIPANT, _creator, _participant, _confirmation, options);
|
|
86
69
|
}
|
|
87
|
-
async defineQuorum(_creator,
|
|
70
|
+
async defineQuorum(_creator, _minParticipants, options) {
|
|
88
71
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
89
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
90
72
|
await this.validateInput(index_1.DATATYPES.NUMBER, _minParticipants);
|
|
91
|
-
return this.callContract(FUNCTIONS.DEFINEQUORUM, _creator,
|
|
73
|
+
return this.callContract(FUNCTIONS.DEFINEQUORUM, _creator, _minParticipants, options);
|
|
92
74
|
}
|
|
93
|
-
async getQuorum(_creator,
|
|
75
|
+
async getQuorum(_creator, options) {
|
|
94
76
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
95
|
-
|
|
96
|
-
return this.callContract(FUNCTIONS.GETQUORUM, _creator, _id, options);
|
|
77
|
+
return this.callContract(FUNCTIONS.GETQUORUM, _creator, options);
|
|
97
78
|
}
|
|
98
|
-
async promptSignatures(_creator,
|
|
79
|
+
async promptSignatures(_creator, options) {
|
|
99
80
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
100
|
-
|
|
101
|
-
return this.callContract(FUNCTIONS.PROMPTSIGNATURES, _creator, _id, options);
|
|
81
|
+
return this.callContract(FUNCTIONS.PROMPTSIGNATURES, _creator, options);
|
|
102
82
|
}
|
|
103
|
-
async signTransaction(_creator,
|
|
83
|
+
async signTransaction(_creator, _participant, _tx, options) {
|
|
104
84
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
105
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
106
85
|
await this.validateInput(index_1.DATATYPES.BYTE32, _participant);
|
|
107
86
|
await this.validateInput(index_1.DATATYPES.STRING, _tx);
|
|
108
|
-
|
|
109
|
-
return this.callContract(FUNCTIONS.SIGNTRANSACTION, _creator, _id, _participant, _tx, _pin, options);
|
|
87
|
+
return this.callContract(FUNCTIONS.SIGNTRANSACTION, _creator, _participant, _tx, options);
|
|
110
88
|
}
|
|
111
|
-
async checkQuorum(_creator,
|
|
89
|
+
async checkQuorum(_creator, _txid, options) {
|
|
112
90
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
113
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
114
|
-
await this.validateInput(index_1.DATATYPES.BYTE32, _participant);
|
|
115
91
|
await this.validateInput(index_1.DATATYPES.STRING, _txid);
|
|
116
|
-
return this.callContract(FUNCTIONS.CHECKQUORUM, _creator,
|
|
92
|
+
return this.callContract(FUNCTIONS.CHECKQUORUM, _creator, _txid, options);
|
|
117
93
|
}
|
|
118
|
-
async getShards(_creator,
|
|
94
|
+
async getShards(_creator, _txid, options) {
|
|
119
95
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
120
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
121
96
|
await this.validateInput(index_1.DATATYPES.STRING, _txid);
|
|
122
|
-
return this.callContract(FUNCTIONS.GETSHARDS, _creator,
|
|
97
|
+
return this.callContract(FUNCTIONS.GETSHARDS, _creator, _txid, options);
|
|
123
98
|
}
|
|
124
|
-
async snapshotBalance(_creator,
|
|
99
|
+
async snapshotBalance(_creator, _token, options) {
|
|
125
100
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
126
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
127
101
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _token);
|
|
128
|
-
return this.callContract(FUNCTIONS.SNAPSHOT, _creator,
|
|
102
|
+
return this.callContract(FUNCTIONS.SNAPSHOT, _creator, _token, options);
|
|
129
103
|
}
|
|
130
|
-
async calculateAverageBalance(_creator,
|
|
104
|
+
async calculateAverageBalance(_creator, _token, _fromTime, _toTime, options) {
|
|
131
105
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
132
|
-
await this.validateInput(index_1.DATATYPES.STRING, _id);
|
|
133
106
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _token);
|
|
134
107
|
await this.validateInput(index_1.DATATYPES.NUMBER, _fromTime);
|
|
135
108
|
await this.validateInput(index_1.DATATYPES.NUMBER, _toTime);
|
|
136
|
-
return this.callContract(FUNCTIONS.CALCULATEAVERAGEBALANCE, _creator,
|
|
109
|
+
return this.callContract(FUNCTIONS.CALCULATEAVERAGEBALANCE, _creator, _token, _fromTime, _toTime, options);
|
|
137
110
|
}
|
|
138
111
|
async collectCustodyFee(_token, options) {
|
|
139
112
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _token);
|
package/dist/contract/index.js
CHANGED
|
@@ -405,9 +405,10 @@ class VerifiedContract {
|
|
|
405
405
|
}
|
|
406
406
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
407
407
|
async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken, _apiKey) {
|
|
408
|
-
var _a, _b, _c
|
|
408
|
+
var _a, _b, _c;
|
|
409
409
|
let res = {};
|
|
410
410
|
let txHash = "";
|
|
411
|
+
let recp;
|
|
411
412
|
try {
|
|
412
413
|
const meeClient = await (0, abstractjs_1.createMeeClient)({
|
|
413
414
|
account: nexusAccount,
|
|
@@ -420,6 +421,7 @@ class VerifiedContract {
|
|
|
420
421
|
calls: [tx],
|
|
421
422
|
},
|
|
422
423
|
});
|
|
424
|
+
const nowInSec = Math.floor(Date.now() / 1000);
|
|
423
425
|
// Execute the transaction using passed paymentToken
|
|
424
426
|
const { hash } = await meeClient.execute({
|
|
425
427
|
feeToken: {
|
|
@@ -427,6 +429,7 @@ class VerifiedContract {
|
|
|
427
429
|
address: paymentToken,
|
|
428
430
|
},
|
|
429
431
|
instructions: [transactionInstruction],
|
|
432
|
+
upperBoundTimestamp: nowInSec + 299, //highest is 5 minutes???
|
|
430
433
|
});
|
|
431
434
|
txHash = hash;
|
|
432
435
|
console.log(`MEE transaction hash: ${hash}`);
|
|
@@ -465,74 +468,14 @@ class VerifiedContract {
|
|
|
465
468
|
}
|
|
466
469
|
}
|
|
467
470
|
catch (err) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
try {
|
|
477
|
-
await new Promise((resolve) => setTimeout(resolve, 6000)); // 6 second delay
|
|
478
|
-
console.log("MEE deadline exceeded, fetching receipt for round:", i + 1, "out of", Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND));
|
|
479
|
-
const receipt = await meeClient.waitForSupertransactionReceipt({
|
|
480
|
-
hash: txHash,
|
|
481
|
-
});
|
|
482
|
-
if (((_e = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _e === void 0 ? void 0 : _e.length) > 1) {
|
|
483
|
-
//at least 2 receipts
|
|
484
|
-
const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_f = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _f === void 0 ? void 0 : _f.length) - 1];
|
|
485
|
-
if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
|
|
486
|
-
res.status = STATUS.SUCCESS;
|
|
487
|
-
res.response = {
|
|
488
|
-
hash: txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.transactionHash,
|
|
489
|
-
result: txReceipt,
|
|
490
|
-
}; //TODO: update result on response
|
|
491
|
-
res.message = "";
|
|
492
|
-
break; // Exit the loop
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
res.status = STATUS.ERROR;
|
|
496
|
-
res.response = {
|
|
497
|
-
hash: txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.transactionHash,
|
|
498
|
-
result: txReceipt,
|
|
499
|
-
}; //TODO: update result on response
|
|
500
|
-
res.message = "";
|
|
501
|
-
break; // Exit the loop
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
else {
|
|
505
|
-
console.error("MEE client transaction failed with error: ", "Receipts lesser than one.");
|
|
506
|
-
res.status = STATUS.ERROR;
|
|
507
|
-
res.response = {
|
|
508
|
-
hash: (_g = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _g === void 0 ? void 0 : _g.transactionHash,
|
|
509
|
-
result: receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0],
|
|
510
|
-
}; //TODO: update result on response
|
|
511
|
-
res.message = "";
|
|
512
|
-
return res;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
catch (_err) {
|
|
516
|
-
if ((_h = _err === null || _err === void 0 ? void 0 : _err.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes("execution deadline limit exceeded")) {
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return res;
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
console.error("MEE client transaction failed with error: ", err);
|
|
528
|
-
res.status = STATUS.ERROR;
|
|
529
|
-
res.response = {
|
|
530
|
-
hash: txHash,
|
|
531
|
-
result: {},
|
|
532
|
-
}; //TODO: update result on response
|
|
533
|
-
res.message = "";
|
|
534
|
-
return res;
|
|
535
|
-
}
|
|
471
|
+
console.error("MEE client transaction failed with error: ", err === null || err === void 0 ? void 0 : err.message);
|
|
472
|
+
res.status = STATUS.ERROR;
|
|
473
|
+
res.response = {
|
|
474
|
+
hash: txHash,
|
|
475
|
+
result: {},
|
|
476
|
+
}; //TODO: update result on response
|
|
477
|
+
res.message = "";
|
|
478
|
+
return res;
|
|
536
479
|
}
|
|
537
480
|
}
|
|
538
481
|
async callContract(functionName, ...args) {
|
|
@@ -311,12 +311,12 @@ const contractAddress = {
|
|
|
311
311
|
},
|
|
312
312
|
11155111: {
|
|
313
313
|
'Client': '0xB72629Bb4d031F1C755AFfA123AAA28E81EfdA9A',
|
|
314
|
-
'Factory': '
|
|
315
|
-
'Cash': '
|
|
316
|
-
'Bond': '
|
|
317
|
-
'Token': '
|
|
318
|
-
'Oracle': '
|
|
319
|
-
'Rates': '
|
|
314
|
+
'Factory': '0x8B7e7F4f5E31e6D21df294b81bF0937f12ce46C6',
|
|
315
|
+
'Cash': '0xC5908dC7FBAe5c89795a2b6125db91a2B63b8cDb',
|
|
316
|
+
'Bond': '0x7E006149F41211a557119ffd7d85Dc3c1E9738A0',
|
|
317
|
+
'Token': '0xB4386154a83411921c2D8CC405F26530b071f56C',
|
|
318
|
+
'Oracle': '0x199C6e01B61C2C29D8fCbaDb4AefBC4318aF15A2',
|
|
319
|
+
'Rates': '0xFF63C682d8904Fd3780b5c6b94737d32C7D5BB66',
|
|
320
320
|
'Security': '0xa1c552a33FB9e391d0F50A6407385c55cd22d596',
|
|
321
321
|
'SecuritiesFactory': '0x7CaB6AA90fD672F6ddBd0B92c0a5428b53ebA414',
|
|
322
322
|
'Vitta': '0x87145164371Ad7851AD3B4D47C9820F95983d8EA',
|
|
@@ -328,19 +328,19 @@ const contractAddress = {
|
|
|
328
328
|
'BalancerSecondaryIssueManager': '0xE3e3e9b8c0c292eD3756C7A1037322738de6B7FC',
|
|
329
329
|
'MarginTradingPoolFactory': '0xB1ae3Fc5B16d3736bf0db20606fB9a10b435392c',
|
|
330
330
|
'BalancerMarginIssueManager': '0xcC52ce78a8fF2198FBD37D85D1686E7C80604cd3',
|
|
331
|
-
'Custody': '
|
|
332
|
-
'Compound': '
|
|
331
|
+
'Custody': '0x4F0E3399D1a8cC0B755bF0f9e14f82D346Cc6900',
|
|
332
|
+
'Compound': '',
|
|
333
333
|
'CASH': {
|
|
334
|
-
'VCUSD': '
|
|
335
|
-
'VCEUR': '
|
|
336
|
-
'VCCHF': '
|
|
337
|
-
'VCINR': '
|
|
334
|
+
'VCUSD': '0x9947770931A0F4AC74941eaAE003991d2d487d83',
|
|
335
|
+
'VCEUR': '0x196940848fECCaae04E555E3eD8481C6aA4D829C',
|
|
336
|
+
'VCCHF': '0x3585Bc49dFad76850b8fB168bEF4cA70EA0A4838',
|
|
337
|
+
'VCINR': '0x90cB7a153439021bFd6AD012325560A4E5224043'
|
|
338
338
|
},
|
|
339
339
|
'BOND': {
|
|
340
|
-
'VBUSD': '
|
|
341
|
-
'VBEUR': '
|
|
342
|
-
'
|
|
343
|
-
'VBINR': '
|
|
340
|
+
'VBUSD': '0x795746D83B9787F9f79dD41E80A311d70751D4eb',
|
|
341
|
+
'VBEUR': '0x88200F79d4fC7Aec3581c5679002134D3a7cf6B8',
|
|
342
|
+
'VBCHF': '0x69bcA5eE64aa9e25Fba2f7a02f55eE19dA22b15a',
|
|
343
|
+
'VBINR': '0xc23B7f679a8aCB36E862d28Eb7c4d88a6F5dc451'
|
|
344
344
|
},
|
|
345
345
|
},
|
|
346
346
|
'balancerVault': '0xBA12222222228d8Ba445958a75a0704d566BF2C8'
|