@cityofzion/blockchain-service 1.22.2 → 1.22.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.
@@ -1,23 +1,23 @@
1
1
  import { TBSAccount, IBlockchainService, IBSWithClaim, IBSWithEncryption, IBSWithExplorer, IBSWithFee, IBSWithLedger, IBSWithNameService, IBSWithNeo3NeoXBridge, IBSWithNft, TUntilIndexRecord, IBSWithWalletConnect } from './interfaces';
2
- export declare function hasNameService<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithNameService;
3
- export declare function isClaimable<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithClaim<BSName>;
4
- export declare function isCalculableFee<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithFee<BSName>;
5
- export declare function hasNft<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithNft;
6
- export declare function hasExplorerService<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithExplorer;
7
- export declare function hasLedger<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithLedger<BSName>;
8
- export declare function hasNeo3NeoXBridge<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithNeo3NeoXBridge<BSName>;
9
- export declare function hasEncryption<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithEncryption<BSName>;
10
- export declare function hasWalletConnect<BSName extends string = string>(service: IBlockchainService<BSName>): service is IBlockchainService<BSName> & IBSWithWalletConnect;
2
+ export declare function hasNameService<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithNameService;
3
+ export declare function isClaimable<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithClaim<N>;
4
+ export declare function isCalculableFee<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithFee<N>;
5
+ export declare function hasNft<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithNft;
6
+ export declare function hasExplorerService<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithExplorer;
7
+ export declare function hasLedger<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithLedger<N>;
8
+ export declare function hasNeo3NeoXBridge<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithNeo3NeoXBridge<N>;
9
+ export declare function hasEncryption<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithEncryption<N>;
10
+ export declare function hasWalletConnect<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithWalletConnect;
11
11
  /**
12
12
  * @deprecated use `waitForAccountTransaction` instead
13
13
  */
14
- export declare function waitForTransaction<BSName extends string = string>(service: IBlockchainService<BSName>, txId: string): Promise<boolean>;
15
- export declare function waitForAccountTransaction<BSName extends string = string>(params: {
16
- service: IBlockchainService<BSName>;
14
+ export declare function waitForTransaction<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>, txId: string): Promise<boolean>;
15
+ export declare function waitForAccountTransaction<N extends string = string, A extends string = string>(params: {
16
+ service: IBlockchainService<N, A>;
17
17
  txId: string;
18
18
  address: string;
19
19
  maxAttempts?: number;
20
20
  }): Promise<boolean>;
21
- export declare function fetchAccounts<BSName extends string = string>(service: IBlockchainService<BSName>, initialIndex: number, getAccountCallback: (service: IBlockchainService<BSName>, index: number) => Promise<TBSAccount<BSName>>): Promise<TBSAccount<BSName>[]>;
22
- export declare function generateAccount<BSName extends string = string>(service: IBlockchainService<BSName>, initialIndex: number, untilIndex: number, getAccountCallback: (service: IBlockchainService<BSName>, index: number) => Promise<TBSAccount<BSName>>): Promise<TBSAccount<BSName>[]>;
23
- export declare function generateAccountForBlockchainService<BSName extends string = string>(services: IBlockchainService<BSName>[], getAccountCallback: (service: IBlockchainService<BSName>, index: number) => Promise<TBSAccount<BSName>>, untilIndexByBlockchainService?: TUntilIndexRecord<BSName>): Promise<Map<BSName, TBSAccount<BSName>[]>>;
21
+ export declare function fetchAccounts<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>, initialIndex: number, getAccountCallback: (service: IBlockchainService<N, A>, index: number) => Promise<TBSAccount<N>>): Promise<TBSAccount<N>[]>;
22
+ export declare function generateAccount<N extends string = string, A extends string = string>(service: IBlockchainService<N, A>, initialIndex: number, untilIndex: number, getAccountCallback: (service: IBlockchainService<N, A>, index: number) => Promise<TBSAccount<N>>): Promise<TBSAccount<N>[]>;
23
+ export declare function generateAccountForBlockchainService<N extends string = string, A extends string = string>(services: IBlockchainService<N, A>[], getAccountCallback: (service: IBlockchainService<N, A>, index: number) => Promise<TBSAccount<N>>, untilIndexByBlockchainService?: TUntilIndexRecord<N>): Promise<Map<N, TBSAccount<N>[]>>;
@@ -272,6 +272,7 @@ export interface IExchangeDataService {
272
272
  }
