@cityofzion/bs-neo-legacy 0.7.1 → 0.7.3
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/.rush/temp/package-deps_build.json +6 -4
- package/dist/BSNeoLegacy.d.ts +3 -2
- package/dist/BSNeoLegacy.js +2 -0
- package/dist/DoraBDSNeoLegacy.d.ts +1 -0
- package/dist/DoraBDSNeoLegacy.js +2 -1
- package/dist/DoraESNeoLegacy.d.ts +7 -0
- package/dist/DoraESNeoLegacy.js +17 -0
- package/package.json +3 -3
- package/src/BSNeoLegacy.ts +8 -1
- package/src/DoraBDSNeoLegacy.ts +3 -1
- package/src/DoraESNeoLegacy.ts +18 -0
- package/src/__tests__/DoraESNeoLegacy.spec.ts +15 -0
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
"files": {
|
|
3
3
|
"packages/bs-neo-legacy/jest.config.ts": "d944475db93cbe41a9339187fd94b9962e411c43",
|
|
4
4
|
"packages/bs-neo-legacy/jest.setup.ts": "9a1976a32050616d4d2ee95b1aa21041bc4daca3",
|
|
5
|
-
"packages/bs-neo-legacy/package.json": "
|
|
6
|
-
"packages/bs-neo-legacy/src/BSNeoLegacy.ts": "
|
|
5
|
+
"packages/bs-neo-legacy/package.json": "57ed9f1a5153294355f8e9a47a53f57aec20b5c2",
|
|
6
|
+
"packages/bs-neo-legacy/src/BSNeoLegacy.ts": "92e664e23d0d1bb757b901a66d6d33650c490faf",
|
|
7
7
|
"packages/bs-neo-legacy/src/CryptoCompareEDSNeoLegacy.ts": "7cbe7bf0e39f100edd329a9211006c3c1994a1c2",
|
|
8
|
-
"packages/bs-neo-legacy/src/DoraBDSNeoLegacy.ts": "
|
|
8
|
+
"packages/bs-neo-legacy/src/DoraBDSNeoLegacy.ts": "022c8627f74e635025cfe0035e6ef259ddc4dd6a",
|
|
9
|
+
"packages/bs-neo-legacy/src/DoraESNeoLegacy.ts": "e12df08893ac0bb0f0daecf2b61a96d9c7532bf4",
|
|
9
10
|
"packages/bs-neo-legacy/src/__tests__/BDSNeoLegacy.spec.ts": "04210ed3cc8b8afbc824417be87eac06d1f875fd",
|
|
10
11
|
"packages/bs-neo-legacy/src/__tests__/BSNeoLegacy.spec.ts": "b2cff48a43db986fc02fdefbfd66a5cd4d70a5d9",
|
|
11
12
|
"packages/bs-neo-legacy/src/__tests__/CryptoCompareExchange.spec.ts": "0aeb2e77cf1d3eabc7534d2b9cbc26e93240852d",
|
|
13
|
+
"packages/bs-neo-legacy/src/__tests__/DoraESNeoLegacy.spec.ts": "4ea3298204b96536f3e143e29e1ba6f94ce90b31",
|
|
12
14
|
"packages/bs-neo-legacy/src/assets/tokens/common.json": "81b0a9bb3e6c1b5bb41f57e6b1fc403ce1ac1489",
|
|
13
15
|
"packages/bs-neo-legacy/src/assets/tokens/mainnet.json": "e1194b98d7a91a8494760d597a90c02e00880972",
|
|
14
16
|
"packages/bs-neo-legacy/src/constants.ts": "82e36146cf6cf3c16bc7b7ec4fd3e4089c745bd5",
|
|
15
17
|
"packages/bs-neo-legacy/src/index.ts": "247e7d072502350e685e11497aeedc89b7c921d5",
|
|
16
18
|
"packages/bs-neo-legacy/tsconfig.build.json": "4dc23fb9c4c5e4d19a9bc3947a47c523f4bd967c",
|
|
17
19
|
"packages/bs-neo-legacy/tsconfig.json": "77cf2b789e9c665b62792f9992cc81ae86296ef7",
|
|
18
|
-
"common/config/rush/npm-shrinkwrap.json": "
|
|
20
|
+
"common/config/rush/npm-shrinkwrap.json": "c7f58d681afa54f5c08d809a1ace9947b56fb633"
|
|
19
21
|
},
|
|
20
22
|
"arguments": "tsc --project tsconfig.build.json "
|
|
21
23
|
}
|
package/dist/BSNeoLegacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, PartialBy, TransferParam, AccountWithDerivationPath } from '@cityofzion/blockchain-service';
|
|
2
|
-
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService, BSClaimable {
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, PartialBy, TransferParam, AccountWithDerivationPath, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService, BSClaimable, BSWithExplorerService {
|
|
3
3
|
readonly blockchainName: BSCustomName;
|
|
4
4
|
readonly feeToken: Token;
|
|
5
5
|
readonly claimToken: Token;
|
|
@@ -7,6 +7,7 @@ export declare class BSNeoLegacy<BSCustomName extends string = string> implement
|
|
|
7
7
|
readonly derivationPath: string;
|
|
8
8
|
blockchainDataService: BlockchainDataService & BDSClaimable;
|
|
9
9
|
exchangeDataService: ExchangeDataService;
|
|
10
|
+
explorerService: ExplorerService;
|
|
10
11
|
tokens: Token[];
|
|
11
12
|
network: Network;
|
|
12
13
|
legacyNetwork: string;
|
package/dist/BSNeoLegacy.js
CHANGED
|
@@ -26,6 +26,7 @@ const constants_1 = require("./constants");
|
|
|
26
26
|
const DoraBDSNeoLegacy_1 = require("./DoraBDSNeoLegacy");
|
|
27
27
|
const CryptoCompareEDSNeoLegacy_1 = require("./CryptoCompareEDSNeoLegacy");
|
|
28
28
|
const bs_asteroid_sdk_1 = require("@cityofzion/bs-asteroid-sdk");
|
|
29
|
+
const DoraESNeoLegacy_1 = require("./DoraESNeoLegacy");
|
|
29
30
|
class BSNeoLegacy {
|
|
30
31
|
constructor(blockchainName, network) {
|
|
31
32
|
if (network.type === 'custom')
|
|
@@ -50,6 +51,7 @@ class BSNeoLegacy {
|
|
|
50
51
|
this.network = network;
|
|
51
52
|
this.blockchainDataService = new DoraBDSNeoLegacy_1.DoraBDSNeoLegacy(network, this.feeToken, this.claimToken);
|
|
52
53
|
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network.type);
|
|
54
|
+
this.explorerService = new DoraESNeoLegacy_1.DoraESNeoLegacy(network.type);
|
|
53
55
|
}
|
|
54
56
|
validateAddress(address) {
|
|
55
57
|
return neon_js_1.wallet.isAddress(address);
|
|
@@ -4,6 +4,7 @@ export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaim
|
|
|
4
4
|
private readonly claimToken;
|
|
5
5
|
private readonly feeToken;
|
|
6
6
|
private readonly tokenCache;
|
|
7
|
+
maxTimeToConfirmTransactionInMs: number;
|
|
7
8
|
constructor(network: Network, feeToken: Token, claimToken: Token);
|
|
8
9
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
9
10
|
getTransactionsByAddress({ address, page, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
package/dist/DoraBDSNeoLegacy.js
CHANGED
|
@@ -16,6 +16,7 @@ const neon_js_1 = require("@cityofzion/neon-js");
|
|
|
16
16
|
class DoraBDSNeoLegacy {
|
|
17
17
|
constructor(network, feeToken, claimToken) {
|
|
18
18
|
this.tokenCache = new Map();
|
|
19
|
+
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 2;
|
|
19
20
|
if (network.type === 'custom')
|
|
20
21
|
throw new Error('Custom network is not supported for NEO Legacy');
|
|
21
22
|
this.network = network;
|
|
@@ -138,7 +139,7 @@ class DoraBDSNeoLegacy {
|
|
|
138
139
|
}
|
|
139
140
|
catch (_a) { }
|
|
140
141
|
return {
|
|
141
|
-
amount:
|
|
142
|
+
amount: Number(balance.balance).toFixed(token.decimals),
|
|
142
143
|
token,
|
|
143
144
|
};
|
|
144
145
|
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuildNftUrlParams, ExplorerService, NetworkType } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare class DoraESNeoLegacy implements ExplorerService {
|
|
3
|
+
private networkType;
|
|
4
|
+
constructor(networkType: NetworkType);
|
|
5
|
+
buildTransactionUrl(hash: string): string;
|
|
6
|
+
buildNftUrl(_params: BuildNftUrlParams): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoraESNeoLegacy = void 0;
|
|
4
|
+
class DoraESNeoLegacy {
|
|
5
|
+
constructor(networkType) {
|
|
6
|
+
this.networkType = networkType;
|
|
7
|
+
}
|
|
8
|
+
buildTransactionUrl(hash) {
|
|
9
|
+
if (this.networkType === 'custom')
|
|
10
|
+
throw new Error('DoraESNeoLegacy does not support custom network');
|
|
11
|
+
return `https://dora.coz.io/transaction/neo2/${this.networkType}/${hash}`;
|
|
12
|
+
}
|
|
13
|
+
buildNftUrl(_params) {
|
|
14
|
+
throw new Error('DoraESNeoLegacy does not support nft');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DoraESNeoLegacy = DoraESNeoLegacy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"test": "jest --config jest.config.ts"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@cityofzion/blockchain-service": "0.7.
|
|
14
|
-
"@cityofzion/bs-asteroid-sdk": "0.7.
|
|
13
|
+
"@cityofzion/blockchain-service": "0.7.3",
|
|
14
|
+
"@cityofzion/bs-asteroid-sdk": "0.7.3",
|
|
15
15
|
"@cityofzion/dora-ts": "0.0.11",
|
|
16
16
|
"@cityofzion/neon-js": "4.8.3"
|
|
17
17
|
},
|
package/src/BSNeoLegacy.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
PartialBy,
|
|
11
11
|
TransferParam,
|
|
12
12
|
AccountWithDerivationPath,
|
|
13
|
+
BSWithExplorerService,
|
|
14
|
+
ExplorerService,
|
|
13
15
|
} from '@cityofzion/blockchain-service'
|
|
14
16
|
import { api, sc, u, wallet } from '@cityofzion/neon-js'
|
|
15
17
|
import {
|
|
@@ -22,8 +24,11 @@ import {
|
|
|
22
24
|
import { DoraBDSNeoLegacy } from './DoraBDSNeoLegacy'
|
|
23
25
|
import { CryptoCompareEDSNeoLegacy } from './CryptoCompareEDSNeoLegacy'
|
|
24
26
|
import { keychain } from '@cityofzion/bs-asteroid-sdk'
|
|
27
|
+
import { DoraESNeoLegacy } from './DoraESNeoLegacy'
|
|
25
28
|
|
|
26
|
-
export class BSNeoLegacy<BSCustomName extends string = string>
|
|
29
|
+
export class BSNeoLegacy<BSCustomName extends string = string>
|
|
30
|
+
implements BlockchainService, BSClaimable, BSWithExplorerService
|
|
31
|
+
{
|
|
27
32
|
readonly blockchainName: BSCustomName
|
|
28
33
|
readonly feeToken: Token
|
|
29
34
|
readonly claimToken: Token
|
|
@@ -32,6 +37,7 @@ export class BSNeoLegacy<BSCustomName extends string = string> implements Blockc
|
|
|
32
37
|
|
|
33
38
|
blockchainDataService!: BlockchainDataService & BDSClaimable
|
|
34
39
|
exchangeDataService!: ExchangeDataService
|
|
40
|
+
explorerService!: ExplorerService
|
|
35
41
|
tokens: Token[]
|
|
36
42
|
network!: Network
|
|
37
43
|
legacyNetwork: string
|
|
@@ -59,6 +65,7 @@ export class BSNeoLegacy<BSCustomName extends string = string> implements Blockc
|
|
|
59
65
|
this.network = network
|
|
60
66
|
this.blockchainDataService = new DoraBDSNeoLegacy(network, this.feeToken, this.claimToken)
|
|
61
67
|
this.exchangeDataService = new CryptoCompareEDSNeoLegacy(network.type)
|
|
68
|
+
this.explorerService = new DoraESNeoLegacy(network.type)
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
validateAddress(address: string): boolean {
|
package/src/DoraBDSNeoLegacy.ts
CHANGED
|
@@ -21,6 +21,8 @@ export class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
|
21
21
|
private readonly feeToken: Token
|
|
22
22
|
private readonly tokenCache: Map<string, Token> = new Map()
|
|
23
23
|
|
|
24
|
+
maxTimeToConfirmTransactionInMs: number = 1000 * 60 * 2
|
|
25
|
+
|
|
24
26
|
constructor(network: Network, feeToken: Token, claimToken: Token) {
|
|
25
27
|
if (network.type === 'custom') throw new Error('Custom network is not supported for NEO Legacy')
|
|
26
28
|
this.network = network
|
|
@@ -149,7 +151,7 @@ export class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
|
149
151
|
} catch {}
|
|
150
152
|
|
|
151
153
|
return {
|
|
152
|
-
amount:
|
|
154
|
+
amount: Number(balance.balance).toFixed(token.decimals),
|
|
153
155
|
token,
|
|
154
156
|
}
|
|
155
157
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BuildNftUrlParams, ExplorerService, NetworkType } from '@cityofzion/blockchain-service'
|
|
2
|
+
|
|
3
|
+
export class DoraESNeoLegacy implements ExplorerService {
|
|
4
|
+
private networkType: NetworkType
|
|
5
|
+
|
|
6
|
+
constructor(networkType: NetworkType) {
|
|
7
|
+
this.networkType = networkType
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
buildTransactionUrl(hash: string): string {
|
|
11
|
+
if (this.networkType === 'custom') throw new Error('DoraESNeoLegacy does not support custom network')
|
|
12
|
+
return `https://dora.coz.io/transaction/neo2/${this.networkType}/${hash}`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
buildNftUrl(_params: BuildNftUrlParams): string {
|
|
16
|
+
throw new Error('DoraESNeoLegacy does not support nft')
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DoraESNeoLegacy } from '../DoraESNeoLegacy'
|
|
2
|
+
|
|
3
|
+
let doraESNeoLegacy: DoraESNeoLegacy
|
|
4
|
+
|
|
5
|
+
describe('doraESNeoLegacy', () => {
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
doraESNeoLegacy = new DoraESNeoLegacy('mainnet')
|
|
8
|
+
})
|
|
9
|
+
it('Should return a transaction url', async () => {
|
|
10
|
+
const hash = '0x0cd2d834d910dcb74c19bbbb1c986a94e292e1160f0d9f138b97ac950a5ac700'
|
|
11
|
+
const url = doraESNeoLegacy.buildTransactionUrl(hash)
|
|
12
|
+
|
|
13
|
+
expect(url).toEqual(`https://dora.coz.io/transaction/neo2/mainnet/${hash}`)
|
|
14
|
+
})
|
|
15
|
+
})
|