@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.
@@ -11,22 +11,20 @@ export default class Custody extends VerifiedContract {
11
11
  chainId: number;
12
12
  functionName: string;
13
13
  }>;
14
- createVault(_creator: string, _id: string, options?: Options): any;
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, _id: string, _transferee: string, options?: Options): any;
18
- getCreator(_creator: string, _pin: string, options?: Options): any;
19
- addParticipant(_creator: string, _id: string, _participant: string, _shard: string, options?: Options): any;
20
- removeParticipant(_creator: string, _id: string, _participant: string, options?: Options): any;
21
- confirmParticipant(_creator: string, _id: string, _participant: string, _pin: string, _confirmation: string, options?: Options): any;
22
- defineQuorum(_creator: string, _id: string, _minParticipants: string, options?: Options): any;
23
- getQuorum(_creator: string, _id: string, options?: Options): any;
24
- promptSignatures(_creator: string, _id: string, options?: Options): any;
25
- signTransaction(_creator: string, _id: string, _participant: string, _tx: string, _pin: string, options?: Options): any;
26
- checkQuorum(_creator: string, _id: string, _participant: string, _txid: string, options?: Options): any;
27
- getShards(_creator: string, _id: string, _txid: string, options?: Options): any;
28
- snapshotBalance(_creator: string, _id: string, _token: string, options?: Options): any;
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, _id, options) {
41
+ async createVault(_creator, options) {
42
42
  await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
43
- await this.validateInput(index_1.DATATYPES.STRING, _id);
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, _id, _transferee, options) {
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, _id, _transferee, options);
51
+ return this.callContract(FUNCTIONS.TRANSFERVAULT, _creator, _transferee, options);
60
52
  }
61
- async getCreator(_creator, _pin, options) {
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, _id, _participant, _shard, options);
57
+ return this.callContract(FUNCTIONS.ADDPARTICIPANT, _creator, _participant, _shard, options);
72
58
  }
73
- async removeParticipant(_creator, _id, _participant, options) {
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, _id, _participant, options);
62
+ return this.callContract(FUNCTIONS.REMOVEPARTICIPANT, _creator, _participant, options);
78
63
  }
79
- async confirmParticipant(_creator, _id, _participant, _pin, _confirmation, options) {
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, _id, _participant, _pin, _confirmation, options);
68
+ return this.callContract(FUNCTIONS.CONFIRMPARTICIPANT, _creator, _participant, _confirmation, options);
86
69
  }
87
- async defineQuorum(_creator, _id, _minParticipants, options) {
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, _id, _minParticipants, options);
73
+ return this.callContract(FUNCTIONS.DEFINEQUORUM, _creator, _minParticipants, options);
92
74
  }
93
- async getQuorum(_creator, _id, options) {
75
+ async getQuorum(_creator, options) {
94
76
  await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
95
- await this.validateInput(index_1.DATATYPES.STRING, _id);
96
- return this.callContract(FUNCTIONS.GETQUORUM, _creator, _id, options);
77
+ return this.callContract(FUNCTIONS.GETQUORUM, _creator, options);
97
78
  }
98
- async promptSignatures(_creator, _id, options) {
79
+ async promptSignatures(_creator, options) {
99
80
  await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
100
- await this.validateInput(index_1.DATATYPES.STRING, _id);
101
- return this.callContract(FUNCTIONS.PROMPTSIGNATURES, _creator, _id, options);
81
+ return this.callContract(FUNCTIONS.PROMPTSIGNATURES, _creator, options);
102
82
  }
103
- async signTransaction(_creator, _id, _participant, _tx, _pin, options) {
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
- await this.validateInput(index_1.DATATYPES.STRING, _pin);
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, _id, _participant, _txid, options) {
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, _id, _participant, _txid, options);
92
+ return this.callContract(FUNCTIONS.CHECKQUORUM, _creator, _txid, options);
117
93
  }
118
- async getShards(_creator, _id, _txid, options) {
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, _id, _txid, options);
97
+ return this.callContract(FUNCTIONS.GETSHARDS, _creator, _txid, options);
123
98
  }