273
273
  export type TNftResponse = {
274
274
  hash: string;
275
+ explorerUri?: string;
275
276
  collection: {
276
277
  name?: string;
277
278
  image?: string;
@@ -1,7 +1,9 @@
1
- import { TGetNftParam, TGetNftsByAddressParams, THasTokenParam, INftDataService, TNftResponse, TNftsResponse } from '../../interfaces';
2
- export declare abstract class GhostMarketNDS implements INftDataService {
1
+ import { TGetNftParam, TGetNftsByAddressParams, THasTokenParam, INftDataService, TNftResponse, TNftsResponse, type IBlockchainService } from '../../interfaces';
2
+ export declare abstract class GhostMarketNDS<N extends string, A extends string, T extends IBlockchainService<N, A>> implements INftDataService {
3
3
  #private;
4
4
  static readonly BASE_URL: string;
5
+ _service: T;
6
+ constructor(service: T);
5
7
  getNftsByAddress({ address, size, cursor }: TGetNftsByAddressParams): Promise<TNftsResponse>;
6
8
  getNft({ collectionHash, tokenHash }: TGetNftParam): Promise<TNftResponse>;
7
9
  abstract hasToken({ collectionHash, address }: THasTokenParam): Promise<boolean>;
@@ -21,9 +21,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.GhostMarketNDS = void 0;
22
22
  const axios_1 = __importDefault(require("axios"));
23
23
  const query_string_1 = __importDefault(require("query-string"));
24
+ const functions_1 = require("../../functions");
24
25
  class GhostMarketNDS {
25
- constructor() {
26
+ constructor(service) {
26
27
  _GhostMarketNDS_instances.add(this);
28
+ this._service = service;
27
29
  }
28
30
  getNftsByAddress(_b) {
29
31
  return __awaiter(this, arguments, void 0, function* ({ address, size = 18, cursor }) {
@@ -68,6 +70,18 @@ _a = GhostMarketNDS, _GhostMarketNDS_instances = new WeakSet(), _GhostMarketNDS_
68
70
  return `${_a.BASE_URL}/assets?${parameters}`;
69
71
  }, _GhostMarketNDS_parse = function _GhostMarketNDS_parse(data) {
70
72
  var _b, _c;
73
+ let explorerUri;
74
+ if ((0, functions_1.hasExplorerService)(this._service)) {
75
+ try {
76
+ explorerUri = this._service.explorerService.buildNftUrl({
77
+ tokenHash: data.tokenId,
78
+ collectionHash: data.contract.hash,
79
+ });
80
+ }
81
+ catch (_d) {
82
+ /* empty */
83
+ }
84
+ }
71
85
  const nftResponse = {
72
86
  hash: data.tokenId,
73
87
  collection: {
@@ -79,6 +93,7 @@ _a = GhostMarketNDS, _GhostMarketNDS_instances = new WeakSet(), _GhostMarketNDS_
79
93
  image: __classPrivateFieldGet(this, _GhostMarketNDS_instances, "m", _GhostMarketNDS_treatGhostMarketImage).call(this, data.metadata.mediaUri),
80
94
  isSVG: String(data.metadata.mediaType).includes('svg+xml'),
81
95
  name: data.metadata.name,
96
+ explorerUri,
82
97
  creator: {
83
98
  address: data.creator.address,
84
99
  name: data.creator.offchainName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "1.22.2",
3
+ "version": "1.22.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",