@cityofzion/bs-ethereum 3.1.9 → 3.1.10
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/BSEthereum.js +2 -2
- package/dist/constants/BSEthereumConstants.d.ts +1 -0
- package/dist/constants/BSEthereumConstants.js +8 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/services/blockchain-data/MoralisBDSEthereum.d.ts +0 -1
- package/dist/services/blockchain-data/MoralisBDSEthereum.js +2 -9
- package/dist/services/nft-data/MoralisNDSEthereum.d.ts +12 -0
- package/dist/services/nft-data/MoralisNDSEthereum.js +123 -0
- package/dist/types.d.ts +91 -0
- package/package.json +3 -3
- package/dist/assets/abis/ERC721.d.ts +0 -44
- package/dist/assets/abis/ERC721.js +0 -349
- package/dist/services/nft-data/GhostMarketNDSEthereum.d.ts +0 -8
- package/dist/services/nft-data/GhostMarketNDSEthereum.js +0 -41
package/dist/BSEthereum.js
CHANGED
|
@@ -53,7 +53,7 @@ const EthersLedgerServiceEthereum_1 = require("./services/ledger/EthersLedgerSer
|
|
|
53
53
|
const BSEthereumHelper_1 = require("./helpers/BSEthereumHelper");
|
|
54
54
|
const MoralisBDSEthereum_1 = require("./services/blockchain-data/MoralisBDSEthereum");
|
|
55
55
|
const MoralisEDSEthereum_1 = require("./services/exchange-data/MoralisEDSEthereum");
|
|
56
|
-
const
|
|
56
|
+
const MoralisNDSEthereum_1 = require("./services/nft-data/MoralisNDSEthereum");
|
|
57
57
|
const BlockscoutESEthereum_1 = require("./services/explorer/BlockscoutESEthereum");
|
|
58
58
|
const TokenServiceEthereum_1 = require("./services/token/TokenServiceEthereum");
|
|
59
59
|
const WalletConnectServiceEthereum_1 = require("./services/wallet-connect/WalletConnectServiceEthereum");
|
|
@@ -125,7 +125,7 @@ class BSEthereum {
|
|
|
125
125
|
__classPrivateFieldGet(this, _BSEthereum_instances, "m", _BSEthereum_setTokens).call(this, network);
|
|
126
126
|
this.network = network;
|
|
127
127
|
this.networkUrls = networkUrls;
|
|
128
|
-
this.nftDataService = new
|
|
128
|
+
this.nftDataService = new MoralisNDSEthereum_1.MoralisNDSEthereum(this);
|
|
129
129
|
this.explorerService = new BlockscoutESEthereum_1.BlockscoutESEthereum(this);
|
|
130
130
|
this.exchangeDataService = new MoralisEDSEthereum_1.MoralisEDSEthereum(this);
|
|
131
131
|
this.blockchainDataService = new MoralisBDSEthereum_1.MoralisBDSEthereum(this);
|
|
@@ -8,4 +8,5 @@ export declare class BSEthereumConstants {
|
|
|
8
8
|
static readonly NATIVE_WRAPPED_HASH_BY_NETWORK_ID: Partial<Record<TBSEthereumNetworkId, string>>;
|
|
9
9
|
static readonly RPC_LIST_BY_NETWORK_ID: Record<TBSEthereumNetworkId, string[]>;
|
|
10
10
|
static readonly NETWORKS_BY_EVM: Record<TBSEthereumName, TBSNetwork<TBSEthereumNetworkId>[]>;
|
|
11
|
+
static readonly MORALIS_SUPPORTED_NETWORKS_IDS: TBSEthereumNetworkId[];
|
|
11
12
|
}
|
|
@@ -218,3 +218,11 @@ BSEthereumConstants.NETWORKS_BY_EVM = {
|
|
|
218
218
|
},
|
|
219
219
|
],
|
|
220
220
|
};
|
|
221
|
+
// prettier-ignore
|
|
222
|
+
BSEthereumConstants.MORALIS_SUPPORTED_NETWORKS_IDS = [
|
|
223
|
+
'1', '11155111', '17000', '137', '80002', '56', '97', '42161', '421614',
|
|
224
|
+
'8453', '84532', '10', '11155420', '59144', '59141', '43114', '250',
|
|
225
|
+
'4002', '25', '11297108109', '2020', '100', '10200', '88888', '88882',
|
|
226
|
+
'369', '1284', '1285', '1287', '81457', '168587773', '324', '300',
|
|
227
|
+
'5000', '5003', '1101', '2442', '7000', '7001'
|
|
228
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ export * from './services/blockchain-data/RpcBDSEthereum';
|
|
|
6
6
|
export * from './services/exchange-data/MoralisEDSEthereum';
|
|
7
7
|
export * from './services/explorer/BlockscoutESEthereum';
|
|
8
8
|
export * from './services/ledger/EthersLedgerServiceEthereum';
|
|
9
|
-
export * from './services/nft-data/
|
|
9
|
+
export * from './services/nft-data/MoralisNDSEthereum';
|
|
10
10
|
export * from './services/token/TokenServiceEthereum';
|
|
11
11
|
export * from './services/wallet-connect/WalletConnectServiceEthereum';
|
|
12
12
|
export * from './assets/abis/ERC20';
|
|
13
|
-
export * from './assets/abis/ERC721';
|
|
14
13
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -22,9 +22,8 @@ __exportStar(require("./services/blockchain-data/RpcBDSEthereum"), exports);
|
|
|
22
22
|
__exportStar(require("./services/exchange-data/MoralisEDSEthereum"), exports);
|
|
23
23
|
__exportStar(require("./services/explorer/BlockscoutESEthereum"), exports);
|
|
24
24
|
__exportStar(require("./services/ledger/EthersLedgerServiceEthereum"), exports);
|
|
25
|
-
__exportStar(require("./services/nft-data/
|
|
25
|
+
__exportStar(require("./services/nft-data/MoralisNDSEthereum"), exports);
|
|
26
26
|
__exportStar(require("./services/token/TokenServiceEthereum"), exports);
|
|
27
27
|
__exportStar(require("./services/wallet-connect/WalletConnectServiceEthereum"), exports);
|
|
28
28
|
__exportStar(require("./assets/abis/ERC20"), exports);
|
|
29
|
-
__exportStar(require("./assets/abis/ERC721"), exports);
|
|
30
29
|
__exportStar(require("./types"), exports);
|
|
@@ -5,7 +5,6 @@ import { RpcBDSEthereum } from './RpcBDSEthereum';
|
|
|
5
5
|
export declare class MoralisBDSEthereum<N extends string, A extends TBSNetworkId> extends RpcBDSEthereum<N, A> {
|
|
6
6
|
#private;
|
|
7
7
|
static readonly BASE_URL: string;
|
|
8
|
-
static readonly MORALIS_SUPPORTED_NETWORKS_IDS: TBSEthereumNetworkId[];
|
|
9
8
|
static getClient(network: TBSNetwork<TBSEthereumNetworkId>): axios.AxiosInstance;
|
|
10
9
|
static isSupported(network: TBSNetwork<TBSEthereumNetworkId>): boolean;
|
|
11
10
|
constructor(service: IBSEthereum<N, A>);
|
|
@@ -21,6 +21,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
21
21
|
const BSEthereumHelper_1 = require("../../helpers/BSEthereumHelper");
|
|
22
22
|
const ERC20_1 = require("../../assets/abis/ERC20");
|
|
23
23
|
const RpcBDSEthereum_1 = require("./RpcBDSEthereum");
|
|
24
|
+
const BSEthereumConstants_1 = require("../../constants/BSEthereumConstants");
|
|
24
25
|
class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
|
|
25
26
|
static getClient(network) {
|
|
26
27
|
return axios_1.default.create({
|
|
@@ -31,7 +32,7 @@ class MoralisBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
|
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
static isSupported(network) {
|
|
34
|
-
return
|
|
35
|
+
return BSEthereumConstants_1.BSEthereumConstants.MORALIS_SUPPORTED_NETWORKS_IDS.includes(network.id);
|
|
35
36
|
}
|
|
36
37
|
constructor(service) {
|
|
37
38
|
super(service);
|
|
@@ -314,11 +315,3 @@ _a = MoralisBDSEthereum, _MoralisBDSEthereum_apiInstance = new WeakMap(), _Moral
|
|
|
314
315
|
return __classPrivateFieldGet(this, _MoralisBDSEthereum_apiInstance, "f");
|
|
315
316
|
};
|
|
316
317
|
MoralisBDSEthereum.BASE_URL = `${blockchain_service_1.BSCommonConstants.COZ_API_URL}/api/v2/meta`;
|
|
317
|
-
// prettier-ignore
|
|
318
|
-
MoralisBDSEthereum.MORALIS_SUPPORTED_NETWORKS_IDS = [
|
|
319
|
-
'1', '11155111', '17000', '137', '80002', '56', '97', '42161', '421614',
|
|
320
|
-
'8453', '84532', '10', '11155420', '59144', '59141', '43114', '250',
|
|
321
|
-
'4002', '25', '11297108109', '2020', '100', '10200', '88888', '88882',
|
|
322
|
-
'369', '1284', '1285', '1287', '81457', '168587773', '324', '300',
|
|
323
|
-
'5000', '5003', '1101', '2442', '7000', '7001'
|
|
324
|
-
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type INftDataService, type TBSNetwork, type TBSNetworkId, type TGetNftParams, type TGetNftsByAddressParams, type THasTokenParams, type TNftResponse, type TNftsResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import type { IBSEthereum, TBSEthereumNetworkId } from '../../types';
|
|
4
|
+
export declare class MoralisNDSEthereum<N extends string, A extends TBSNetworkId> implements INftDataService {
|
|
5
|
+
#private;
|
|
6
|
+
static readonly BASE_URL: string;
|
|
7
|
+
constructor(service: IBSEthereum<N, A>);
|
|
8
|
+
static getClient(network: TBSNetwork<TBSEthereumNetworkId>): axios.AxiosInstance;
|
|
9
|
+
getNftsByAddress({ address, nextPageParams }: TGetNftsByAddressParams): Promise<TNftsResponse>;
|
|
10
|
+
getNft({ collectionHash, tokenHash }: TGetNftParams): Promise<TNftResponse>;
|
|
11
|
+
hasToken({ address, collectionHash }: THasTokenParams): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _MoralisNDSEthereum_instances, _a, _MoralisNDSEthereum_service, _MoralisNDSEthereum_apiInstance, _MoralisNDSEthereum_nftsCacheMap, _MoralisNDSEthereum_api_get, _MoralisNDSEthereum_parseResponse, _MoralisNDSEthereum_buildNftCacheKey;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MoralisNDSEthereum = void 0;
|
|
19
|
+
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
class MoralisNDSEthereum {
|
|
22
|
+
constructor(service) {
|
|
23
|
+
_MoralisNDSEthereum_instances.add(this);
|
|
24
|
+
_MoralisNDSEthereum_service.set(this, void 0);
|
|
25
|
+
_MoralisNDSEthereum_apiInstance.set(this, void 0);
|
|
26
|
+
_MoralisNDSEthereum_nftsCacheMap.set(this, new Map());
|
|
27
|
+
__classPrivateFieldSet(this, _MoralisNDSEthereum_service, service, "f");
|
|
28
|
+
}
|
|
29
|
+
static getClient(network) {
|
|
30
|
+
return axios_1.default.create({
|
|
31
|
+
baseURL: _a.BASE_URL,
|
|
32
|
+
params: {
|
|
33
|
+
chain: `0x${Number(network.id).toString(16)}`,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async getNftsByAddress({ address, nextPageParams }) {
|
|
38
|
+
const { data } = await __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "a", _MoralisNDSEthereum_api_get).get(`${address}/nft`, {
|
|
39
|
+
params: {
|
|
40
|
+
limit: 25,
|
|
41
|
+
cursor: nextPageParams,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const nfts = data.result || [];
|
|
45
|
+
const items = nfts.map(nft => {
|
|
46
|
+
const item = __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "m", _MoralisNDSEthereum_parseResponse).call(this, nft);
|
|
47
|
+
__classPrivateFieldGet(this, _MoralisNDSEthereum_nftsCacheMap, "f").set(__classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "m", _MoralisNDSEthereum_buildNftCacheKey).call(this, nft.token_id, nft.token_address), item);
|
|
48
|
+
return item;
|
|
49
|
+
});
|
|
50
|
+
return { nextPageParams: data.cursor, items };
|
|
51
|
+
}
|
|
52
|
+
async getNft({ collectionHash, tokenHash }) {
|
|
53
|
+
if (!collectionHash) {
|
|
54
|
+
throw new blockchain_service_1.BSError('collectionHash is required to get NFT from MoralisNDSEthereum', 'REQUIRED_PARAMETER_MISSING');
|
|
55
|
+
}
|
|
56
|
+
const cacheKey = __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "m", _MoralisNDSEthereum_buildNftCacheKey).call(this, tokenHash, collectionHash);
|
|
57
|
+
const nftFromCache = __classPrivateFieldGet(this, _MoralisNDSEthereum_nftsCacheMap, "f").get(cacheKey);
|
|
58
|
+
if (nftFromCache) {
|
|
59
|
+
return nftFromCache;
|
|
60
|
+
}
|
|
61
|
+
const { data } = await __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "a", _MoralisNDSEthereum_api_get).get(`/nft/${collectionHash}/${tokenHash}`, {
|
|
62
|
+
params: { normalizeMetadata: true },
|
|
63
|
+
});
|
|
64
|
+
const nft = __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "m", _MoralisNDSEthereum_parseResponse).call(this, data);
|
|
65
|
+
__classPrivateFieldGet(this, _MoralisNDSEthereum_nftsCacheMap, "f").set(cacheKey, nft);
|
|
66
|
+
return nft;
|
|
67
|
+
}
|
|
68
|
+
async hasToken({ address, collectionHash }) {
|
|
69
|
+
try {
|
|
70
|
+
if (!collectionHash)
|
|
71
|
+
return false;
|
|
72
|
+
const { data } = await __classPrivateFieldGet(this, _MoralisNDSEthereum_instances, "a", _MoralisNDSEthereum_api_get).get(`${address}/nft`, {
|
|
73
|
+
params: {
|
|
74
|
+
limit: 1,
|
|
75
|
+
token_addresses: [collectionHash],
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return (data.result?.length ?? 0) > 0;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.MoralisNDSEthereum = MoralisNDSEthereum;
|
|
86
|
+
_a = MoralisNDSEthereum, _MoralisNDSEthereum_service = new WeakMap(), _MoralisNDSEthereum_apiInstance = new WeakMap(), _MoralisNDSEthereum_nftsCacheMap = new WeakMap(), _MoralisNDSEthereum_instances = new WeakSet(), _MoralisNDSEthereum_api_get = function _MoralisNDSEthereum_api_get() {
|
|
87
|
+
if (!__classPrivateFieldGet(this, _MoralisNDSEthereum_apiInstance, "f")) {
|
|
88
|
+
__classPrivateFieldSet(this, _MoralisNDSEthereum_apiInstance, _a.getClient(__classPrivateFieldGet(this, _MoralisNDSEthereum_service, "f").network), "f");
|
|
89
|
+
}
|
|
90
|
+
return __classPrivateFieldGet(this, _MoralisNDSEthereum_apiInstance, "f");
|
|
91
|
+
}, _MoralisNDSEthereum_parseResponse = function _MoralisNDSEthereum_parseResponse(data) {
|
|
92
|
+
let explorerUri;
|
|
93
|
+
let collectionUrl;
|
|
94
|
+
const contractHash = data.token_address;
|
|
95
|
+
if ((0, blockchain_service_1.hasExplorerService)(__classPrivateFieldGet(this, _MoralisNDSEthereum_service, "f"))) {
|
|
96
|
+
explorerUri = __classPrivateFieldGet(this, _MoralisNDSEthereum_service, "f").explorerService.buildNftUrl({
|
|
97
|
+
tokenHash: data.token_id,
|
|
98
|
+
collectionHash: contractHash,
|
|
99
|
+
});
|
|
100
|
+
collectionUrl = __classPrivateFieldGet(this, _MoralisNDSEthereum_service, "f").explorerService.buildContractUrl(contractHash);
|
|
101
|
+
}
|
|
102
|
+
let nftName;
|
|
103
|
+
let image;
|
|
104
|
+
if (data.normalized_metadata) {
|
|
105
|
+
nftName = data.normalized_metadata.name;
|
|
106
|
+
image = data.normalized_metadata.image;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
hash: data.token_id,
|
|
110
|
+
collection: {
|
|
111
|
+
hash: contractHash,
|
|
112
|
+
name: data.name,
|
|
113
|
+
url: collectionUrl,
|
|
114
|
+
},
|
|
115
|
+
symbol: data.symbol,
|
|
116
|
+
image,
|
|
117
|
+
name: nftName,
|
|
118
|
+
explorerUri,
|
|
119
|
+
};
|
|
120
|
+
}, _MoralisNDSEthereum_buildNftCacheKey = function _MoralisNDSEthereum_buildNftCacheKey(tokenHash, collectionHash) {
|
|
121
|
+
return `${tokenHash}-${collectionHash}`;
|
|
122
|
+
};
|
|
123
|
+
MoralisNDSEthereum.BASE_URL = `${blockchain_service_1.BSCommonConstants.COZ_API_URL}/api/v2/meta`;
|
package/dist/types.d.ts
CHANGED
|
@@ -84,3 +84,94 @@ export type TMoralisEDSEthereumERC20PriceApiResponse = {
|
|
|
84
84
|
tokenAddress: string;
|
|
85
85
|
blockTimestamp: string;
|
|
86
86
|
};
|
|
87
|
+
type TMoralisNDSEthereumNftBaseApiResponse = {
|
|
88
|
+
token_address: string;
|
|
89
|
+
token_id: string;
|
|
90
|
+
contract_type: string;
|
|
91
|
+
name: string;
|
|
92
|
+
symbol: string;
|
|
93
|
+
possible_spam: boolean;
|
|
94
|
+
token_uri?: string;
|
|
95
|
+
metadata?: string;
|
|
96
|
+
normalized_metadata?: {
|
|
97
|
+
name?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
image?: string;
|
|
100
|
+
external_link?: string;
|
|
101
|
+
external_url?: string;
|
|
102
|
+
animation_url?: string;
|
|
103
|
+
attributes?: {
|
|
104
|
+
trait_type: string;
|
|
105
|
+
value: string;
|
|
106
|
+
display_type?: string;
|
|
107
|
+
max_value?: number;
|
|
108
|
+
trait_count?: number;
|
|
109
|
+
order?: number;
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
112
|
+
media?: {
|
|
113
|
+
mimetype?: string;
|
|
114
|
+
category?: string;
|
|
115
|
+
status?: string;
|
|
116
|
+
original_media_url?: string;
|
|
117
|
+
updatedAt?: string;
|
|
118
|
+
parent_hash?: string;
|
|
119
|
+
media_collection?: {
|
|
120
|
+
low: {
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
url: string;
|
|
124
|
+
};
|
|
125
|
+
medium: {
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
url: string;
|
|
129
|
+
};
|
|
130
|
+
high: {
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
url: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
amount?: string;
|
|
138
|
+
rarity_rank?: number;
|
|
139
|
+
rarity_percentage?: number;
|
|
140
|
+
rarity_label?: string;
|
|
141
|
+
verified_collection?: boolean;
|
|
142
|
+
floor_price?: string;
|
|
143
|
+
floor_price_usd?: string;
|
|
144
|
+
floor_price_currency?: string;
|
|
145
|
+
};
|
|
146
|
+
export type TMoralisNDSEthereumNftMetadataApiResponse = TMoralisNDSEthereumNftBaseApiResponse & {
|
|
147
|
+
owner_of?: string;
|
|
148
|
+
token_hash?: string;
|
|
149
|
+
block_number?: string;
|
|
150
|
+
block_number_minted?: string;
|
|
151
|
+
minter_address?: string;
|
|
152
|
+
last_token_uri_sync?: string;
|
|
153
|
+
last_metadata_sync?: string;
|
|
154
|
+
list_price?: {
|
|
155
|
+
listed?: boolean;
|
|
156
|
+
price?: string;
|
|
157
|
+
price_currency?: string;
|
|
158
|
+
price_usd?: string;
|
|
159
|
+
marketplace?: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export type TMoralisNDSEthereumNftApiResponse = TMoralisNDSEthereumNftBaseApiResponse & {
|
|
163
|
+
owner_of: string;
|
|
164
|
+
block_number: string;
|
|
165
|
+
block_number_minted: string;
|
|
166
|
+
token_hash: string;
|
|
167
|
+
last_token_uri_sync: string;
|
|
168
|
+
last_metadata_sync: string;
|
|
169
|
+
};
|
|
170
|
+
export type TMoralisNDSEthereumNftsByAddressApiResponse = {
|
|
171
|
+
result: TMoralisNDSEthereumNftApiResponse[];
|
|
172
|
+
cursor?: string;
|
|
173
|
+
status?: string;
|
|
174
|
+
page?: number;
|
|
175
|
+
page_size?: number;
|
|
176
|
+
};
|
|
177
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
4
4
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": "Coz",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"@ethersproject/json-wallets": "5.8.0",
|
|
18
18
|
"@ethersproject/properties": "5.8.0",
|
|
19
19
|
"@ledgerhq/hw-app-eth": "~7.3.0",
|
|
20
|
-
"axios": "~1.
|
|
20
|
+
"axios": "~1.15.0",
|
|
21
21
|
"ethers": "5.8.0",
|
|
22
|
-
"@cityofzion/blockchain-service": "3.1.
|
|
22
|
+
"@cityofzion/blockchain-service": "3.1.10"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@ledgerhq/hw-transport": "~6.32.0",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare const ERC721_ABI: ({
|
|
2
|
-
anonymous: boolean;
|
|
3
|
-
inputs: {
|
|
4
|
-
indexed: boolean;
|
|
5
|
-
internalType: string;
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
}[];
|
|
9
|
-
name: string;
|
|
10
|
-
type: string;
|
|
11
|
-
constant?: undefined;
|
|
12
|
-
outputs?: undefined;
|
|
13
|
-
payable?: undefined;
|
|
14
|
-
stateMutability?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
constant: boolean;
|
|
17
|
-
inputs: never[];
|
|
18
|
-
name: string;
|
|
19
|
-
outputs: {
|
|
20
|
-
name: string;
|
|
21
|
-
type: string;
|
|
22
|
-
}[];
|
|
23
|
-
payable: boolean;
|
|
24
|
-
stateMutability: string;
|
|
25
|
-
type: string;
|
|
26
|
-
anonymous?: undefined;
|
|
27
|
-
} | {
|
|
28
|
-
inputs: {
|
|
29
|
-
internalType: string;
|
|
30
|
-
name: string;
|
|
31
|
-
type: string;
|
|
32
|
-
}[];
|
|
33
|
-
name: string;
|
|
34
|
-
outputs: {
|
|
35
|
-
internalType: string;
|
|
36
|
-
name: string;
|
|
37
|
-
type: string;
|
|
38
|
-
}[];
|
|
39
|
-
stateMutability: string;
|
|
40
|
-
type: string;
|
|
41
|
-
anonymous?: undefined;
|
|
42
|
-
constant?: undefined;
|
|
43
|
-
payable?: undefined;
|
|
44
|
-
})[];
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERC721_ABI = void 0;
|
|
4
|
-
exports.ERC721_ABI = [
|
|
5
|
-
{
|
|
6
|
-
anonymous: false,
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
9
|
-
indexed: true,
|
|
10
|
-
internalType: 'address',
|
|
11
|
-
name: 'owner',
|
|
12
|
-
type: 'address',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
indexed: true,
|
|
16
|
-
internalType: 'address',
|
|
17
|
-
name: 'approved',
|
|
18
|
-
type: 'address',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
indexed: true,
|
|
22
|
-
internalType: 'uint256',
|
|
23
|
-
name: 'tokenId',
|
|
24
|
-
type: 'uint256',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
name: 'Approval',
|
|
28
|
-
type: 'event',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
anonymous: false,
|
|
32
|
-
inputs: [
|
|
33
|
-
{
|
|
34
|
-
indexed: true,
|
|
35
|
-
internalType: 'address',
|
|
36
|
-
name: 'owner',
|
|
37
|
-
type: 'address',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
indexed: true,
|
|
41
|
-
internalType: 'address',
|
|
42
|
-
name: 'operator',
|
|
43
|
-
type: 'address',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
indexed: false,
|
|
47
|
-
internalType: 'bool',
|
|
48
|
-
name: 'approved',
|
|
49
|
-
type: 'bool',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
name: 'ApprovalForAll',
|
|
53
|
-
type: 'event',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
anonymous: false,
|
|
57
|
-
inputs: [
|
|
58
|
-
{
|
|
59
|
-
indexed: true,
|
|
60
|
-
internalType: 'address',
|
|
61
|
-
name: 'from',
|
|
62
|
-
type: 'address',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
indexed: true,
|
|
66
|
-
internalType: 'address',
|
|
67
|
-
name: 'to',
|
|
68
|
-
type: 'address',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
indexed: true,
|
|
72
|
-
internalType: 'uint256',
|
|
73
|
-
name: 'tokenId',
|
|
74
|
-
type: 'uint256',
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
name: 'Transfer',
|
|
78
|
-
type: 'event',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
inputs: [
|
|
82
|
-
{
|
|
83
|
-
internalType: 'address',
|
|
84
|
-
name: 'to',
|
|
85
|
-
type: 'address',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
internalType: 'uint256',
|
|
89
|
-
name: 'tokenId',
|
|
90
|
-
type: 'uint256',
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
name: 'approve',
|
|
94
|
-
outputs: [],
|
|
95
|
-
stateMutability: 'nonpayable',
|
|
96
|
-
type: 'function',
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
constant: true,
|
|
100
|
-
inputs: [],
|
|
101
|
-
name: 'totalSupply',
|
|
102
|
-
outputs: [
|
|
103
|
-
{
|
|
104
|
-
name: '',
|
|
105
|
-
type: 'uint256',
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
payable: false,
|
|
109
|
-
stateMutability: 'view',
|
|
110
|
-
type: 'function',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
inputs: [
|
|
114
|
-
{
|
|
115
|
-
internalType: 'address',
|
|
116
|
-
name: 'owner',
|
|
117
|
-
type: 'address',
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
name: 'balanceOf',
|
|
121
|
-
outputs: [
|
|
122
|
-
{
|
|
123
|
-
internalType: 'uint256',
|
|
124
|
-
name: 'balance',
|
|
125
|
-
type: 'uint256',
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
stateMutability: 'view',
|
|
129
|
-
type: 'function',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
inputs: [
|
|
133
|
-
{
|
|
134
|
-
internalType: 'uint256',
|
|
135
|
-
name: 'tokenId',
|
|
136
|
-
type: 'uint256',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
name: 'getApproved',
|
|
140
|
-
outputs: [
|
|
141
|
-
{
|
|
142
|
-
internalType: 'address',
|
|
143
|
-
name: 'operator',
|
|
144
|
-
type: 'address',
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
stateMutability: 'view',
|
|
148
|
-
type: 'function',
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
inputs: [
|
|
152
|
-
{
|
|
153
|
-
internalType: 'address',
|
|
154
|
-
name: 'owner',
|
|
155
|
-
type: 'address',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
internalType: 'address',
|
|
159
|
-
name: 'operator',
|
|
160
|
-
type: 'address',
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
name: 'isApprovedForAll',
|
|
164
|
-
outputs: [
|
|
165
|
-
{
|
|
166
|
-
internalType: 'bool',
|
|
167
|
-
name: '',
|
|
168
|
-
type: 'bool',
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
stateMutability: 'view',
|
|
172
|
-
type: 'function',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
inputs: [],
|
|
176
|
-
name: 'name',
|
|
177
|
-
outputs: [
|
|
178
|
-
{
|
|
179
|
-
internalType: 'string',
|
|
180
|
-
name: '',
|
|
181
|
-
type: 'string',
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
stateMutability: 'view',
|
|
185
|
-
type: 'function',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
inputs: [
|
|
189
|
-
{
|
|
190
|
-
internalType: 'uint256',
|
|
191
|
-
name: 'tokenId',
|
|
192
|
-
type: 'uint256',
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
name: 'ownerOf',
|
|
196
|
-
outputs: [
|
|
197
|
-
{
|
|
198
|
-
internalType: 'address',
|
|
199
|
-
name: 'owner',
|
|
200
|
-
type: 'address',
|
|
201
|
-
},
|
|
202
|
-
],
|
|
203
|
-
stateMutability: 'view',
|
|
204
|
-
type: 'function',
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
inputs: [
|
|
208
|
-
{
|
|
209
|
-
internalType: 'address',
|
|
210
|
-
name: 'from',
|
|
211
|
-
type: 'address',
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
internalType: 'address',
|
|
215
|
-
name: 'to',
|
|
216
|
-
type: 'address',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
internalType: 'uint256',
|
|
220
|
-
name: 'tokenId',
|
|
221
|
-
type: 'uint256',
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
name: 'safeTransferFrom',
|
|
225
|
-
outputs: [],
|
|
226
|
-
stateMutability: 'nonpayable',
|
|
227
|
-
type: 'function',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
inputs: [
|
|
231
|
-
{
|
|
232
|
-
internalType: 'address',
|
|
233
|
-
name: 'from',
|
|
234
|
-
type: 'address',
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
internalType: 'address',
|
|
238
|
-
name: 'to',
|
|
239
|
-
type: 'address',
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
internalType: 'uint256',
|
|
243
|
-
name: 'tokenId',
|
|
244
|
-
type: 'uint256',
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
internalType: 'bytes',
|
|
248
|
-
name: 'data',
|
|
249
|
-
type: 'bytes',
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
name: 'safeTransferFrom',
|
|
253
|
-
outputs: [],
|
|
254
|
-
stateMutability: 'nonpayable',
|
|
255
|
-
type: 'function',
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
inputs: [
|
|
259
|
-
{
|
|
260
|
-
internalType: 'address',
|
|
261
|
-
name: 'operator',
|
|
262
|
-
type: 'address',
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
internalType: 'bool',
|
|
266
|
-
name: '_approved',
|
|
267
|
-
type: 'bool',
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
name: 'setApprovalForAll',
|
|
271
|
-
outputs: [],
|
|
272
|
-
stateMutability: 'nonpayable',
|
|
273
|
-
type: 'function',
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
inputs: [
|
|
277
|
-
{
|
|
278
|
-
internalType: 'bytes4',
|
|
279
|
-
name: 'interfaceId',
|
|
280
|
-
type: 'bytes4',
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
name: 'supportsInterface',
|
|
284
|
-
outputs: [
|
|
285
|
-
{
|
|
286
|
-
internalType: 'bool',
|
|
287
|
-
name: '',
|
|
288
|
-
type: 'bool',
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
stateMutability: 'view',
|
|
292
|
-
type: 'function',
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
inputs: [],
|
|
296
|
-
name: 'symbol',
|
|
297
|
-
outputs: [
|
|
298
|
-
{
|
|
299
|
-
internalType: 'string',
|
|
300
|
-
name: '',
|
|
301
|
-
type: 'string',
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
stateMutability: 'view',
|
|
305
|
-
type: 'function',
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
inputs: [
|
|
309
|
-
{
|
|
310
|
-
internalType: 'uint256',
|
|
311
|
-
name: 'tokenId',
|
|
312
|
-
type: 'uint256',
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
name: 'tokenURI',
|
|
316
|
-
outputs: [
|
|
317
|
-
{
|
|
318
|
-
internalType: 'string',
|
|
319
|
-
name: '',
|
|
320
|
-
type: 'string',
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
stateMutability: 'view',
|
|
324
|
-
type: 'function',
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
inputs: [
|
|
328
|
-
{
|
|
329
|
-
internalType: 'address',
|
|
330
|
-
name: 'from',
|
|
331
|
-
type: 'address',
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
internalType: 'address',
|
|
335
|
-
name: 'to',
|
|
336
|
-
type: 'address',
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
internalType: 'uint256',
|
|
340
|
-
name: 'tokenId',
|
|
341
|
-
type: 'uint256',
|
|
342
|
-
},
|
|
343
|
-
],
|
|
344
|
-
name: 'transferFrom',
|
|
345
|
-
outputs: [],
|
|
346
|
-
stateMutability: 'nonpayable',
|
|
347
|
-
type: 'function',
|
|
348
|
-
},
|
|
349
|
-
];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GhostMarketNDS, type TBSNetworkId, type THasTokenParams } from '@cityofzion/blockchain-service';
|
|
2
|
-
import type { IBSEthereum, TBSEthereumNetworkId } from '../../types';
|
|
3
|
-
export declare class GhostMarketNDSEthereum<N extends string, A extends TBSNetworkId> extends GhostMarketNDS<N, A, IBSEthereum<N, A>> {
|
|
4
|
-
static readonly CHAIN_BY_NETWORK_ID: Partial<Record<TBSEthereumNetworkId, string>>;
|
|
5
|
-
constructor(service: IBSEthereum<N, A>);
|
|
6
|
-
hasToken({ address, collectionHash }: THasTokenParams): Promise<boolean>;
|
|
7
|
-
getChain(): string;
|
|
8
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GhostMarketNDSEthereum = void 0;
|
|
4
|
-
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
5
|
-
const ethers_1 = require("ethers");
|
|
6
|
-
const ERC20_1 = require("../../assets/abis/ERC20");
|
|
7
|
-
class GhostMarketNDSEthereum extends blockchain_service_1.GhostMarketNDS {
|
|
8
|
-
constructor(service) {
|
|
9
|
-
super(service);
|
|
10
|
-
}
|
|
11
|
-
async hasToken({ address, collectionHash }) {
|
|
12
|
-
try {
|
|
13
|
-
if (!collectionHash)
|
|
14
|
-
return false;
|
|
15
|
-
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this._service.network.url);
|
|
16
|
-
const contract = new ethers_1.ethers.Contract(collectionHash, ERC20_1.ERC20_ABI, provider);
|
|
17
|
-
const response = await contract.balanceOf(address);
|
|
18
|
-
if (!response)
|
|
19
|
-
return false;
|
|
20
|
-
const parsedResponse = response;
|
|
21
|
-
return parsedResponse.gt(0);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
getChain() {
|
|
28
|
-
const chain = GhostMarketNDSEthereum.CHAIN_BY_NETWORK_ID[this._service.network.id];
|
|
29
|
-
if (!chain)
|
|
30
|
-
throw new Error('Network not supported');
|
|
31
|
-
return chain;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.GhostMarketNDSEthereum = GhostMarketNDSEthereum;
|
|
35
|
-
GhostMarketNDSEthereum.CHAIN_BY_NETWORK_ID = {
|
|
36
|
-
'1': 'eth',
|
|
37
|
-
'56': 'bsc',
|
|
38
|
-
'137': 'polygon',
|
|
39
|
-
'43114': 'avalanche',
|
|
40
|
-
'8453': 'base',
|
|
41
|
-
};
|