@cityofzion/bs-neo3 1.5.0 → 1.6.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 +1 -1
- package/dist/BSNeo3.js +12 -14
- package/package.json +2 -2
package/dist/BSNeo3.d.ts
CHANGED
|
@@ -18,12 +18,12 @@ export declare class BSNeo3<BSCustomName extends string = string> implements Blo
|
|
|
18
18
|
explorerService: ExplorerService;
|
|
19
19
|
network: Network<BSNeo3NetworkId>;
|
|
20
20
|
constructor(blockchainName: BSCustomName, network?: Network<BSNeo3NetworkId>, getLedgerTransport?: GetLedgerTransport);
|
|
21
|
-
clone(): BSNeo3<BSCustomName>;
|
|
22
21
|
generateSigningCallback(account: Account, isLedger?: boolean): Promise<{
|
|
23
22
|
neonJsAccount: Neon.wallet.Account;
|
|
24
23
|
signingCallback: api.SigningFunction;
|
|
25
24
|
}>;
|
|
26
25
|
createSwapService(): SwapService<BSNeo3NetworkId>;
|
|
26
|
+
testNetwork(network: Network<BSNeo3NetworkId>): Promise<void>;
|
|
27
27
|
setNetwork(network: Network<BSNeo3NetworkId>): void;
|
|
28
28
|
validateAddress(address: string): boolean;
|
|
29
29
|
validateEncrypted(encryptedKey: string): boolean;
|
package/dist/BSNeo3.js
CHANGED
|
@@ -33,6 +33,7 @@ const NeonDappKitLedgerServiceNeo3_1 = require("./services/ledger/NeonDappKitLed
|
|
|
33
33
|
const GhostMarketNDSNeo3_1 = require("./services/nft-data/GhostMarketNDSNeo3");
|
|
34
34
|
const FlamingoSwapServiceNeo3_1 = require("./services/swap/FlamingoSwapServiceNeo3");
|
|
35
35
|
const BSNeo3Constants_1 = require("./constants/BSNeo3Constants");
|
|
36
|
+
const RpcBDSNeo3_1 = require("./services/blockchain-data/RpcBDSNeo3");
|
|
36
37
|
class BSNeo3 {
|
|
37
38
|
constructor(blockchainName, network, getLedgerTransport) {
|
|
38
39
|
_BSNeo3_instances.add(this);
|
|
@@ -44,9 +45,6 @@ class BSNeo3 {
|
|
|
44
45
|
this.bip44DerivationPath = BSNeo3Constants_1.BSNeo3Constants.DEFAULT_BIP44_DERIVATION_PATH;
|
|
45
46
|
this.setNetwork(network);
|
|
46
47
|
}
|
|
47
|
-
clone() {
|
|
48
|
-
return new BSNeo3(this.blockchainName, this.network, __classPrivateFieldGet(this, _BSNeo3_getLedgerTransport, "f"));
|
|
49
|
-
}
|
|
50
48
|
generateSigningCallback(account, isLedger) {
|
|
51
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
50
|
const neonJsAccount = new neon_js_1.wallet.Account(account.key);
|
|
@@ -70,6 +68,12 @@ class BSNeo3 {
|
|
|
70
68
|
createSwapService() {
|
|
71
69
|
return new FlamingoSwapServiceNeo3_1.FlamingoSwapServiceNeo3(this.network, this);
|
|
72
70
|
}
|
|
71
|
+
testNetwork(network) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const blockchainDataServiceClone = new RpcBDSNeo3_1.RpcBDSNeo3(network, this.feeToken, this.claimToken, this.tokens);
|
|
74
|
+
yield blockchainDataServiceClone.getBlockHeight();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
73
77
|
setNetwork(network) {
|
|
74
78
|
__classPrivateFieldGet(this, _BSNeo3_instances, "m", _BSNeo3_setTokens).call(this, network);
|
|
75
79
|
this.network = network;
|
|
@@ -88,9 +92,7 @@ class BSNeo3 {
|
|
|
88
92
|
return neon_js_1.wallet.isWIF(key) || neon_js_1.wallet.isPrivateKey(key);
|
|
89
93
|
}
|
|
90
94
|
validateNameServiceDomainFormat(domainName) {
|
|
91
|
-
|
|
92
|
-
return false;
|
|
93
|
-
return true;
|
|
95
|
+
return domainName.endsWith('.neo');
|
|
94
96
|
}
|
|
95
97
|
generateAccountFromMnemonic(mnemonic, index) {
|
|
96
98
|
bs_asteroid_sdk_1.keychain.importMnemonic(Array.isArray(mnemonic) ? mnemonic.join(' ') : mnemonic);
|
|
@@ -125,8 +127,7 @@ class BSNeo3 {
|
|
|
125
127
|
}
|
|
126
128
|
encrypt(key, password) {
|
|
127
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
|
|
129
|
-
return encryptedKey;
|
|
130
|
+
return yield neon_js_1.wallet.encrypt(key, password);
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
calculateTransferFee(param) {
|
|
@@ -164,10 +165,9 @@ class BSNeo3 {
|
|
|
164
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
166
|
const { neonJsAccount, signingCallback } = yield this.generateSigningCallback(account, isLedger);
|
|
166
167
|
const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: this.network.url });
|
|
167
|
-
|
|
168
|
+
return yield facade.claimGas(neonJsAccount, {
|
|
168
169
|
signingCallback: signingCallback,
|
|
169
170
|
});
|
|
170
|
-
return transactionHash;
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
resolveNameServiceDomain(domainName) {
|
|
@@ -190,8 +190,7 @@ class BSNeo3 {
|
|
|
190
190
|
const parsed = parser.parseRpcResponse(response.stack[0], {
|
|
191
191
|
type: 'Hash160',
|
|
192
192
|
});
|
|
193
|
-
|
|
194
|
-
return address;
|
|
193
|
+
return parser.accountInputToAddress(parsed.replace('0x', ''));
|
|
195
194
|
});
|
|
196
195
|
}
|
|
197
196
|
}
|
|
@@ -204,7 +203,7 @@ _BSNeo3_getLedgerTransport = new WeakMap(), _BSNeo3_instances = new WeakSet(), _
|
|
|
204
203
|
this.claimToken = tokens.find(token => token.symbol === 'GAS');
|
|
205
204
|
}, _BSNeo3_buildTransferInvocation = function _BSNeo3_buildTransferInvocation({ intents, tipIntent }, account) {
|
|
206
205
|
const concatIntents = [...intents, ...(tipIntent ? [tipIntent] : [])];
|
|
207
|
-
|
|
206
|
+
return concatIntents.map(intent => {
|
|
208
207
|
return {
|
|
209
208
|
operation: 'transfer',
|
|
210
209
|
scriptHash: intent.tokenHash,
|
|
@@ -221,5 +220,4 @@ _BSNeo3_getLedgerTransport = new WeakMap(), _BSNeo3_instances = new WeakSet(), _
|
|
|
221
220
|
],
|
|
222
221
|
};
|
|
223
222
|
});
|
|
224
|
-
return invocations;
|
|
225
223
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"bignumber.js": "^9.1.2",
|
|
21
21
|
"isomorphic-ws": "^5.0.0",
|
|
22
22
|
"lodash.clonedeep": "^4.5.0",
|
|
23
|
-
"@cityofzion/blockchain-service": "1.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.6.0",
|
|
24
24
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|