@cityofzion/bs-neo3 0.7.2 → 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.
@@ -2,14 +2,16 @@
2
2
  "files": {
3
3
  "packages/bs-neo3/jest.config.ts": "d944475db93cbe41a9339187fd94b9962e411c43",
4
4
  "packages/bs-neo3/jest.setup.ts": "9a1976a32050616d4d2ee95b1aa21041bc4daca3",
5
- "packages/bs-neo3/package.json": "bba7849ac64221394efc7a7b35a9ad6ac81a7c08",
6
- "packages/bs-neo3/src/BSNeo3.ts": "ac98a87cfd542ac1fdd1b2166ba2acb78a274126",
5
+ "packages/bs-neo3/package.json": "a563fa511a93c51642ebb4cd0ce2e6ed62f2c95a",
6
+ "packages/bs-neo3/src/BSNeo3.ts": "ac017ee69800b8bf170face0e9e38bb72d8ad2a3",
7
7
  "packages/bs-neo3/src/DoraBDSNeo3.ts": "f94ef94afe666bc0991f5dd8e880d8fec8ade099",
8
+ "packages/bs-neo3/src/DoraESNeo3.ts": "c3d36ee5c38cda45c08f517c49976af6d69c5711",
8
9
  "packages/bs-neo3/src/FlamingoEDSNeo3.ts": "f5fbb9ff405b02079c31493ae251aaea5defb77d",
9
10
  "packages/bs-neo3/src/GhostMarketNDSNeo3.ts": "d7db2a624cf099fe550fa4a906f6127ca4815cac",
10
- "packages/bs-neo3/src/RpcBDSNeo3.ts": "a548f689b39b42ce00452b1fb8f772b6ebbf7683",
11
+ "packages/bs-neo3/src/RpcBDSNeo3.ts": "11a7425844ab09a11c631281e103d1edeab4a63f",
11
12
  "packages/bs-neo3/src/__tests__/BDSNeo3.spec.ts": "14bd204f3d4546c81b6ea37e16f3fe6e70102dd1",
12
13
  "packages/bs-neo3/src/__tests__/BSNeo3.spec.ts": "edf56afc2efaa15d252eaaca0325cee364191699",
14
+ "packages/bs-neo3/src/__tests__/DoraESNeo3.spec.ts": "450e087014c22b1a289e64dd80ff3e6ddfd8c932",
13
15
  "packages/bs-neo3/src/__tests__/FlamingoEDSNeo3.spec.ts": "17e3b6f4dee4cb2222f3b4b1aed9d9a68ea037c0",
14
16
  "packages/bs-neo3/src/__tests__/GhostMarketNDSNeo3.spec.ts": "1d583380b60112fb99426b4bf140c92898177b1e",
15
17
  "packages/bs-neo3/src/__tests__/utils/sleep.ts": "c1eb515dad9f5c11eef5d5e77c85db4c3c8196a8",
package/dist/BSNeo3.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BlockchainDataService, BlockchainService, BSClaimable, Account, ExchangeDataService, BDSClaimable, Token, BSWithNameService, Network, PartialBy, TransferParam, BSCalculableFee, NftDataService, BSWithNft, AccountWithDerivationPath } from '@cityofzion/blockchain-service';
2
- export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft {
1
+ import { BlockchainDataService, BlockchainService, BSClaimable, Account, ExchangeDataService, BDSClaimable, Token, BSWithNameService, Network, PartialBy, TransferParam, BSCalculableFee, NftDataService, BSWithNft, AccountWithDerivationPath, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
2
+ export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft, BSWithExplorerService {
3
3
  readonly blockchainName: BSCustomName;
4
4
  readonly feeToken: Token;
5
5
  readonly claimToken: Token;
@@ -8,6 +8,7 @@ export declare class BSNeo3<BSCustomName extends string = string> implements Blo
8
8
  blockchainDataService: BlockchainDataService & BDSClaimable;
9
9
  nftDataService: NftDataService;
10
10
  exchangeDataService: ExchangeDataService;
11
+ explorerService: ExplorerService;
11
12
  tokens: Token[];
12
13
  network: Network;
13
14
  constructor(blockchainName: BSCustomName, network: PartialBy<Network, 'url'>);
package/dist/BSNeo3.js CHANGED
@@ -20,6 +20,7 @@ const constants_1 = require("./constants");
20
20
  const FlamingoEDSNeo3_1 = require("./FlamingoEDSNeo3");
21
21
  const GhostMarketNDSNeo3_1 = require("./GhostMarketNDSNeo3");
22
22
  const bs_asteroid_sdk_1 = require("@cityofzion/bs-asteroid-sdk");
23
+ const DoraESNeo3_1 = require("./DoraESNeo3");
23
24
  class BSNeo3 {
24
25
  constructor(blockchainName, network) {
25
26
  this.blockchainName = blockchainName;
@@ -45,6 +46,7 @@ class BSNeo3 {
45
46
  }
46
47
  this.exchangeDataService = new FlamingoEDSNeo3_1.FlamingoEDSNeo3(network.type);
47
48
  this.nftDataService = new GhostMarketNDSNeo3_1.GhostMarketNDSNeo3(network.type);
49
+ this.explorerService = new DoraESNeo3_1.DoraESNeo3(network.type);
48
50
  }
49
51
  validateAddress(address) {
50
52
  return neon_js_1.wallet.isAddress(address, 53);
@@ -0,0 +1,7 @@
1
+ import { ExplorerService, NetworkType, BuildNftUrlParams } from '@cityofzion/blockchain-service';
2
+ export declare class DoraESNeo3 implements ExplorerService {
3
+ private networkType;
4
+ constructor(networkType: NetworkType);
5
+ buildTransactionUrl(hash: string): string;
6
+ buildNftUrl({ contractHash, tokenId }: BuildNftUrlParams): string;
7
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DoraESNeo3 = void 0;
4
+ class DoraESNeo3 {
5
+ constructor(networkType) {
6
+ this.networkType = networkType;
7
+ }
8
+ buildTransactionUrl(hash) {
9
+ if (this.networkType === 'custom')
10
+ throw new Error('DoraESNeo3 does not support custom network');
11
+ return `https://dora.coz.io/transaction/neo3/${this.networkType}/${hash}`;
12
+ }
13
+ buildNftUrl({ contractHash, tokenId }) {
14
+ if (this.networkType === 'custom')
15
+ throw new Error('DoraESNeo3 does not support custom network');
16
+ return `https://dora.coz.io/nft/neo3/${this.networkType}/${contractHash}/${tokenId}`;
17
+ }
18
+ }
19
+ exports.DoraESNeo3 = DoraESNeo3;
@@ -4,6 +4,7 @@ export declare class RPCBDSNeo3 implements BlockchainDataService, BDSClaimable {
4
4
  protected readonly feeToken: Token;
5
5
  protected readonly claimToken: Token;
6
6
  readonly network: Network;
7
+ maxTimeToConfirmTransactionInMs: number;
7
8
  constructor(network: Network, feeToken: Token, claimToken: Token);
8
9
  getTransaction(hash: string): Promise<TransactionResponse>;
9
10
  getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
@@ -16,6 +16,7 @@ const constants_1 = require("./constants");
16
16
  class RPCBDSNeo3 {
17
17
  constructor(network, feeToken, claimToken) {
18
18
  this.tokenCache = new Map();
19
+ this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 2;
19
20
  this.network = network;
20
21
  this.feeToken = feeToken;
21
22
  this.claimToken = claimToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neo3",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -17,8 +17,8 @@
17
17
  "@cityofzion/neo3-invoker": "1.6.0",
18
18
  "@cityofzion/neon-parser": "1.6.2",
19
19
  "@cityofzion/neo3-parser": "1.6.0",
20
- "@cityofzion/blockchain-service": "0.7.2",
21
- "@cityofzion/bs-asteroid-sdk": "0.7.2",
20
+ "@cityofzion/blockchain-service": "0.7.3",
21
+ "@cityofzion/bs-asteroid-sdk": "0.7.3",
22
22
  "@cityofzion/dora-ts": "0.0.11",
23
23
  "query-string": "7.1.3"
24
24
  },
package/src/BSNeo3.ts CHANGED
@@ -14,6 +14,8 @@ import {
14
14
  NftDataService,
15
15
  BSWithNft,
16
16
  AccountWithDerivationPath,
17
+ BSWithExplorerService,
18
+ ExplorerService,
17
19
  } from '@cityofzion/blockchain-service'
18
20
  import { api, u, wallet } from '@cityofzion/neon-js'
19
21
  import Neon from '@cityofzion/neon-core'
@@ -28,9 +30,10 @@ import { DEFAULT_URL_BY_NETWORK_TYPE, DERIVATION_PATH, NEO_NS_HASH, TOKENS } fro
28
30
  import { FlamingoEDSNeo3 } from './FlamingoEDSNeo3'
29
31
  import { GhostMarketNDSNeo3 } from './GhostMarketNDSNeo3'
30
32
  import { keychain } from '@cityofzion/bs-asteroid-sdk'
33
+ import { DoraESNeo3 } from './DoraESNeo3'
31
34
 
32
35
  export class BSNeo3<BSCustomName extends string = string>
33
- implements BlockchainService, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft
36
+ implements BlockchainService, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft, BSWithExplorerService
34
37
  {
35
38
  readonly blockchainName: BSCustomName
36
39
  readonly feeToken: Token
@@ -41,6 +44,7 @@ export class BSNeo3<BSCustomName extends string = string>
41
44
  blockchainDataService!: BlockchainDataService & BDSClaimable
42
45
  nftDataService!: NftDataService
43
46
  exchangeDataService!: ExchangeDataService
47
+ explorerService!: ExplorerService
44
48
  tokens: Token[]
45
49
  network!: Network
46
50
 
@@ -70,6 +74,7 @@ export class BSNeo3<BSCustomName extends string = string>
70
74
 
71
75
  this.exchangeDataService = new FlamingoEDSNeo3(network.type)
72
76
  this.nftDataService = new GhostMarketNDSNeo3(network.type)
77
+ this.explorerService = new DoraESNeo3(network.type)
73
78
  }
74
79
 
75
80
  validateAddress(address: string): boolean {
@@ -0,0 +1,19 @@
1
+ import { ExplorerService, NetworkType, BuildNftUrlParams } from '@cityofzion/blockchain-service'
2
+
3
+ export class DoraESNeo3 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('DoraESNeo3 does not support custom network')
12
+ return `https://dora.coz.io/transaction/neo3/${this.networkType}/${hash}`
13
+ }
14
+
15
+ buildNftUrl({ contractHash, tokenId }: BuildNftUrlParams): string {
16
+ if (this.networkType === 'custom') throw new Error('DoraESNeo3 does not support custom network')
17
+ return `https://dora.coz.io/nft/neo3/${this.networkType}/${contractHash}/${tokenId}`
18
+ }
19
+ }
package/src/RpcBDSNeo3.ts CHANGED
@@ -21,6 +21,8 @@ export class RPCBDSNeo3 implements BlockchainDataService, BDSClaimable {
21
21
  protected readonly claimToken: Token
22
22
  readonly network: Network
23
23
 
24
+ maxTimeToConfirmTransactionInMs: number = 1000 * 60 * 2
25
+
24
26
  constructor(network: Network, feeToken: Token, claimToken: Token) {
25
27
  this.network = network
26
28
  this.feeToken = feeToken
@@ -0,0 +1,23 @@
1
+ import { DoraESNeo3 } from '../DoraESNeo3'
2
+
3
+ let doraESNeo3: DoraESNeo3
4
+
5
+ describe('DoraESNeo3', () => {
6
+ beforeAll(() => {
7
+ doraESNeo3 = new DoraESNeo3('mainnet')
8
+ })
9
+ it('Should return a transaction url', async () => {
10
+ const hash = '0x775d824a54d4e9bebf3c522a7d8dede550348323d833ce68fbcf0ab953d579e8'
11
+ const url = doraESNeo3.buildTransactionUrl(hash)
12
+
13
+ expect(url).toEqual(`https://dora.coz.io/transaction/neo3/mainnet/${hash}`)
14
+ })
15
+
16
+ it('Should return a nft url', async () => {
17
+ const contractHash = '0x577a51f7d39162c9de1db12a6b319c848e4c54e5'
18
+ const tokenId = 'rAI='
19
+ const url = doraESNeo3.buildNftUrl({ contractHash, tokenId })
20
+
21
+ expect(url).toEqual(`https://dora.coz.io/nft/neo3/mainnet/${contractHash}/${tokenId}`)
22
+ })
23
+ })