@verified-network/verified-sdk 1.4.4 → 1.4.5
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/payments/ERC20.json +13092 -0
- package/dist/contract/erc20/index.js +71 -0
- package/dist/contract/token/index.js +14 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const ERC20_json_1 = require("../../abi/payments/ERC20.json");
|
|
7
|
+
var FUNCTIONS;
|
|
8
|
+
(function (FUNCTIONS) {
|
|
9
|
+
FUNCTIONS["NAME"] = "name";
|
|
10
|
+
FUNCTIONS["SYMBOL"] = "symbol";
|
|
11
|
+
FUNCTIONS["TOTALSUPPLY"] = "totalSupply";
|
|
12
|
+
FUNCTIONS["BALANCE"] = "balanceOf";
|
|
13
|
+
FUNCTIONS["TRANSFER"] = "transfer";
|
|
14
|
+
FUNCTIONS["APPROVE"] = "approve";
|
|
15
|
+
FUNCTIONS["ALLOWANCE"] = "allowance";
|
|
16
|
+
FUNCTIONS["TRANSFERFROM"] = "transferFrom";
|
|
17
|
+
FUNCTIONS["INCREASEALLOWANCE"] = "increaseAllowance";
|
|
18
|
+
FUNCTIONS["DECREASEALLOWANCE"] = "decreaseAllowance";
|
|
19
|
+
})(FUNCTIONS || (FUNCTIONS = {}));
|
|
20
|
+
class ERC20 extends index_1.VerifiedContract {
|
|
21
|
+
constructor(signer, contractNetworkAddress) {
|
|
22
|
+
const address = contractNetworkAddress;
|
|
23
|
+
super(address, JSON.stringify(ERC20_json_1.abi), signer);
|
|
24
|
+
this.contractAddress = address;
|
|
25
|
+
}
|
|
26
|
+
async name() {
|
|
27
|
+
return this.callContract(FUNCTIONS.NAME);
|
|
28
|
+
}
|
|
29
|
+
async symbol() {
|
|
30
|
+
return this.callContract(FUNCTIONS.SYMBOL);
|
|
31
|
+
}
|
|
32
|
+
async totalSupply() {
|
|
33
|
+
return this.callContract(FUNCTIONS.TOTALSUPPLY);
|
|
34
|
+
}
|
|
35
|
+
async balanceOf(_account, options) {
|
|
36
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _account);
|
|
37
|
+
return this.callContract(FUNCTIONS.BALANCE, _account, options);
|
|
38
|
+
}
|
|
39
|
+
async transfer(_recipient, _amount, options) {
|
|
40
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _recipient);
|
|
41
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
|
|
42
|
+
return this.callContract(FUNCTIONS.TRANSFER, _recipient, _amount, options);
|
|
43
|
+
}
|
|
44
|
+
async approve(_spender, _amount, options) {
|
|
45
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
46
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
|
|
47
|
+
return this.callContract(FUNCTIONS.APPROVE, _spender, _amount, options);
|
|
48
|
+
}
|
|
49
|
+
async allowance(_owner, _spender, options) {
|
|
50
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
51
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _owner);
|
|
52
|
+
return this.callContract(FUNCTIONS.ALLOWANCE, _owner, _spender, options);
|
|
53
|
+
}
|
|
54
|
+
async increaseAllowance(_spender, _addedValue, options) {
|
|
55
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
56
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _addedValue);
|
|
57
|
+
return this.callContract(FUNCTIONS.INCREASEALLOWANCE, _spender, _addedValue, options);
|
|
58
|
+
}
|
|
59
|
+
async decreaseAllowance(_spender, _subtractedValue, options) {
|
|
60
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
61
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _subtractedValue);
|
|
62
|
+
return this.callContract(FUNCTIONS.DECREASEALLOWANCE, _spender, _subtractedValue, options);
|
|
63
|
+
}
|
|
64
|
+
async transferFrom(_senderAddress, _recieverAddress, _tokens, options) {
|
|
65
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _senderAddress);
|
|
66
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _recieverAddress);
|
|
67
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _tokens);
|
|
68
|
+
return this.callContract(FUNCTIONS.TRANSFERFROM, _senderAddress, _recieverAddress, _tokens, options);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = ERC20;
|
|
@@ -9,6 +9,8 @@ var FUNCTIONS;
|
|
|
9
9
|
FUNCTIONS["TRANSFERFROM"] = "transferFrom";
|
|
10
10
|
FUNCTIONS["BALANCE"] = "balanceOf";
|
|
11
11
|
FUNCTIONS["GETISSUER"] = "getIssuer";
|
|
12
|
+
FUNCTIONS["REQUESTTRANSACTION"] = "requestTransaction";
|
|
13
|
+
FUNCTIONS["REQUESTTRANSFER"] = "requestTransfer";
|
|
12
14
|
})(FUNCTIONS || (FUNCTIONS = {}));
|
|
13
15
|
class Token extends index_1.VerifiedContract {
|
|
14
16
|
constructor(signer, bondCurrencyAddress) {
|
|
@@ -41,5 +43,17 @@ class Token extends index_1.VerifiedContract {
|
|
|
41
43
|
async getIssuer() {
|
|
42
44
|
return this.callContract(FUNCTIONS.GETISSUER);
|
|
43
45
|
}
|
|
46
|
+
async requestTransfer(_recieverAddress, _tokens, options) {
|
|
47
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _recieverAddress);
|
|
48
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _tokens);
|
|
49
|
+
return this.callContract(FUNCTIONS.REQUESTTRANSFER, _recieverAddress, _tokens, options);
|
|
50
|
+
}
|
|
51
|
+
async requestTransaction(_amount, _payer, _collateralName, _collateralContract, options) {
|
|
52
|
+
await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
|
|
53
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _payer);
|
|
54
|
+
await this.validateInput(index_1.DATATYPES.STRING, _collateralName);
|
|
55
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _collateralContract);
|
|
56
|
+
return this.callContract(FUNCTIONS.REQUESTTRANSACTION, _amount, _payer, this.sanitiseInput(index_1.DATATYPES.BYTE32, _collateralName), _collateralContract, options);
|
|
57
|
+
}
|
|
44
58
|
}
|
|
45
59
|
exports.default = Token;
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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.Provider = exports.VerifiedWallet = void 0;
|
|
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;
|
|
8
8
|
const wallet_1 = require("./wallet");
|
|
9
9
|
Object.defineProperty(exports, "VerifiedWallet", { enumerable: true, get: function () { return wallet_1.VerifiedWallet; } });
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return utils_1.Provider; } });
|
|
12
|
+
const erc20_1 = __importDefault(require("./contract/erc20"));
|
|
13
|
+
exports.ERC20 = erc20_1.default;
|
|
12
14
|
const bond_1 = __importDefault(require("./contract/bond"));
|
|
13
15
|
exports.Bond = bond_1.default;
|
|
14
16
|
const cash_1 = __importDefault(require("./contract/cash"));
|