@cityofzion/bs-neo-legacy
Advanced tools
Comparing version 1.0.3 to 1.0.4
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, AccountWithDerivationPath, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service'; | ||
import { AvailableNetworkIds } from './BSNeoLegacyHelper'; | ||
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName, AvailableNetworkIds>, BSClaimable, BSWithExplorerService { | ||
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper'; | ||
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeoLegacyNetworkId>, BSClaimable, BSWithExplorerService { | ||
#private; | ||
@@ -14,6 +14,6 @@ readonly blockchainName: BSCustomName; | ||
tokens: Token[]; | ||
network: Network<AvailableNetworkIds>; | ||
network: Network<BSNeoLegacyNetworkId>; | ||
legacyNetwork: string; | ||
constructor(blockchainName: BSCustomName, network?: Network<AvailableNetworkIds>); | ||
setNetwork(network: Network<AvailableNetworkIds>): void; | ||
constructor(blockchainName: BSCustomName, network?: Network<BSNeoLegacyNetworkId>); | ||
setNetwork(network: Network<BSNeoLegacyNetworkId>): void; | ||
validateAddress(address: string): boolean; | ||
@@ -20,0 +20,0 @@ validateEncrypted(key: string): boolean; |
@@ -46,7 +46,9 @@ "use strict"; | ||
setNetwork(network) { | ||
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.ALL_NETWORK_IDS.includes(network.id)) | ||
throw new Error('Custom network is not supported'); | ||
__classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_setTokens).call(this, network); | ||
this.network = network; | ||
this.blockchainDataService = new DoraBDSNeoLegacy_1.DoraBDSNeoLegacy(network, this.feeToken, this.claimToken, this.tokens); | ||
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network.id, this.tokens); | ||
this.explorerService = new NeoTubeESNeoLegacy_1.NeoTubeESNeoLegacy(network.id); | ||
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network, this.tokens); | ||
this.explorerService = new NeoTubeESNeoLegacy_1.NeoTubeESNeoLegacy(network); | ||
} | ||
@@ -53,0 +55,0 @@ validateAddress(address) { |
@@ -1,3 +0,3 @@ | ||
import { Network } from '@cityofzion/blockchain-service'; | ||
export type AvailableNetworkIds = 'mainnet' | 'testnet'; | ||
import { Network, NetworkId } from '@cityofzion/blockchain-service'; | ||
export type BSNeoLegacyNetworkId = NetworkId<'mainnet' | 'testnet'>; | ||
export declare class BSNeoLegacyHelper { | ||
@@ -11,12 +11,13 @@ #private; | ||
}[]; | ||
static LEGACY_NETWORK_BY_NETWORK_ID: Record<AvailableNetworkIds, string>; | ||
static MAINNET_NETWORK_IDS: AvailableNetworkIds[]; | ||
static TESTNET_NETWORK_IDS: AvailableNetworkIds[]; | ||
static ALL_NETWORK_IDS: AvailableNetworkIds[]; | ||
static MAINNET_NETWORKS: Network<AvailableNetworkIds>[]; | ||
static TESTNET_NETWORKS: Network<AvailableNetworkIds>[]; | ||
static ALL_NETWORKS: Network<AvailableNetworkIds>[]; | ||
static LEGACY_NETWORK_BY_NETWORK_ID: Record<BSNeoLegacyNetworkId, string>; | ||
static MAINNET_NETWORK_IDS: BSNeoLegacyNetworkId[]; | ||
static TESTNET_NETWORK_IDS: BSNeoLegacyNetworkId[]; | ||
static ALL_NETWORK_IDS: BSNeoLegacyNetworkId[]; | ||
static MAINNET_NETWORKS: Network<BSNeoLegacyNetworkId>[]; | ||
static TESTNET_NETWORKS: Network<BSNeoLegacyNetworkId>[]; | ||
static ALL_NETWORKS: Network<BSNeoLegacyNetworkId>[]; | ||
static DERIVATION_PATH: string; | ||
static DEFAULT_NETWORK: Network<AvailableNetworkIds>; | ||
static getTokens(network: Network<AvailableNetworkIds>): { | ||
static DEFAULT_NETWORK: Network<BSNeoLegacyNetworkId>; | ||
static getLegacyNetwork(network: Network<BSNeoLegacyNetworkId>): string; | ||
static getTokens(network: Network<BSNeoLegacyNetworkId>): { | ||
symbol: string; | ||
@@ -27,3 +28,4 @@ name: string; | ||
}[]; | ||
static getRpcList(network: Network<AvailableNetworkIds>): string[]; | ||
static getRpcList(network: Network<BSNeoLegacyNetworkId>): string[]; | ||
static isMainnet(network: Network<BSNeoLegacyNetworkId>): boolean; | ||
} |
@@ -16,2 +16,8 @@ "use strict"; | ||
class BSNeoLegacyHelper { | ||
static getLegacyNetwork(network) { | ||
const legacyNetwork = this.LEGACY_NETWORK_BY_NETWORK_ID[network.id]; | ||
if (!legacyNetwork) | ||
throw new Error('Unsupported network'); | ||
return legacyNetwork; | ||
} | ||
static getTokens(network) { | ||
@@ -26,2 +32,5 @@ var _b; | ||
} | ||
static isMainnet(network) { | ||
return this.MAINNET_NETWORK_IDS.includes(network.id); | ||
} | ||
} | ||
@@ -28,0 +37,0 @@ exports.BSNeoLegacyHelper = BSNeoLegacyHelper; |
@@ -1,8 +0,8 @@ | ||
import { CryptoCompareEDS, Currency, ExchangeDataService, GetTokenPriceHistory, Token, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service'; | ||
import { AvailableNetworkIds } from './BSNeoLegacyHelper'; | ||
import { CryptoCompareEDS, Currency, ExchangeDataService, GetTokenPriceHistory, Network, Token, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service'; | ||
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper'; | ||
export declare class CryptoCompareEDSNeoLegacy extends CryptoCompareEDS implements ExchangeDataService { | ||
#private; | ||
constructor(networkId: AvailableNetworkIds, tokens: Token[]); | ||
constructor(network: Network<BSNeoLegacyNetworkId>, tokens: Token[]); | ||
getTokenPriceHistory(params: GetTokenPriceHistory): Promise<TokenPricesHistoryResponse[]>; | ||
getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>; | ||
} |
@@ -22,11 +22,12 @@ "use strict"; | ||
}; | ||
var _CryptoCompareEDSNeoLegacy_networkId; | ||
var _CryptoCompareEDSNeoLegacy_network; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CryptoCompareEDSNeoLegacy = void 0; | ||
const blockchain_service_1 = require("@cityofzion/blockchain-service"); | ||
const BSNeoLegacyHelper_1 = require("./BSNeoLegacyHelper"); | ||
class CryptoCompareEDSNeoLegacy extends blockchain_service_1.CryptoCompareEDS { | ||
constructor(networkId, tokens) { | ||
constructor(network, tokens) { | ||
super(tokens); | ||
_CryptoCompareEDSNeoLegacy_networkId.set(this, void 0); | ||
__classPrivateFieldSet(this, _CryptoCompareEDSNeoLegacy_networkId, networkId, "f"); | ||
_CryptoCompareEDSNeoLegacy_network.set(this, void 0); | ||
__classPrivateFieldSet(this, _CryptoCompareEDSNeoLegacy_network, network, "f"); | ||
} | ||
@@ -38,3 +39,3 @@ getTokenPriceHistory(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_networkId, "f") !== 'mainnet') | ||
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_network, "f"))) | ||
throw new Error('Exchange is only available on mainnet'); | ||
@@ -49,3 +50,3 @@ return yield _super.getTokenPriceHistory.call(this, params); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_networkId, "f") !== 'mainnet') | ||
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_network, "f"))) | ||
throw new Error('Exchange is only available on mainnet'); | ||
@@ -57,2 +58,2 @@ return yield _super.getTokenPrices.call(this, currency); | ||
exports.CryptoCompareEDSNeoLegacy = CryptoCompareEDSNeoLegacy; | ||
_CryptoCompareEDSNeoLegacy_networkId = new WeakMap(); | ||
_CryptoCompareEDSNeoLegacy_network = new WeakMap(); |
import { BalanceResponse, BlockchainDataService, ContractResponse, TransactionsByAddressParams, TransactionsByAddressResponse, TransactionResponse, BDSClaimable, Token, Network, RpcResponse } from '@cityofzion/blockchain-service'; | ||
import { AvailableNetworkIds } from './BSNeoLegacyHelper'; | ||
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper'; | ||
export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable { | ||
#private; | ||
maxTimeToConfirmTransactionInMs: number; | ||
constructor(network: Network<AvailableNetworkIds>, feeToken: Token, claimToken: Token, tokens: Token[]); | ||
constructor(network: Network<BSNeoLegacyNetworkId>, feeToken: Token, claimToken: Token, tokens: Token[]); | ||
getTransaction(hash: string): Promise<TransactionResponse>; | ||
@@ -8,0 +8,0 @@ getTransactionsByAddress({ address, page, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>; |
@@ -1,7 +0,6 @@ | ||
import { BuildNftUrlParams, ExplorerService } from '@cityofzion/blockchain-service'; | ||
import { AvailableNetworkIds } from './BSNeoLegacyHelper'; | ||
import { BuildNftUrlParams, ExplorerService, Network } from '@cityofzion/blockchain-service'; | ||
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper'; | ||
export declare class NeoTubeESNeoLegacy implements ExplorerService { | ||
#private; | ||
static SUPPORTED_NETWORKS: AvailableNetworkIds[]; | ||
constructor(networkId: AvailableNetworkIds); | ||
constructor(network: Network<BSNeoLegacyNetworkId>); | ||
buildTransactionUrl(hash: string): string; | ||
@@ -8,0 +7,0 @@ buildContractUrl(contractHash: string): string; |
@@ -13,26 +13,26 @@ "use strict"; | ||
}; | ||
var _NeoTubeESNeoLegacy_networkId; | ||
var _NeoTubeESNeoLegacy_network; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NeoTubeESNeoLegacy = void 0; | ||
const BSNeoLegacyHelper_1 = require("./BSNeoLegacyHelper"); | ||
class NeoTubeESNeoLegacy { | ||
constructor(networkId) { | ||
_NeoTubeESNeoLegacy_networkId.set(this, void 0); | ||
__classPrivateFieldSet(this, _NeoTubeESNeoLegacy_networkId, networkId, "f"); | ||
constructor(network) { | ||
_NeoTubeESNeoLegacy_network.set(this, void 0); | ||
__classPrivateFieldSet(this, _NeoTubeESNeoLegacy_network, network, "f"); | ||
} | ||
buildTransactionUrl(hash) { | ||
if (!NeoTubeESNeoLegacy.SUPPORTED_NETWORKS.includes(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_networkId, "f"))) | ||
throw new Error('Unsupported network'); | ||
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_network, "f"))) | ||
throw new Error('NeoTube is only available on mainnet'); | ||
return `https://neo2.neotube.io/transaction/${hash}`; | ||
} | ||
buildContractUrl(contractHash) { | ||
if (!NeoTubeESNeoLegacy.SUPPORTED_NETWORKS.includes(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_networkId, "f"))) | ||
throw new Error('Unsupported network'); | ||
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_network, "f"))) | ||
throw new Error('NeoTube is only available on mainnet'); | ||
return `https://neo2.neotube.io/asset/${contractHash}/page/1`; | ||
} | ||
buildNftUrl(_params) { | ||
throw new Error('DoraESNeoLegacy does not support nft'); | ||
throw new Error('NeoTube does not support nft'); | ||
} | ||
} | ||
exports.NeoTubeESNeoLegacy = NeoTubeESNeoLegacy; | ||
_NeoTubeESNeoLegacy_networkId = new WeakMap(); | ||
NeoTubeESNeoLegacy.SUPPORTED_NETWORKS = ['mainnet']; | ||
_NeoTubeESNeoLegacy_network = new WeakMap(); |
{ | ||
"name": "@cityofzion/bs-neo-legacy", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/index.js", | ||
@@ -14,3 +14,3 @@ "types": "dist/index.d.ts", | ||
"@cityofzion/neon-js": "4.8.3", | ||
"@cityofzion/blockchain-service": "1.0.1", | ||
"@cityofzion/blockchain-service": "1.0.2", | ||
"@cityofzion/bs-asteroid-sdk": "0.9.0" | ||
@@ -17,0 +17,0 @@ }, |
48977
1147