@cityofzion/bs-neo3 1.16.0 → 1.16.1
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 +4 -3
- package/dist/BSNeo3.js +11 -9
- package/dist/constants/BSNeo3Constants.d.ts +1 -0
- package/dist/constants/BSNeo3Constants.js +10 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/services/blockchain-data/DoraBDSNeo3.d.ts +2 -2
- package/dist/services/blockchain-data/DoraBDSNeo3.js +36 -30
- package/dist/services/blockchain-data/RpcBDSNeo3.d.ts +3 -2
- package/dist/services/blockchain-data/RpcBDSNeo3.js +4 -4
- package/dist/services/exchange-data/FlamingoForthewinEDSNeo3.d.ts +2 -2
- package/dist/services/exchange-data/FlamingoForthewinEDSNeo3.js +2 -2
- package/dist/services/explorer/DoraESNeo3.d.ts +3 -3
- package/dist/services/explorer/DoraESNeo3.js +10 -8
- package/dist/services/neo3neoXBridge/Neo3NeoXBridgeService.js +4 -4
- package/dist/services/nft-data/GhostMarketNDSNeo3.d.ts +1 -1
- package/dist/services/nft-data/GhostMarketNDSNeo3.js +9 -8
- package/dist/services/nft-data/RpcNDSNeo3.d.ts +1 -1
- package/dist/services/nft-data/RpcNDSNeo3.js +3 -3
- package/dist/services/token/TokenServiceNeo3.d.ts +4 -0
- package/dist/services/token/TokenServiceNeo3.js +11 -0
- package/package.json +2 -2
package/dist/BSNeo3.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSCalculableFee, BSClaimable, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, ExchangeDataService, ExplorerService, GetLedgerTransport, IBSWithNeo3NeoXBridge, INeo3NeoXBridgeService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSCalculableFee, BSClaimable, BSWithEncryption, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, ExchangeDataService, ExplorerService, GetLedgerTransport, IBSWithNeo3NeoXBridge, INeo3NeoXBridgeService, ITokenService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { NeonDappKitLedgerServiceNeo3 } from './services/ledger/NeonDappKitLedgerServiceNeo3';
|
|
3
3
|
import { BSNeo3NetworkId } from './constants/BSNeo3Constants';
|
|
4
4
|
import { GenerateSigningCallbackResponse, VoteService } from './interfaces';
|
|
5
|
-
export declare class BSNeo3<BSName extends string = string> implements BlockchainService<BSName, BSNeo3NetworkId>, BSClaimable<BSName>, BSWithNameService, BSCalculableFee<BSName>, BSWithNft, BSWithExplorerService, BSWithLedger<BSName>, IBSWithNeo3NeoXBridge<BSName> {
|
|
5
|
+
export declare class BSNeo3<BSName extends string = string> implements BlockchainService<BSName, BSNeo3NetworkId>, BSClaimable<BSName>, BSWithNameService, BSCalculableFee<BSName>, BSWithNft, BSWithExplorerService, BSWithLedger<BSName>, IBSWithNeo3NeoXBridge<BSName>, BSWithEncryption<BSName> {
|
|
6
6
|
#private;
|
|
7
7
|
name: BSName;
|
|
8
8
|
bip44DerivationPath: string;
|
|
@@ -18,11 +18,12 @@ export declare class BSNeo3<BSName extends string = string> implements Blockchai
|
|
|
18
18
|
explorerService: ExplorerService;
|
|
19
19
|
voteService: VoteService<BSName>;
|
|
20
20
|
neo3NeoXBridgeService: INeo3NeoXBridgeService<BSName>;
|
|
21
|
+
tokenService: ITokenService;
|
|
21
22
|
network: Network<BSNeo3NetworkId>;
|
|
22
23
|
constructor(name: BSName, network?: Network<BSNeo3NetworkId>, getLedgerTransport?: GetLedgerTransport<BSName>);
|
|
23
24
|
generateSigningCallback(account: Account<BSName>): Promise<GenerateSigningCallbackResponse>;
|
|
24
|
-
testNetwork(network: Network<BSNeo3NetworkId>): Promise<void>;
|
|
25
25
|
setNetwork(network: Network<BSNeo3NetworkId>): void;
|
|
26
|
+
testNetwork(network: Network<BSNeo3NetworkId>): Promise<void>;
|
|
26
27
|
validateAddress(address: string): boolean;
|
|
27
28
|
validateEncrypted(encryptedKey: string): boolean;
|
|
28
29
|
validateKey(key: string): boolean;
|
package/dist/BSNeo3.js
CHANGED
|
@@ -30,6 +30,7 @@ const BSNeo3Constants_1 = require("./constants/BSNeo3Constants");
|
|
|
30
30
|
const RpcBDSNeo3_1 = require("./services/blockchain-data/RpcBDSNeo3");
|
|
31
31
|
const Neo3NeoXBridgeService_1 = require("./services/neo3neoXBridge/Neo3NeoXBridgeService");
|
|
32
32
|
const DoraVoteServiceNeo3_1 = require("./services/vote/DoraVoteServiceNeo3");
|
|
33
|
+
const TokenServiceNeo3_1 = require("./services/token/TokenServiceNeo3");
|
|
33
34
|
class BSNeo3 {
|
|
34
35
|
constructor(name, network, getLedgerTransport) {
|
|
35
36
|
_BSNeo3_instances.add(this);
|
|
@@ -59,21 +60,22 @@ class BSNeo3 {
|
|
|
59
60
|
};
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
|
-
testNetwork(network) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const blockchainDataServiceClone = new RpcBDSNeo3_1.RpcBDSNeo3(network, this.feeToken, this.claimToken, this.tokens);
|
|
65
|
-
yield blockchainDataServiceClone.getBlockHeight();
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
63
|
setNetwork(network) {
|
|
69
64
|
__classPrivateFieldGet(this, _BSNeo3_instances, "m", _BSNeo3_setTokens).call(this, network);
|
|
70
65
|
this.network = network;
|
|
66
|
+
this.tokenService = new TokenServiceNeo3_1.TokenServiceNeo3();
|
|
71
67
|
this.nftDataService = new GhostMarketNDSNeo3_1.GhostMarketNDSNeo3(network);
|
|
72
|
-
this.explorerService = new DoraESNeo3_1.DoraESNeo3(network);
|
|
68
|
+
this.explorerService = new DoraESNeo3_1.DoraESNeo3(network, this.tokenService);
|
|
73
69
|
this.voteService = new DoraVoteServiceNeo3_1.DoraVoteServiceNeo3(this);
|
|
74
70
|
this.neo3NeoXBridgeService = new Neo3NeoXBridgeService_1.Neo3NeoXBridgeService(this);
|
|
75
|
-
this.blockchainDataService = new DoraBDSNeo3_1.DoraBDSNeo3(network, this.feeToken, this.claimToken, this.tokens, this.nftDataService, this.explorerService);
|
|
76
|
-
this.exchangeDataService = new FlamingoForthewinEDSNeo3_1.FlamingoForthewinEDSNeo3(network);
|
|
71
|
+
this.blockchainDataService = new DoraBDSNeo3_1.DoraBDSNeo3(network, this.feeToken, this.claimToken, this.tokens, this.nftDataService, this.explorerService, this.tokenService, this.neo3NeoXBridgeService);
|
|
72
|
+
this.exchangeDataService = new FlamingoForthewinEDSNeo3_1.FlamingoForthewinEDSNeo3(network, this.tokenService);
|
|
73
|
+
}
|
|
74
|
+
testNetwork(network) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const blockchainDataServiceClone = new RpcBDSNeo3_1.RpcBDSNeo3(network, this.feeToken, this.claimToken, this.tokens, this.tokenService);
|
|
77
|
+
yield blockchainDataServiceClone.getBlockHeight();
|
|
78
|
+
});
|
|
77
79
|
}
|
|
78
80
|
validateAddress(address) {
|
|
79
81
|
return neon_js_1.wallet.isAddress(address, 53);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Network, NetworkId, Token } from '@cityofzion/blockchain-service';
|
|
2
2
|
export type BSNeo3NetworkId = NetworkId<'mainnet' | 'testnet'>;
|
|
3
3
|
export declare class BSNeo3Constants {
|
|
4
|
+
#private;
|
|
4
5
|
static EXTRA_TOKENS_BY_NETWORK_ID: Partial<Record<BSNeo3NetworkId, Token[]>>;
|
|
5
6
|
static NATIVE_ASSETS: Token[];
|
|
6
7
|
static GAS_TOKEN: Token;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
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");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
2
7
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
9
|
};
|
|
5
|
-
var _a;
|
|
10
|
+
var _a, _BSNeo3Constants_tokenService;
|
|
6
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
12
|
exports.BSNeo3Constants = void 0;
|
|
8
|
-
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
9
13
|
const mainnet_json_1 = __importDefault(require("../assets/tokens/mainnet.json"));
|
|
10
14
|
const native_json_1 = __importDefault(require("../assets/tokens/native.json"));
|
|
15
|
+
const TokenServiceNeo3_1 = require("../services/token/TokenServiceNeo3");
|
|
11
16
|
class BSNeo3Constants {
|
|
12
17
|
}
|
|
13
18
|
exports.BSNeo3Constants = BSNeo3Constants;
|
|
14
19
|
_a = BSNeo3Constants;
|
|
20
|
+
_BSNeo3Constants_tokenService = { value: new TokenServiceNeo3_1.TokenServiceNeo3() };
|
|
15
21
|
BSNeo3Constants.EXTRA_TOKENS_BY_NETWORK_ID = {
|
|
16
|
-
mainnet:
|
|
22
|
+
mainnet: __classPrivateFieldGet(_a, _a, "f", _BSNeo3Constants_tokenService).normalizeToken(mainnet_json_1.default),
|
|
17
23
|
};
|
|
18
|
-
BSNeo3Constants.NATIVE_ASSETS =
|
|
24
|
+
BSNeo3Constants.NATIVE_ASSETS = __classPrivateFieldGet(_a, _a, "f", _BSNeo3Constants_tokenService).normalizeToken(native_json_1.default);
|
|
19
25
|
BSNeo3Constants.GAS_TOKEN = _a.NATIVE_ASSETS.find(token => token.name === 'GAS');
|
|
20
26
|
BSNeo3Constants.NEO_TOKEN = _a.NATIVE_ASSETS.find(token => token.name === 'NEO');
|
|
21
27
|
BSNeo3Constants.RPC_LIST_BY_NETWORK_ID = {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ export * from './services/explorer/DoraESNeo3';
|
|
|
8
8
|
export * from './services/ledger/NeonDappKitLedgerServiceNeo3';
|
|
9
9
|
export * from './services/nft-data/GhostMarketNDSNeo3';
|
|
10
10
|
export * from './services/nft-data/RpcNDSNeo3';
|
|
11
|
+
export * from './services/vote/DoraVoteServiceNeo3';
|
|
12
|
+
export * from './services/neo3neoXBridge/Neo3NeoXBridgeService';
|
|
13
|
+
export * from './services/token/TokenServiceNeo3';
|
|
11
14
|
export * from './interfaces';
|
package/dist/index.js
CHANGED
|
@@ -24,4 +24,7 @@ __exportStar(require("./services/explorer/DoraESNeo3"), exports);
|
|
|
24
24
|
__exportStar(require("./services/ledger/NeonDappKitLedgerServiceNeo3"), exports);
|
|
25
25
|
__exportStar(require("./services/nft-data/GhostMarketNDSNeo3"), exports);
|
|
26
26
|
__exportStar(require("./services/nft-data/RpcNDSNeo3"), exports);
|
|
27
|
+
__exportStar(require("./services/vote/DoraVoteServiceNeo3"), exports);
|
|
28
|
+
__exportStar(require("./services/neo3neoXBridge/Neo3NeoXBridgeService"), exports);
|
|
29
|
+
__exportStar(require("./services/token/TokenServiceNeo3"), exports);
|
|
27
30
|
__exportStar(require("./interfaces"), exports);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BalanceResponse, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, NftDataService, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse, ExplorerService, ExportTransactionsByAddressParams } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BalanceResponse, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, NftDataService, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse, ExplorerService, ExportTransactionsByAddressParams, TokenService, INeo3NeoXBridgeService } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { api } from '@cityofzion/dora-ts';
|
|
3
3
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
4
4
|
import { RpcBDSNeo3 } from './RpcBDSNeo3';
|
|
5
5
|
export declare const DoraNeoRest: api.NeoRESTApi;
|
|
6
6
|
export declare class DoraBDSNeo3 extends RpcBDSNeo3 {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], nftDataService: NftDataService, explorerService: ExplorerService);
|
|
8
|
+
constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], nftDataService: NftDataService, explorerService: ExplorerService, tokenService: TokenService, neo3NeoXBridgeService: INeo3NeoXBridgeService);
|
|
9
9
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
10
10
|
getTransactionsByAddress({ address, nextPageParams, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
11
11
|
getFullTransactionsByAddress({ nextCursor, ...params }: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
|
|
@@ -30,7 +30,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
};
|
|
33
|
-
var _DoraBDSNeo3_instances, _DoraBDSNeo3_supportedNep11Standards, _DoraBDSNeo3_nftDataService, _DoraBDSNeo3_explorerService, _DoraBDSNeo3_validateAddress, _DoraBDSNeo3_validateFullTransactionsByAddressParams, _DoraBDSNeo3_validateGetFullTransactionsByAddressParams, _DoraBDSNeo3_getBridgeNeo3NeoXDataByNotifications;
|
|
33
|
+
var _DoraBDSNeo3_instances, _DoraBDSNeo3_supportedNep11Standards, _DoraBDSNeo3_nftDataService, _DoraBDSNeo3_explorerService, _DoraBDSNeo3_neo3NeoXBridgeService, _DoraBDSNeo3_validateAddress, _DoraBDSNeo3_validateFullTransactionsByAddressParams, _DoraBDSNeo3_validateGetFullTransactionsByAddressParams, _DoraBDSNeo3_getBridgeNeo3NeoXDataByNotifications;
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.DoraBDSNeo3 = exports.DoraNeoRest = void 0;
|
|
36
36
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
@@ -44,14 +44,16 @@ exports.DoraNeoRest = new dora_ts_1.api.NeoRESTApi({
|
|
|
44
44
|
endpoint: '/api/v2/neo3',
|
|
45
45
|
});
|
|
46
46
|
class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
47
|
-
constructor(network, feeToken, claimToken, tokens, nftDataService, explorerService) {
|
|
48
|
-
super(network, feeToken, claimToken, tokens);
|
|
47
|
+
constructor(network, feeToken, claimToken, tokens, nftDataService, explorerService, tokenService, neo3NeoXBridgeService) {
|
|
48
|
+
super(network, feeToken, claimToken, tokens, tokenService);
|
|
49
49
|
_DoraBDSNeo3_instances.add(this);
|
|
50
50
|
_DoraBDSNeo3_supportedNep11Standards.set(this, ['nep11', 'nep-11']);
|
|
51
51
|
_DoraBDSNeo3_nftDataService.set(this, void 0);
|
|
52
52
|
_DoraBDSNeo3_explorerService.set(this, void 0);
|
|
53
|
+
_DoraBDSNeo3_neo3NeoXBridgeService.set(this, void 0);
|
|
53
54
|
__classPrivateFieldSet(this, _DoraBDSNeo3_nftDataService, nftDataService, "f");
|
|
54
55
|
__classPrivateFieldSet(this, _DoraBDSNeo3_explorerService, explorerService, "f");
|
|
56
|
+
__classPrivateFieldSet(this, _DoraBDSNeo3_neo3NeoXBridgeService, neo3NeoXBridgeService, "f");
|
|
55
57
|
}
|
|
56
58
|
getTransaction(hash) {
|
|
57
59
|
const _super = Object.create(null, {
|
|
@@ -95,9 +97,9 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
95
97
|
var _a, _b, _c;
|
|
96
98
|
const transferPromises = [];
|
|
97
99
|
const notifications = (_a = item.notifications) !== null && _a !== void 0 ? _a : [];
|
|
98
|
-
notifications.forEach(({ contract: contractHash, state, event_name: eventName }) => {
|
|
100
|
+
item.notifications.forEach(({ contract: contractHash, state, event_name: eventName }) => {
|
|
99
101
|
var _a;
|
|
100
|
-
const properties = Array.isArray(state) ? state : (_a = state === null || state === void 0 ? void 0 : state.value) !== null && _a !== void 0 ? _a : [];
|
|
102
|
+
const properties = (Array.isArray(state) ? state : (_a = state === null || state === void 0 ? void 0 : state.value) !== null && _a !== void 0 ? _a : []);
|
|
101
103
|
if (eventName !== 'Transfer' || (properties.length !== 3 && properties.length !== 4))
|
|
102
104
|
return;
|
|
103
105
|
const promise = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -122,8 +124,8 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
122
124
|
return {
|
|
123
125
|
from: convertedFrom,
|
|
124
126
|
to: convertedTo,
|
|
125
|
-
|
|
126
|
-
contractHash,
|
|
127
|
+
tokenHash: properties[3].value,
|
|
128
|
+
collectionHash: contractHash,
|
|
127
129
|
type: 'nft',
|
|
128
130
|
};
|
|
129
131
|
});
|
|
@@ -198,21 +200,21 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
198
200
|
type: 'default',
|
|
199
201
|
};
|
|
200
202
|
const eventPromises = item.events.map((event, eventIndex) => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
var _e, _f, _g, _h, _j, _k;
|
|
202
|
-
|
|
203
|
-
let assetEvent;
|
|
204
|
-
const { methodName, tokenID: tokenId, contractHash: hash, contractName } = event;
|
|
203
|
+
var _e, _f, _g, _h, _j, _k, _l;
|
|
204
|
+
const { methodName, tokenID: tokenHash, contractHash, contractName } = event;
|
|
205
205
|
const from = (_e = event.from) !== null && _e !== void 0 ? _e : undefined;
|
|
206
206
|
const to = (_f = event.to) !== null && _f !== void 0 ? _f : undefined;
|
|
207
207
|
const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
|
|
208
208
|
const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
|
|
209
|
-
const
|
|
209
|
+
const contractHashUrl = contractHash ? contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash) : undefined;
|
|
210
210
|
const standard = (_j = (_h = (_g = event.supportedStandards) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.toLowerCase()) !== null && _j !== void 0 ? _j : '';
|
|
211
|
-
const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!
|
|
211
|
+
const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenHash;
|
|
212
212
|
if (isNft) {
|
|
213
|
-
const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({
|
|
214
|
-
const nftUrl =
|
|
215
|
-
|
|
213
|
+
const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ collectionHash: contractHash, tokenHash }));
|
|
214
|
+
const nftUrl = contractHash
|
|
215
|
+
? nftTemplateUrl === null || nftTemplateUrl === void 0 ? void 0 : nftTemplateUrl.replace('{collectionHash}', contractHash).replace('{tokenHash}', tokenHash)
|
|
216
|
+
: undefined;
|
|
217
|
+
const nftEvent = {
|
|
216
218
|
eventType: 'nft',
|
|
217
219
|
amount: undefined,
|
|
218
220
|
methodName,
|
|
@@ -220,33 +222,36 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
220
222
|
fromUrl,
|
|
221
223
|
to,
|
|
222
224
|
toUrl,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
collectionHash: contractHash,
|
|
226
|
+
collectionHashUrl: contractHashUrl,
|
|
227
|
+
tokenHash,
|
|
226
228
|
tokenType: 'nep-11',
|
|
227
229
|
nftImageUrl: nft === null || nft === void 0 ? void 0 : nft.image,
|
|
228
230
|
nftUrl,
|
|
229
231
|
name: nft === null || nft === void 0 ? void 0 : nft.name,
|
|
230
|
-
collectionName: nft === null || nft === void 0 ? void 0 : nft.
|
|
232
|
+
collectionName: (_k = nft === null || nft === void 0 ? void 0 : nft.collection) === null || _k === void 0 ? void 0 : _k.name,
|
|
231
233
|
};
|
|
234
|
+
newItem.events.splice(eventIndex, 0, nftEvent);
|
|
235
|
+
return;
|
|
232
236
|
}
|
|
233
237
|
else {
|
|
234
|
-
const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(
|
|
235
|
-
assetEvent = {
|
|
238
|
+
const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(contractHash));
|
|
239
|
+
const assetEvent = {
|
|
236
240
|
eventType: 'token',
|
|
237
241
|
amount: event.amount
|
|
238
|
-
? blockchain_service_1.BSBigNumberHelper.format(event.amount, { decimals: (
|
|
242
|
+
? blockchain_service_1.BSBigNumberHelper.format(event.amount, { decimals: (_l = token === null || token === void 0 ? void 0 : token.decimals) !== null && _l !== void 0 ? _l : event.tokenDecimals })
|
|
239
243
|
: undefined,
|
|
240
244
|
methodName,
|
|
241
245
|
from,
|
|
242
246
|
fromUrl,
|
|
243
247
|
to,
|
|
244
248
|
toUrl,
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
contractHash,
|
|
250
|
+
contractHashUrl,
|
|
247
251
|
token: token !== null && token !== void 0 ? token : undefined,
|
|
248
252
|
tokenType: 'nep-17',
|
|
249
253
|
};
|
|
254
|
+
newItem.events.splice(eventIndex, 0, assetEvent);
|
|
250
255
|
}
|
|
251
256
|
if (newItem.type === 'default' && contractName === 'NeoXBridge') {
|
|
252
257
|
const [log] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => exports.DoraNeoRest.log(txId, this._network.id));
|
|
@@ -256,7 +261,6 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
256
261
|
newItem = Object.assign(Object.assign({}, newItem), { type: 'bridgeNeo3NeoX', data });
|
|
257
262
|
}
|
|
258
263
|
}
|
|
259
|
-
newItem.events.splice(eventIndex, 0, isNft ? nftEvent : assetEvent);
|
|
260
264
|
}));
|
|
261
265
|
yield Promise.allSettled(eventPromises);
|
|
262
266
|
data.splice(index, 0, newItem);
|
|
@@ -311,10 +315,10 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
311
315
|
if (cachedToken) {
|
|
312
316
|
return cachedToken;
|
|
313
317
|
}
|
|
314
|
-
let token = this._tokens.find(
|
|
318
|
+
let token = this._tokens.find(this._tokenService.predicateByHash(tokenHash));
|
|
315
319
|
if (!token) {
|
|
316
320
|
const { decimals, symbol, name, scripthash } = yield exports.DoraNeoRest.asset(tokenHash, this._network.id);
|
|
317
|
-
token =
|
|
321
|
+
token = this._tokenService.normalizeToken({
|
|
318
322
|
decimals: Number(decimals),
|
|
319
323
|
symbol,
|
|
320
324
|
name,
|
|
@@ -360,7 +364,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
360
364
|
}
|
|
361
365
|
}
|
|
362
366
|
exports.DoraBDSNeo3 = DoraBDSNeo3;
|
|
363
|
-
_DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataService = new WeakMap(), _DoraBDSNeo3_explorerService = new WeakMap(), _DoraBDSNeo3_instances = new WeakSet(), _DoraBDSNeo3_validateAddress = function _DoraBDSNeo3_validateAddress(address) {
|
|
367
|
+
_DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataService = new WeakMap(), _DoraBDSNeo3_explorerService = new WeakMap(), _DoraBDSNeo3_neo3NeoXBridgeService = new WeakMap(), _DoraBDSNeo3_instances = new WeakSet(), _DoraBDSNeo3_validateAddress = function _DoraBDSNeo3_validateAddress(address) {
|
|
364
368
|
return neon_js_1.wallet.isAddress(address, 53);
|
|
365
369
|
}, _DoraBDSNeo3_validateFullTransactionsByAddressParams = function _DoraBDSNeo3_validateFullTransactionsByAddressParams(params) {
|
|
366
370
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(this._network))
|
|
@@ -395,6 +399,8 @@ _DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataServic
|
|
|
395
399
|
if (!byteStringReceiverAddress)
|
|
396
400
|
return undefined;
|
|
397
401
|
const receiverAddress = `0x${neon_js_1.u.HexString.fromBase64(byteStringReceiverAddress).toLittleEndian()}`;
|
|
398
|
-
const token = isNativeToken ? BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN : BSNeo3Constants_1.BSNeo3Constants.NEO_TOKEN;
|
|
402
|
+
const token = __classPrivateFieldGet(this, _DoraBDSNeo3_neo3NeoXBridgeService, "f").tokens.find(this._tokenService.predicateByHash(isNativeToken ? BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN : BSNeo3Constants_1.BSNeo3Constants.NEO_TOKEN));
|
|
403
|
+
if (!token)
|
|
404
|
+
return undefined;
|
|
399
405
|
return { amount, token, receiverAddress };
|
|
400
406
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, ExportTransactionsByAddressParams, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, ExportTransactionsByAddressParams, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TokenService, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
3
|
export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
readonly _tokenCache: Map<string, Token>;
|
|
@@ -6,8 +6,9 @@ export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
|
6
6
|
readonly _claimToken: Token;
|
|
7
7
|
readonly _network: Network<BSNeo3NetworkId>;
|
|
8
8
|
readonly _tokens: Token[];
|
|
9
|
+
readonly _tokenService: TokenService;
|
|
9
10
|
maxTimeToConfirmTransactionInMs: number;
|
|
10
|
-
constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[]);
|
|
11
|
+
constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], tokenService: TokenService);
|
|
11
12
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
12
13
|
getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
13
14
|
getFullTransactionsByAddress(_params: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
|
|
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RpcBDSNeo3 = void 0;
|
|
13
|
-
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
14
13
|
const neon_core_1 = require("@cityofzion/neon-core");
|
|
15
14
|
const neon_dappkit_1 = require("@cityofzion/neon-dappkit");
|
|
16
15
|
const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
|
|
17
16
|
class RpcBDSNeo3 {
|
|
18
|
-
constructor(network, feeToken, claimToken, tokens) {
|
|
17
|
+
constructor(network, feeToken, claimToken, tokens, tokenService) {
|
|
19
18
|
this._tokenCache = new Map();
|
|
20
19
|
this._tokens = [];
|
|
21
20
|
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 2;
|
|
@@ -23,6 +22,7 @@ class RpcBDSNeo3 {
|
|
|
23
22
|
this._feeToken = feeToken;
|
|
24
23
|
this._claimToken = claimToken;
|
|
25
24
|
this._tokens = tokens;
|
|
25
|
+
this._tokenService = tokenService;
|
|
26
26
|
}
|
|
27
27
|
getTransaction(hash) {
|
|
28
28
|
var _a, _b;
|
|
@@ -92,7 +92,7 @@ class RpcBDSNeo3 {
|
|
|
92
92
|
if (cachedToken) {
|
|
93
93
|
return cachedToken;
|
|
94
94
|
}
|
|
95
|
-
let token = this._tokens.find(
|
|
95
|
+
let token = this._tokens.find(this._tokenService.predicateByHash(tokenHash));
|
|
96
96
|
if (!token) {
|
|
97
97
|
const rpcClient = new neon_core_1.rpc.RPCClient(this._network.url);
|
|
98
98
|
const contractState = yield rpcClient.getContractState(tokenHash);
|
|
@@ -115,7 +115,7 @@ class RpcBDSNeo3 {
|
|
|
115
115
|
throw new Error('Invalid symbol');
|
|
116
116
|
const decimals = Number(response.stack[0].value);
|
|
117
117
|
const symbol = neon_core_1.u.base642utf8(response.stack[1].value);
|
|
118
|
-
token =
|
|
118
|
+
token = this._tokenService.normalizeToken({
|
|
119
119
|
name: contractState.manifest.name,
|
|
120
120
|
symbol,
|
|
121
121
|
hash: contractState.hash,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ExchangeDataService, FlamingoForthewinEDS, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { ExchangeDataService, FlamingoForthewinEDS, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse, TokenService } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
3
|
export declare class FlamingoForthewinEDSNeo3 extends FlamingoForthewinEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
|
-
constructor(network: Network<BSNeo3NetworkId
|
|
5
|
+
constructor(network: Network<BSNeo3NetworkId>, tokenService: TokenService);
|
|
6
6
|
getTokenPrices(params: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
|
|
7
7
|
getTokenPriceHistory(params: GetTokenPriceHistoryParams): Promise<TokenPricesHistoryResponse[]>;
|
|
8
8
|
}
|
|
@@ -25,8 +25,8 @@ exports.FlamingoForthewinEDSNeo3 = void 0;
|
|
|
25
25
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
26
26
|
const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
|
|
27
27
|
class FlamingoForthewinEDSNeo3 extends blockchain_service_1.FlamingoForthewinEDS {
|
|
28
|
-
constructor(network) {
|
|
29
|
-
super();
|
|
28
|
+
constructor(network, tokenService) {
|
|
29
|
+
super(tokenService);
|
|
30
30
|
_FlamingoForthewinEDSNeo3_network.set(this, void 0);
|
|
31
31
|
__classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_network, network, "f");
|
|
32
32
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BuildNftUrlParams, ExplorerService, Network } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BuildNftUrlParams, ExplorerService, Network, TokenService } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
3
|
export declare class DoraESNeo3 implements ExplorerService {
|
|
4
4
|
#private;
|
|
5
|
-
constructor(network: Network<BSNeo3NetworkId
|
|
5
|
+
constructor(network: Network<BSNeo3NetworkId>, tokenService: TokenService);
|
|
6
6
|
buildTransactionUrl(hash: string): string;
|
|
7
7
|
buildContractUrl(contractHash: string): string;
|
|
8
|
-
buildNftUrl({
|
|
8
|
+
buildNftUrl({ collectionHash, tokenHash }: BuildNftUrlParams): string;
|
|
9
9
|
getAddressTemplateUrl(): string | undefined;
|
|
10
10
|
getTxTemplateUrl(): string | undefined;
|
|
11
11
|
getNftTemplateUrl(): string | undefined;
|
|
@@ -10,31 +10,33 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
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
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _DoraESNeo3_BASE_URL, _DoraESNeo3_network;
|
|
13
|
+
var _DoraESNeo3_BASE_URL, _DoraESNeo3_network, _DoraESNeo3_tokenService;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.DoraESNeo3 = void 0;
|
|
16
16
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
17
17
|
const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
|
|
18
18
|
class DoraESNeo3 {
|
|
19
|
-
constructor(network) {
|
|
19
|
+
constructor(network, tokenService) {
|
|
20
20
|
_DoraESNeo3_BASE_URL.set(this, blockchain_service_1.BSCommonConstants.DORA_URL);
|
|
21
21
|
_DoraESNeo3_network.set(this, void 0);
|
|
22
|
+
_DoraESNeo3_tokenService.set(this, void 0);
|
|
22
23
|
__classPrivateFieldSet(this, _DoraESNeo3_network, network, "f");
|
|
24
|
+
__classPrivateFieldSet(this, _DoraESNeo3_tokenService, tokenService, "f");
|
|
23
25
|
}
|
|
24
26
|
buildTransactionUrl(hash) {
|
|
25
27
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
26
28
|
throw new Error('DoraESNeo3 is only available on mainnet and testnet');
|
|
27
|
-
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/transaction/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${
|
|
29
|
+
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/transaction/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${__classPrivateFieldGet(this, _DoraESNeo3_tokenService, "f").normalizeHash(hash)}`;
|
|
28
30
|
}
|
|
29
31
|
buildContractUrl(contractHash) {
|
|
30
32
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
31
33
|
throw new Error('DoraESNeo3 is only available on mainnet and testnet');
|
|
32
|
-
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/contract/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${
|
|
34
|
+
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/contract/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${__classPrivateFieldGet(this, _DoraESNeo3_tokenService, "f").normalizeHash(contractHash)}`;
|
|
33
35
|
}
|
|
34
|
-
buildNftUrl({
|
|
36
|
+
buildNftUrl({ collectionHash, tokenHash }) {
|
|
35
37
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
36
38
|
throw new Error('DoraESNeo3 is only available on mainnet and testnet');
|
|
37
|
-
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/nft/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${
|
|
39
|
+
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/nft/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/${collectionHash}/${tokenHash}`;
|
|
38
40
|
}
|
|
39
41
|
getAddressTemplateUrl() {
|
|
40
42
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
@@ -49,7 +51,7 @@ class DoraESNeo3 {
|
|
|
49
51
|
getNftTemplateUrl() {
|
|
50
52
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
51
53
|
return undefined;
|
|
52
|
-
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/nft/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/{
|
|
54
|
+
return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/nft/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/{collectionHash}/{tokenHash}`;
|
|
53
55
|
}
|
|
54
56
|
getContractTemplateUrl() {
|
|
55
57
|
if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
|
|
@@ -58,4 +60,4 @@ class DoraESNeo3 {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
exports.DoraESNeo3 = DoraESNeo3;
|
|
61
|
-
_DoraESNeo3_BASE_URL = new WeakMap(), _DoraESNeo3_network = new WeakMap();
|
|
63
|
+
_DoraESNeo3_BASE_URL = new WeakMap(), _DoraESNeo3_network = new WeakMap(), _DoraESNeo3_tokenService = new WeakMap();
|
|
@@ -51,7 +51,7 @@ class Neo3NeoXBridgeService {
|
|
|
51
51
|
const invoker = yield neon_dappkit_1.NeonInvoker.init({
|
|
52
52
|
rpcAddress: __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").network.url,
|
|
53
53
|
});
|
|
54
|
-
const isNativeToken =
|
|
54
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(token)(BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN);
|
|
55
55
|
let invocations;
|
|
56
56
|
if (isNativeToken) {
|
|
57
57
|
invocations = [
|
|
@@ -132,7 +132,7 @@ class Neo3NeoXBridgeService {
|
|
|
132
132
|
scopes: 16,
|
|
133
133
|
allowedContracts: [this.BRIDGE_SCRIPT_HASH, BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN.hash],
|
|
134
134
|
};
|
|
135
|
-
const isNativeToken =
|
|
135
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token)(BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN);
|
|
136
136
|
if (!isNativeToken) {
|
|
137
137
|
(_a = contractInvocation.args) === null || _a === void 0 ? void 0 : _a.unshift({ type: 'Hash160', value: BSNeo3Constants_1.BSNeo3Constants.NEO_TOKEN.hash });
|
|
138
138
|
(_b = signer.allowedContracts) === null || _b === void 0 ? void 0 : _b.push(BSNeo3Constants_1.BSNeo3Constants.NEO_TOKEN.hash);
|
|
@@ -157,7 +157,7 @@ class Neo3NeoXBridgeService {
|
|
|
157
157
|
if ((log === null || log === void 0 ? void 0 : log.vmstate) !== 'HALT') {
|
|
158
158
|
throw new blockchain_service_1.BSError('Transaction invalid', 'INVALID_TRANSACTION');
|
|
159
159
|
}
|
|
160
|
-
const isNativeToken =
|
|
160
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token)(BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN);
|
|
161
161
|
let nonce = null;
|
|
162
162
|
if (isNativeToken) {
|
|
163
163
|
const notification = log.notifications.find(item => item.event_name === 'NativeDeposit');
|
|
@@ -177,7 +177,7 @@ class Neo3NeoXBridgeService {
|
|
|
177
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
178
|
let data;
|
|
179
179
|
try {
|
|
180
|
-
const isNativeToken =
|
|
180
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token)(BSNeo3Constants_1.BSNeo3Constants.GAS_TOKEN);
|
|
181
181
|
const response = yield axios_1.default.post('https://neofura.ngd.network', {
|
|
182
182
|
jsonrpc: '2.0',
|
|
183
183
|
method: 'GetBridgeTxByNonce',
|
|
@@ -9,5 +9,5 @@ export declare class GhostMarketNDSNeo3 extends RpcNDSNeo3 {
|
|
|
9
9
|
}>>;
|
|
10
10
|
constructor(network: Network<BSNeo3NetworkId>);
|
|
11
11
|
getNftsByAddress({ address, size, cursor }: GetNftsByAddressParams): Promise<NftsResponse>;
|
|
12
|
-
getNft({
|
|
12
|
+
getNft({ collectionHash, tokenHash }: GetNftParam): Promise<NftResponse>;
|
|
13
13
|
}
|
|
@@ -25,7 +25,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
var _GhostMarketNDSNeo3_instances, _GhostMarketNDSNeo3_network, _GhostMarketNDSNeo3_treatGhostMarketImage, _GhostMarketNDSNeo3_getUrlWithParams, _GhostMarketNDSNeo3_parse;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.GhostMarketNDSNeo3 = void 0;
|
|
28
|
-
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
29
28
|
const axios_1 = __importDefault(require("axios"));
|
|
30
29
|
const query_string_1 = __importDefault(require("query-string"));
|
|
31
30
|
const RpcNDSNeo3_1 = require("./RpcNDSNeo3");
|
|
@@ -49,11 +48,11 @@ class GhostMarketNDSNeo3 extends RpcNDSNeo3_1.RpcNDSNeo3 {
|
|
|
49
48
|
return { nextCursor: data.next, items: nfts.map(__classPrivateFieldGet(this, _GhostMarketNDSNeo3_instances, "m", _GhostMarketNDSNeo3_parse).bind(this)) };
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
|
-
getNft({
|
|
51
|
+
getNft({ collectionHash, tokenHash }) {
|
|
53
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
53
|
const url = __classPrivateFieldGet(this, _GhostMarketNDSNeo3_instances, "m", _GhostMarketNDSNeo3_getUrlWithParams).call(this, {
|
|
55
|
-
contract:
|
|
56
|
-
tokenIds: [
|
|
54
|
+
contract: collectionHash,
|
|
55
|
+
tokenIds: [tokenHash],
|
|
57
56
|
});
|
|
58
57
|
const { data } = yield axios_1.default.get(url);
|
|
59
58
|
return __classPrivateFieldGet(this, _GhostMarketNDSNeo3_instances, "m", _GhostMarketNDSNeo3_parse).call(this, data.assets[0]);
|
|
@@ -81,11 +80,13 @@ _GhostMarketNDSNeo3_network = new WeakMap(), _GhostMarketNDSNeo3_instances = new
|
|
|
81
80
|
}, _GhostMarketNDSNeo3_parse = function _GhostMarketNDSNeo3_parse(data) {
|
|
82
81
|
var _a, _b;
|
|
83
82
|
const nftResponse = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
hash: data.tokenId,
|
|
84
|
+
collection: {
|
|
85
|
+
hash: data.contract.hash,
|
|
86
|
+
name: (_a = data.collection) === null || _a === void 0 ? void 0 : _a.name,
|
|
87
|
+
image: __classPrivateFieldGet(this, _GhostMarketNDSNeo3_instances, "m", _GhostMarketNDSNeo3_treatGhostMarketImage).call(this, (_b = data.collection) === null || _b === void 0 ? void 0 : _b.logoUrl),
|
|
88
|
+
},
|
|
87
89
|
symbol: data.contract.symbol,
|
|
88
|
-
collectionName: (_b = data.collection) === null || _b === void 0 ? void 0 : _b.name,
|
|
89
90
|
image: __classPrivateFieldGet(this, _GhostMarketNDSNeo3_instances, "m", _GhostMarketNDSNeo3_treatGhostMarketImage).call(this, data.metadata.mediaUri),
|
|
90
91
|
isSVG: String(data.metadata.mediaType).includes('svg+xml'),
|
|
91
92
|
name: data.metadata.name,
|
|
@@ -5,5 +5,5 @@ export declare abstract class RpcNDSNeo3 implements NftDataService {
|
|
|
5
5
|
protected constructor(network: Network<BSNeo3NetworkId>);
|
|
6
6
|
abstract getNftsByAddress(params: GetNftsByAddressParams): Promise<NftsResponse>;
|
|
7
7
|
abstract getNft(params: GetNftParam): Promise<NftResponse>;
|
|
8
|
-
hasToken({
|
|
8
|
+
hasToken({ collectionHash, address }: HasTokenParam): Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -28,7 +28,7 @@ class RpcNDSNeo3 {
|
|
|
28
28
|
_RpcNDSNeo3_network.set(this, void 0);
|
|
29
29
|
__classPrivateFieldSet(this, _RpcNDSNeo3_network, network, "f");
|
|
30
30
|
}
|
|
31
|
-
hasToken({
|
|
31
|
+
hasToken({ collectionHash, address }) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
33
|
const parser = neon_dappkit_1.NeonParser;
|
|
34
34
|
const invoker = yield neon_dappkit_1.NeonInvoker.init({ rpcAddress: __classPrivateFieldGet(this, _RpcNDSNeo3_network, "f").url });
|
|
@@ -36,7 +36,7 @@ class RpcNDSNeo3 {
|
|
|
36
36
|
const result = yield invoker.testInvoke({
|
|
37
37
|
invocations: [
|
|
38
38
|
{
|
|
39
|
-
scriptHash:
|
|
39
|
+
scriptHash: collectionHash,
|
|
40
40
|
operation: 'balanceOf',
|
|
41
41
|
args: [
|
|
42
42
|
{
|
|
@@ -50,7 +50,7 @@ class RpcNDSNeo3 {
|
|
|
50
50
|
return parser.parseRpcResponse(result.stack[0], { type: 'Integer' }) > 0;
|
|
51
51
|
}
|
|
52
52
|
catch (_a) {
|
|
53
|
-
throw new Error(`Token not found: ${
|
|
53
|
+
throw new Error(`Token not found: ${collectionHash}`);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenServiceNeo3 = void 0;
|
|
4
|
+
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
5
|
+
class TokenServiceNeo3 extends blockchain_service_1.TokenService {
|
|
6
|
+
normalizeHash(hash) {
|
|
7
|
+
const fixed = hash.startsWith('0x') ? hash : `0x${hash}`;
|
|
8
|
+
return fixed.toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.TokenServiceNeo3 = TokenServiceNeo3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"isomorphic-ws": "^5.0.0",
|
|
22
22
|
"lodash.clonedeep": "^4.5.0",
|
|
23
23
|
"date-fns": "~4.1.0",
|
|
24
|
-
"@cityofzion/blockchain-service": "1.
|
|
24
|
+
"@cityofzion/blockchain-service": "1.21.0",
|
|
25
25
|
"@cityofzion/bs-asteroid-sdk": "0.9.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|