@verified-network/verified-sdk 1.6.0 → 1.6.1
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 +3219 -3219
- package/dist/abi/payments/Bond.json +11011 -11458
- package/dist/abi/payments/Cash.json +6779 -6780
- package/dist/abi/payments/ERC20.json +1293 -1293
- package/dist/abi/payments/Factory.json +2643 -2644
- package/dist/abi/payments/Rates.json +695 -696
- package/dist/abi/payments/Token.json +1104 -1105
- package/dist/contract/index.d.ts +6 -0
- package/dist/contract/index.js +18 -0
- package/dist/contract/pool/index.js +4 -2
- package/dist/contract/token/index.d.ts +20 -0
- package/dist/contract/token/index.js +41 -0
- package/dist/contractAddress/index.js +15 -15
- package/dist/index.js +21 -19
- package/package.json +3 -2
- package/tsconfig.json +1 -1
package/dist/contract/index.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export declare class VerifiedContract {
|
|
|
28
28
|
protected validateInput(type: DATATYPES, data: any): Promise<boolean>;
|
|
29
29
|
protected sanitiseInput(type: DATATYPES, data: any): any;
|
|
30
30
|
protected sanitiseOutput(type: DATATYPES, data: any): any;
|
|
31
|
+
/**
|
|
32
|
+
* gets a function state mutability to differenciate between read and write functions
|
|
33
|
+
* @param functionName
|
|
34
|
+
* @returns true or false
|
|
35
|
+
*/
|
|
36
|
+
private isReadFunction;
|
|
31
37
|
/**
|
|
32
38
|
* Parses output to standard response
|
|
33
39
|
* @param data
|
package/dist/contract/index.js
CHANGED
|
@@ -127,6 +127,19 @@ class VerifiedContract {
|
|
|
127
127
|
return data;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* gets a function state mutability to differenciate between read and write functions
|
|
132
|
+
* @param functionName
|
|
133
|
+
* @returns true or false
|
|
134
|
+
*/
|
|
135
|
+
isReadFunction(functionName) {
|
|
136
|
+
const functionFragment = this.abiInterface.getFunction(functionName);
|
|
137
|
+
if (!functionFragment) {
|
|
138
|
+
throw new Error(`Function ${functionName} not found in ABI`);
|
|
139
|
+
}
|
|
140
|
+
return (functionFragment.stateMutability === 'view' ||
|
|
141
|
+
functionFragment.stateMutability === 'pure');
|
|
142
|
+
}
|
|
130
143
|
/**
|
|
131
144
|
* Parses output to standard response
|
|
132
145
|
* @param data
|
|
@@ -271,6 +284,11 @@ class VerifiedContract {
|
|
|
271
284
|
}
|
|
272
285
|
}
|
|
273
286
|
async callContract(functionName, ...args) {
|
|
287
|
+
// Check if the function is a read function
|
|
288
|
+
if (this.isReadFunction(functionName)) {
|
|
289
|
+
console.log("read function will use ethers");
|
|
290
|
+
return await this.callFunctionWithEthers(functionName, ...args);
|
|
291
|
+
}
|
|
274
292
|
const chainId = await this.signer.getChainId();
|
|
275
293
|
if (this.supportsGasless(chainId)) {
|
|
276
294
|
console.log("gassless supported will use userop");
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// SPDX-License-Identifier: BUSL-1.1
|
|
3
3
|
// @ts-nocheck
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
4
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
8
|
const index_1 = require("../index");
|
|
7
9
|
const Vault_json_1 = require("../../abi/assetmanager/Vault.json");
|
|
8
|
-
const contractAddress_1 =
|
|
10
|
+
const contractAddress_1 = __importDefault(require("../../contractAddress"));
|
|
9
11
|
var FUNCTIONS;
|
|
10
12
|
(function (FUNCTIONS) {
|
|
11
13
|
FUNCTIONS["SWAP"] = "swap";
|
|
@@ -28,4 +28,24 @@ export default class Token extends VerifiedContract {
|
|
|
28
28
|
gasPrice: number;
|
|
29
29
|
gasLimit: number;
|
|
30
30
|
}): any;
|
|
31
|
+
name(): any;
|
|
32
|
+
symbol(): any;
|
|
33
|
+
decimals(): any;
|
|
34
|
+
totalSupply(): any;
|
|
35
|
+
approve(_spender: string, _amount: string, options?: {
|
|
36
|
+
gasPrice: number;
|
|
37
|
+
gasLimit: number;
|
|
38
|
+
}): any;
|
|
39
|
+
allowance(_owner: string, _spender: string, options?: {
|
|
40
|
+
gasPrice: number;
|
|
41
|
+
gasLimit: number;
|
|
42
|
+
}): any;
|
|
43
|
+
increaseAllowance(_spender: string, _addedValue: string, options?: {
|
|
44
|
+
gasPrice: number;
|
|
45
|
+
gasLimit: number;
|
|
46
|
+
}): any;
|
|
47
|
+
decreaseAllowance(_spender: string, _subtractedValue: string, options?: {
|
|
48
|
+
gasPrice: number;
|
|
49
|
+
gasLimit: number;
|
|
50
|
+
}): any;
|
|
31
51
|
}
|
|
@@ -8,9 +8,18 @@ var FUNCTIONS;
|
|
|
8
8
|
(function (FUNCTIONS) {
|
|
9
9
|
FUNCTIONS["TRANSFERFROM"] = "transferFrom";
|
|
10
10
|
FUNCTIONS["BALANCE"] = "balanceOf";
|
|
11
|
+
FUNCTIONS["NAME"] = "name";
|
|
12
|
+
FUNCTIONS["DECIMALS"] = "decimals";
|
|
11
13
|
FUNCTIONS["GETISSUER"] = "getIssuer";
|
|
12
14
|
FUNCTIONS["REQUESTTRANSACTION"] = "requestTransaction";
|
|
13
15
|
FUNCTIONS["REQUESTTRANSFER"] = "requestTransfer";
|
|
16
|
+
FUNCTIONS["SYMBOL"] = "symbol";
|
|
17
|
+
FUNCTIONS["TOTALSUPPLY"] = "totalSupply";
|
|
18
|
+
FUNCTIONS["TRANSFER"] = "transfer";
|
|
19
|
+
FUNCTIONS["APPROVE"] = "approve";
|
|
20
|
+
FUNCTIONS["ALLOWANCE"] = "allowance";
|
|
21
|
+
FUNCTIONS["INCREASEALLOWANCE"] = "increaseAllowance";
|
|
22
|
+
FUNCTIONS["DECREASEALLOWANCE"] = "decreaseAllowance";
|
|
14
23
|
})(FUNCTIONS || (FUNCTIONS = {}));
|
|
15
24
|
class Token extends index_1.VerifiedContract {
|
|
16
25
|
constructor(signer, bondCurrencyAddress) {
|
|
@@ -55,5 +64,37 @@ class Token extends index_1.VerifiedContract {
|
|
|
55
64
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _collateralContract);
|
|
56
65
|
return this.callContract(FUNCTIONS.REQUESTTRANSACTION, _amount, _payer, this.sanitiseInput(index_1.DATATYPES.BYTE32, _collateralName), _collateralContract, options);
|
|
57
66
|
}
|
|
67
|
+
async name() {
|
|
68
|
+
return this.callContract(FUNCTIONS.NAME);
|
|
69
|
+
}
|
|
70
|
+
async symbol() {
|
|
71
|
+
return this.callContract(FUNCTIONS.SYMBOL);
|
|
72
|
+
}
|
|
73
|
+
async decimals() {
|
|
74
|
+
return this.callContract(FUNCTIONS.DECIMALS);
|
|
75
|
+
}
|
|
76
|
+
async totalSupply() {
|
|
77
|
+
return this.callContract(FUNCTIONS.TOTALSUPPLY);
|
|
78
|
+
}
|
|
79
|
+
async approve(_spender, _amount, options) {
|
|
80
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
81
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
|
|
82
|
+
return this.callContract(FUNCTIONS.APPROVE, _spender, _amount, options);
|
|
83
|
+
}
|
|
84
|
+
async allowance(_owner, _spender, options) {
|
|
85
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
86
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _owner);
|
|
87
|
+
return this.callContract(FUNCTIONS.ALLOWANCE, _owner, _spender, options);
|
|
88
|
+
}
|
|
89
|
+
async increaseAllowance(_spender, _addedValue, options) {
|
|
90
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
91
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _addedValue);
|
|
92
|
+
return this.callContract(FUNCTIONS.INCREASEALLOWANCE, _spender, _addedValue, options);
|
|
93
|
+
}
|
|
94
|
+
async decreaseAllowance(_spender, _subtractedValue, options) {
|
|
95
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
96
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _subtractedValue);
|
|
97
|
+
return this.callContract(FUNCTIONS.DECREASEALLOWANCE, _spender, _subtractedValue, options);
|
|
98
|
+
}
|
|
58
99
|
}
|
|
59
100
|
exports.default = Token;
|
|
@@ -243,12 +243,12 @@ const contractAddress = {
|
|
|
243
243
|
//Base Sepolia
|
|
244
244
|
84532: {
|
|
245
245
|
'Client': '',
|
|
246
|
-
'Factory': '',
|
|
247
|
-
'Cash': '',
|
|
248
|
-
'Bond': '',
|
|
249
|
-
'Token': '',
|
|
250
|
-
'Oracle': '',
|
|
251
|
-
'Rates': '',
|
|
246
|
+
'Factory': '0x1021A1474dC1630E5781B1676Def04fF7f11Cc0b',
|
|
247
|
+
'Cash': '0x15323E84AFF1dDFfcE321F05D75c5dB4b4491e9F',
|
|
248
|
+
'Bond': '0x4464fF4e174CABeC48901d0B990C7fD47e0A5d1B',
|
|
249
|
+
'Token': '0xE18a3Fcad231BA549aA488Fa984BDaEb0F6B30e5',
|
|
250
|
+
'Oracle': '0x3DBAa50441669fDdd9100a9f4703F8B53ca991F7',
|
|
251
|
+
'Rates': '0x127C7ef8D3b60Dd3bE78cDB3b349D1a9cf4368bD',
|
|
252
252
|
'Security': '',
|
|
253
253
|
'SecuritiesFactory': '',
|
|
254
254
|
'Vitta': '',
|
|
@@ -260,19 +260,19 @@ const contractAddress = {
|
|
|
260
260
|
'BalancerSecondaryIssueManager': '',
|
|
261
261
|
'MarginTradingPoolFactory': '',
|
|
262
262
|
'BalancerMarginIssueManager': '',
|
|
263
|
-
'Custody': '
|
|
263
|
+
'Custody': '0x8365A76099629CDd6B28c3D85862A220504C0b46',
|
|
264
264
|
'Compound': '',
|
|
265
265
|
'CASH': {
|
|
266
|
-
'VCUSD': '',
|
|
267
|
-
'VCEUR': '',
|
|
268
|
-
'VCCHF': '',
|
|
269
|
-
'VCINR': ''
|
|
266
|
+
'VCUSD': '0x1C751BA898D01789af51A9022b7A6f45836a5d6c',
|
|
267
|
+
'VCEUR': '0xF0736Fa9490C45b5dF5129A461fAA1362795A4c0',
|
|
268
|
+
'VCCHF': '0x1D2D161C36958a71855413b09d60fd537742BD39',
|
|
269
|
+
'VCINR': '0x4D602f59d2680c9eB99438a4F707954F46b58e83'
|
|
270
270
|
},
|
|
271
271
|
'BOND': {
|
|
272
|
-
'VBUSD': '',
|
|
273
|
-
'VBEUR': '',
|
|
274
|
-
'VCCHF': '',
|
|
275
|
-
'VBINR': ''
|
|
272
|
+
'VBUSD': '0xD84fEeb3232A8578F83A1e64b5F3C0E440676368',
|
|
273
|
+
'VBEUR': '0x4A37E3Cd9563Dc3685a963AD565cC72117eFF0Dd',
|
|
274
|
+
'VCCHF': '0x32ecC3e013f300DE51F0Bd3b91441188d8893c21',
|
|
275
|
+
'VBINR': '0xA1A42bD9eB738Cac2b21e9421cB49e8364Ce697E'
|
|
276
276
|
},
|
|
277
277
|
},
|
|
278
278
|
100: {
|
package/dist/index.js
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// SPDX-License-Identifier: BUSL-1.1
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.contractAddress = exports.utils = exports.Compound = exports.Client = exports.Distribution = exports.SecuritiesFactory = exports.Security = exports.MarginIssueManager = exports.SecondaryIssueManager = exports.PrimaryIssueManager = exports.Rates = exports.Liquidity = exports.Custody = exports.Pool = exports.Token = exports.Factory = exports.Cash = exports.Bond = exports.ERC20 = exports.Provider = exports.VerifiedWallet = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
8
|
const wallet_1 = require("./wallet");
|
|
7
9
|
Object.defineProperty(exports, "VerifiedWallet", { enumerable: true, get: function () { return wallet_1.VerifiedWallet; } });
|
|
8
10
|
const utils_1 = require("./utils");
|
|
9
11
|
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return utils_1.Provider; } });
|
|
10
|
-
const erc20_1 =
|
|
12
|
+
const erc20_1 = __importDefault(require("./contract/erc20"));
|
|
11
13
|
exports.ERC20 = erc20_1.default;
|
|
12
|
-
const bond_1 =
|
|
14
|
+
const bond_1 = __importDefault(require("./contract/bond"));
|
|
13
15
|
exports.Bond = bond_1.default;
|
|
14
|
-
const cash_1 =
|
|
16
|
+
const cash_1 = __importDefault(require("./contract/cash"));
|
|
15
17
|
exports.Cash = cash_1.default;
|
|
16
|
-
const factory_1 =
|
|
18
|
+
const factory_1 = __importDefault(require("./contract/factory"));
|
|
17
19
|
exports.Factory = factory_1.default;
|
|
18
|
-
const token_1 =
|
|
20
|
+
const token_1 = __importDefault(require("./contract/token"));
|
|
19
21
|
exports.Token = token_1.default;
|
|
20
|
-
const pool_1 =
|
|
22
|
+
const pool_1 = __importDefault(require("./contract/pool"));
|
|
21
23
|
exports.Pool = pool_1.default;
|
|
22
|
-
const custody_1 =
|
|
24
|
+
const custody_1 = __importDefault(require("./contract/custody"));
|
|
23
25
|
exports.Custody = custody_1.default;
|
|
24
|
-
const liquidity_1 =
|
|
26
|
+
const liquidity_1 = __importDefault(require("./contract/liquidity"));
|
|
25
27
|
exports.Liquidity = liquidity_1.default;
|
|
26
|
-
const rates_1 =
|
|
28
|
+
const rates_1 = __importDefault(require("./contract/rates"));
|
|
27
29
|
exports.Rates = rates_1.default;
|
|
28
|
-
const primary_1 =
|
|
30
|
+
const primary_1 = __importDefault(require("./contract/amm/primary"));
|
|
29
31
|
exports.PrimaryIssueManager = primary_1.default;
|
|
30
|
-
const secondary_1 =
|
|
32
|
+
const secondary_1 = __importDefault(require("./contract/amm/secondary"));
|
|
31
33
|
exports.SecondaryIssueManager = secondary_1.default;
|
|
32
|
-
const margin_1 =
|
|
34
|
+
const margin_1 = __importDefault(require("./contract/amm/margin"));
|
|
33
35
|
exports.MarginIssueManager = margin_1.default;
|
|
34
|
-
const security_1 =
|
|
36
|
+
const security_1 = __importDefault(require("./contract/security"));
|
|
35
37
|
exports.Security = security_1.default;
|
|
36
|
-
const securitiesfactory_1 =
|
|
38
|
+
const securitiesfactory_1 = __importDefault(require("./contract/securitiesfactory"));
|
|
37
39
|
exports.SecuritiesFactory = securitiesfactory_1.default;
|
|
38
|
-
const distribution_1 =
|
|
40
|
+
const distribution_1 = __importDefault(require("./contract/distribution"));
|
|
39
41
|
exports.Distribution = distribution_1.default;
|
|
40
|
-
const client_1 =
|
|
42
|
+
const client_1 = __importDefault(require("./contract/client"));
|
|
41
43
|
exports.Client = client_1.default;
|
|
42
|
-
const compound_1 =
|
|
44
|
+
const compound_1 = __importDefault(require("./contract/loans/compound"));
|
|
43
45
|
exports.Compound = compound_1.default;
|
|
44
46
|
const ethers_1 = require("ethers");
|
|
45
47
|
Object.defineProperty(exports, "utils", { enumerable: true, get: function () { return ethers_1.utils; } });
|
|
46
|
-
const contractAddress_1 =
|
|
48
|
+
const contractAddress_1 = __importDefault(require("./contractAddress"));
|
|
47
49
|
exports.contractAddress = contractAddress_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verified-network/verified-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "An SDK to develop applications on the Verified Network",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"@biconomy/account": "^4.1.1",
|
|
35
35
|
"ethereumjs-tx": "^2.1.2",
|
|
36
36
|
"ethers": "^5.7.2",
|
|
37
|
-
"tslib": "^2.6.2"
|
|
37
|
+
"tslib": "^2.6.2",
|
|
38
|
+
"viem": "^2.12.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/mocha": "^10.0.6",
|
package/tsconfig.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
21
|
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
22
|
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
-
"importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
23
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
24
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
25
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
26
|
|