@cityofzion/bs-neo3 0.9.3 → 0.11.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/BSNeo3.d.ts +8 -4
- package/dist/BSNeo3.js +38 -13
- package/dist/DoraBDSNeo3.d.ts +0 -1
- package/dist/DoraBDSNeo3.js +11 -12
- package/dist/DoraESNeo3.d.ts +1 -1
- package/dist/DoraESNeo3.js +19 -5
- package/dist/FlamingoEDSNeo3.d.ts +1 -2
- package/dist/FlamingoEDSNeo3.js +20 -5
- package/dist/GhostMarketNDSNeo3.d.ts +1 -1
- package/dist/GhostMarketNDSNeo3.js +17 -3
- package/dist/LedgerServiceNeo3.d.ts +14 -0
- package/dist/LedgerServiceNeo3.js +96 -0
- package/dist/RpcBDSNeo3.d.ts +4 -4
- package/dist/RpcBDSNeo3.js +23 -19
- package/package.json +12 -9
- package/.eslintignore +0 -13
- package/.eslintrc.cjs +0 -22
- package/.rush/temp/operation/build/all.log +0 -1
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/package-deps_build.json +0 -31
- package/.rush/temp/shrinkwrap-deps.json +0 -439
- package/CHANGELOG.json +0 -66
- package/CHANGELOG.md +0 -33
- package/bs-neo3.build.log +0 -1
- package/jest.config.ts +0 -13
- package/jest.setup.ts +0 -1
- package/src/BSNeo3.ts +0 -232
- package/src/DoraBDSNeo3.ts +0 -188
- package/src/DoraESNeo3.ts +0 -19
- package/src/FlamingoEDSNeo3.ts +0 -41
- package/src/GhostMarketNDSNeo3.ts +0 -121
- package/src/RpcBDSNeo3.ts +0 -159
- package/src/__tests__/BDSNeo3.spec.ts +0 -124
- package/src/__tests__/BSNeo3.spec.ts +0 -149
- package/src/__tests__/DoraESNeo3.spec.ts +0 -23
- package/src/__tests__/FlamingoEDSNeo3.spec.ts +0 -48
- package/src/__tests__/GhostMarketNDSNeo3.spec.ts +0 -48
- package/src/__tests__/utils/sleep.ts +0 -1
- package/src/assets/tokens/common.json +0 -14
- package/src/assets/tokens/mainnet.json +0 -116
- package/src/constants.ts +0 -29
- package/src/index.ts +0 -6
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -14
package/dist/RpcBDSNeo3.js
CHANGED
|
@@ -11,28 +11,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RPCBDSNeo3 = void 0;
|
|
13
13
|
const neon_core_1 = require("@cityofzion/neon-core");
|
|
14
|
-
const
|
|
14
|
+
const neon_dappkit_1 = require("@cityofzion/neon-dappkit");
|
|
15
15
|
const constants_1 = require("./constants");
|
|
16
16
|
class RPCBDSNeo3 {
|
|
17
17
|
constructor(network, feeToken, claimToken) {
|
|
18
|
-
this.
|
|
18
|
+
this._tokenCache = new Map();
|
|
19
19
|
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 2;
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
20
|
+
this._network = network;
|
|
21
|
+
this._feeToken = feeToken;
|
|
22
|
+
this._claimToken = claimToken;
|
|
23
23
|
}
|
|
24
24
|
getTransaction(hash) {
|
|
25
25
|
var _a, _b;
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
try {
|
|
28
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
28
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
29
29
|
const response = yield rpcClient.getRawTransaction(hash, true);
|
|
30
30
|
return {
|
|
31
31
|
hash: response.hash,
|
|
32
32
|
block: response.validuntilblock,
|
|
33
33
|
fee: neon_core_1.u.BigInteger.fromNumber((_a = response.netfee) !== null && _a !== void 0 ? _a : 0)
|
|
34
34
|
.add(neon_core_1.u.BigInteger.fromNumber((_b = response.sysfee) !== null && _b !== void 0 ? _b : 0))
|
|
35
|
-
.toDecimal(this.
|
|
35
|
+
.toDecimal(this._feeToken.decimals),
|
|
36
36
|
notifications: [],
|
|
37
37
|
transfers: [],
|
|
38
38
|
time: response.blocktime,
|
|
@@ -51,7 +51,7 @@ class RPCBDSNeo3 {
|
|
|
51
51
|
getContract(contractHash) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
try {
|
|
54
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
54
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
55
55
|
const contractState = yield rpcClient.getContractState(contractHash);
|
|
56
56
|
const methods = contractState.manifest.abi.methods.map(method => ({
|
|
57
57
|
name: method.name,
|
|
@@ -73,17 +73,17 @@ class RPCBDSNeo3 {
|
|
|
73
73
|
}
|
|
74
74
|
getTokenInfo(tokenHash) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const localToken = constants_1.TOKENS[this.
|
|
76
|
+
const localToken = constants_1.TOKENS[this._network.type].find(token => token.hash === tokenHash);
|
|
77
77
|
if (localToken)
|
|
78
78
|
return localToken;
|
|
79
|
-
if (this.
|
|
80
|
-
return this.
|
|
79
|
+
if (this._tokenCache.has(tokenHash)) {
|
|
80
|
+
return this._tokenCache.get(tokenHash);
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
83
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
83
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
84
84
|
const contractState = yield rpcClient.getContractState(tokenHash);
|
|
85
|
-
const invoker = yield
|
|
86
|
-
rpcAddress: this.
|
|
85
|
+
const invoker = yield neon_dappkit_1.NeonInvoker.init({
|
|
86
|
+
rpcAddress: this._network.url,
|
|
87
87
|
});
|
|
88
88
|
const response = yield invoker.testInvoke({
|
|
89
89
|
invocations: [
|
|
@@ -95,6 +95,10 @@ class RPCBDSNeo3 {
|
|
|
95
95
|
{ scriptHash: tokenHash, operation: 'symbol', args: [] },
|
|
96
96
|
],
|
|
97
97
|
});
|
|
98
|
+
if (!neon_dappkit_1.TypeChecker.isStackTypeInteger(response.stack[0]))
|
|
99
|
+
throw new Error('Invalid decimals');
|
|
100
|
+
if (!neon_dappkit_1.TypeChecker.isStackTypeByteString(response.stack[1]))
|
|
101
|
+
throw new Error('Invalid symbol');
|
|
98
102
|
const decimals = Number(response.stack[0].value);
|
|
99
103
|
const symbol = neon_core_1.u.base642utf8(response.stack[1].value);
|
|
100
104
|
const token = {
|
|
@@ -103,7 +107,7 @@ class RPCBDSNeo3 {
|
|
|
103
107
|
hash: contractState.hash,
|
|
104
108
|
decimals,
|
|
105
109
|
};
|
|
106
|
-
this.
|
|
110
|
+
this._tokenCache.set(tokenHash, token);
|
|
107
111
|
return token;
|
|
108
112
|
}
|
|
109
113
|
catch (_a) {
|
|
@@ -113,7 +117,7 @@ class RPCBDSNeo3 {
|
|
|
113
117
|
}
|
|
114
118
|
getBalance(address) {
|
|
115
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
120
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
117
121
|
const response = yield rpcClient.getNep17Balances(address);
|
|
118
122
|
const promises = response.balance.map((balance) => __awaiter(this, void 0, void 0, function* () {
|
|
119
123
|
var _a;
|
|
@@ -140,15 +144,15 @@ class RPCBDSNeo3 {
|
|
|
140
144
|
}
|
|
141
145
|
getBlockHeight() {
|
|
142
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
147
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
144
148
|
return yield rpcClient.getBlockCount();
|
|
145
149
|
});
|
|
146
150
|
}
|
|
147
151
|
getUnclaimed(address) {
|
|
148
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const rpcClient = new neon_core_1.rpc.RPCClient(this.
|
|
153
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
150
154
|
const response = yield rpcClient.getUnclaimedGas(address);
|
|
151
|
-
return neon_core_1.u.BigInteger.fromNumber(response).toDecimal(this.
|
|
155
|
+
return neon_core_1.u.BigInteger.fromNumber(response).toDecimal(this._claimToken.decimals);
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
7
7
|
"author": "Coz",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"files": [
|
|
10
|
+
"/dist"
|
|
11
|
+
],
|
|
9
12
|
"dependencies": {
|
|
10
|
-
"@cityofzion/neon-js": "5.
|
|
11
|
-
"@cityofzion/neon-core": "5.
|
|
12
|
-
"@cityofzion/neon-invoker": "1.6.0",
|
|
13
|
-
"@cityofzion/neo3-invoker": "1.6.0",
|
|
14
|
-
"@cityofzion/neon-parser": "1.6.2",
|
|
15
|
-
"@cityofzion/neo3-parser": "1.6.0",
|
|
13
|
+
"@cityofzion/neon-js": "5.5.1",
|
|
14
|
+
"@cityofzion/neon-core": "5.5.1",
|
|
16
15
|
"@cityofzion/dora-ts": "0.0.11",
|
|
17
16
|
"axios": "1.5.1",
|
|
18
17
|
"query-string": "7.1.3",
|
|
19
|
-
"@
|
|
20
|
-
"@cityofzion/
|
|
18
|
+
"@ledgerhq/hw-transport": "~6.30.5",
|
|
19
|
+
"@cityofzion/neon-dappkit": "0.4.1",
|
|
20
|
+
"@cityofzion/neon-dappkit-types": "~0.3.1",
|
|
21
|
+
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|
|
22
|
+
"@cityofzion/blockchain-service": "0.11.0",
|
|
23
|
+
"@cityofzion/bs-asteroid-sdk": "0.8.0"
|
|
21
24
|
},
|
|
22
25
|
"devDependencies": {
|
|
23
26
|
"@types/jest": "29.5.3",
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
3
|
-
parser: '@typescript-eslint/parser',
|
|
4
|
-
plugins: ['@typescript-eslint'],
|
|
5
|
-
parserOptions: {
|
|
6
|
-
parser: '@typescript-eslint/parser',
|
|
7
|
-
},
|
|
8
|
-
root: true,
|
|
9
|
-
rules: {
|
|
10
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
11
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
12
|
-
'@typescript-eslint/no-unused-vars': [
|
|
13
|
-
'error',
|
|
14
|
-
{
|
|
15
|
-
varsIgnorePattern: '^_',
|
|
16
|
-
argsIgnorePattern: '^_',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
20
|
-
'no-unused-vars': 'off',
|
|
21
|
-
},
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Invoking: tsc --project tsconfig.build.json
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"packages/bs-neo3/.eslintignore": "3ee402c88b68258919e4f4b4eef4f25e5d078d90",
|
|
4
|
-
"packages/bs-neo3/.eslintrc.cjs": "5ec0bf6332ec01b3e02beb532bb47025c4c1bf7b",
|
|
5
|
-
"packages/bs-neo3/CHANGELOG.json": "fe967428d8fb2326ccc4371d53cabdd9c68d31fe",
|
|
6
|
-
"packages/bs-neo3/CHANGELOG.md": "7416e2621144cbf7dd6acf3cfa2c4c7db100099b",
|
|
7
|
-
"packages/bs-neo3/jest.config.ts": "d944475db93cbe41a9339187fd94b9962e411c43",
|
|
8
|
-
"packages/bs-neo3/jest.setup.ts": "9a1976a32050616d4d2ee95b1aa21041bc4daca3",
|
|
9
|
-
"packages/bs-neo3/package.json": "e2fc69e335ba275a7b37d19750e934dc8cd9179a",
|
|
10
|
-
"packages/bs-neo3/src/BSNeo3.ts": "0d19be834f0739e2b57e73e74c517d624f9508bb",
|
|
11
|
-
"packages/bs-neo3/src/DoraBDSNeo3.ts": "35c2e26cc2c19e41c4dceb226e00238bdca45c87",
|
|
12
|
-
"packages/bs-neo3/src/DoraESNeo3.ts": "c3d36ee5c38cda45c08f517c49976af6d69c5711",
|
|
13
|
-
"packages/bs-neo3/src/FlamingoEDSNeo3.ts": "2a67c9716bc005210dbb9c0e5208a7576af44686",
|
|
14
|
-
"packages/bs-neo3/src/GhostMarketNDSNeo3.ts": "fb7109adfc16c652c56fa06ee14bbd58b9b61ceb",
|
|
15
|
-
"packages/bs-neo3/src/RpcBDSNeo3.ts": "7ff90a9ee86468a854def2779ed1e99a5b4517de",
|
|
16
|
-
"packages/bs-neo3/src/__tests__/BDSNeo3.spec.ts": "5dc529cc41f64df6b603821c48fae282fed99220",
|
|
17
|
-
"packages/bs-neo3/src/__tests__/BSNeo3.spec.ts": "02e8c195cf4ab73eb6ae49e330f411e74746533f",
|
|
18
|
-
"packages/bs-neo3/src/__tests__/DoraESNeo3.spec.ts": "450e087014c22b1a289e64dd80ff3e6ddfd8c932",
|
|
19
|
-
"packages/bs-neo3/src/__tests__/FlamingoEDSNeo3.spec.ts": "473b1aafe03031a28a8414dfa681b06f843acdf6",
|
|
20
|
-
"packages/bs-neo3/src/__tests__/GhostMarketNDSNeo3.spec.ts": "c1e835ab5016e8b8d7b3747cc0ed752093dbb967",
|
|
21
|
-
"packages/bs-neo3/src/__tests__/utils/sleep.ts": "c1eb515dad9f5c11eef5d5e77c85db4c3c8196a8",
|
|
22
|
-
"packages/bs-neo3/src/assets/tokens/common.json": "5fad5e8ad81723783ae4e594ff80614908081efd",
|
|
23
|
-
"packages/bs-neo3/src/assets/tokens/mainnet.json": "5aa5b375c4fe2537fec71389746cf906a4afebf5",
|
|
24
|
-
"packages/bs-neo3/src/constants.ts": "233a2c83f1829629865ace6fbf9c66cd39489c51",
|
|
25
|
-
"packages/bs-neo3/src/index.ts": "bad314a9ba14b57075684c9b823a934863bac6b2",
|
|
26
|
-
"packages/bs-neo3/tsconfig.build.json": "4dc23fb9c4c5e4d19a9bc3947a47c523f4bd967c",
|
|
27
|
-
"packages/bs-neo3/tsconfig.json": "77cf2b789e9c665b62792f9992cc81ae86296ef7",
|
|
28
|
-
"packages/bs-neo3/.rush/temp/shrinkwrap-deps.json": "810e2df700cbea7151155fd9f9921531111a73e8"
|
|
29
|
-
},
|
|
30
|
-
"arguments": "tsc --project tsconfig.build.json "
|
|
31
|
-
}
|