124
- async snapshotBalance(_creator, _id, _token, options) {
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, _id, _token, options);
102
+ return this.callContract(FUNCTIONS.SNAPSHOT, _creator, _token, options);
129
103
  }
130
- async calculateAverageBalance(_creator, _id, _token, _fromTime, _toTime, options) {
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, _id, _token, _fromTime, _toTime, options);
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);
@@ -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, _d, _e, _f, _g, _h;
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
- if ((txHash === null || txHash === void 0 ? void 0 : txHash.length) > 0 &&
469
- ((_d = err === null || err === void 0 ? void 0 : err.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes("execution deadline limit exceeded"))) {
470
- console.warn("MEE client transaction deadline exceeded, will fetch receipt manually...");
471
- const meeClient = await (0, abstractjs_1.createMeeClient)({
472
- account: nexusAccount,
473
- apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
474
- });
475
- for (let i = 0; i < Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND); i++) {
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': '0x358643DA31fdE65b15839EeC0C72f3dacD07EBeD',
315
- 'Cash': '0xA565F2e350dC3972c3C1779DE1d9EB4EF45baaBA',
316
- 'Bond': '0xA357BaE12300992087560fd62c0638A91cD453C2',
317
- 'Token': '0x58D7648C9d55567b5D1C37A3176D487539e9B8Be',
318
- 'Oracle': '0xF6ebB33E758eC36A2D3065F4633131DFF8307A07',
319
- 'Rates': '0xfC63cBB9aC6F6de3cAfbb1df7430339f3989fe14',
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': '0x1F97Bd2c4D3b42a87B225dd7990F4a13f1CF8760',
332
- 'Compound': '0x8c364b06741C9fE045E0e510A39BCbAf7445D8fD',
331
+ 'Custody': '0x4F0E3399D1a8cC0B755bF0f9e14f82D346Cc6900',
332
+ 'Compound': '',
333
333
  'CASH': {
334
- 'VCUSD': '0xFe55A419F0fc951d1924FB5eA456c94483BdDd82',
335
- 'VCEUR': '0xcdb1c23277C9C150E7D4201d854c558AAe986256',
336
- 'VCCHF': '0x666BE39Fb2D6965885DAA97422B286B7ec222488',
337
- 'VCINR': '0xeEd2B863F2Ac3BB4884701F0fD0F18f9bAD7819B'
334
+ 'VCUSD': '0x9947770931A0F4AC74941eaAE003991d2d487d83',
335
+ 'VCEUR': '0x196940848fECCaae04E555E3eD8481C6aA4D829C',
336
+ 'VCCHF': '0x3585Bc49dFad76850b8fB168bEF4cA70EA0A4838',
337
+ 'VCINR': '0x90cB7a153439021bFd6AD012325560A4E5224043'
338
338
  },
339
339
  'BOND': {
340
- 'VBUSD': '0xa8B77cF42e649Ae4BC3B5E2286b275E1A771054A',
341
- 'VBEUR': '0x860E90968FB712e391d14e32d2462CB7C9D158cb',
342
- 'VCCHF': '0x144Fb05846C4B1c2a85A92A918b29FAb4719a184',
343
- 'VBINR': '0x4C49fe7f77aF2818beb2F3E02fE85B8ACB8Df243'
340
+ 'VBUSD': '0x795746D83B9787F9f79dD41E80A311d70751D4eb',
341
+ 'VBEUR': '0x88200F79d4fC7Aec3581c5679002134D3a7cf6B8',
342
+ 'VBCHF': '0x69bcA5eE64aa9e25Fba2f7a02f55eE19dA22b15a',
343
+ 'VBINR': '0xc23B7f679a8aCB36E862d28Eb7c4d88a6F5dc451'
344
344
  },
345
345
  },
346
346
  'balancerVault': '0xBA12222222228d8Ba445958a75a0704d566BF2C8'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verified-network/verified-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "description": "An SDK to develop applications on the Verified Network",
5
5
  "repository": {
6
6
  "type": "git",