diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f217bc5..a04d00f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [4.2.36] - 2024.7.18 + +### Added + +- Support for Ton mainnet & testnet + ## [4.2.35] - 2024.6.18 ### Updated diff --git a/package.json b/package.json index f4ae6629c..011cb62bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum", - "version": "4.2.35", + "version": "4.2.36", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", diff --git a/src/dto/AddressEventNotificationChain.ts b/src/dto/AddressEventNotificationChain.ts index 6fe8f3122..9315ff9bd 100644 --- a/src/dto/AddressEventNotificationChain.ts +++ b/src/dto/AddressEventNotificationChain.ts @@ -18,4 +18,6 @@ export enum AddressEventNotificationChain { CRO = 'CRO', BASE = 'BASE', AVAX = 'AVAX', + FTM = 'FTM', + OPTIMISM = 'OPTIMISM', } diff --git a/src/dto/Currency.ts b/src/dto/Currency.ts index 1cc21419e..c437d1c0d 100644 --- a/src/dto/Currency.ts +++ b/src/dto/Currency.ts @@ -52,6 +52,7 @@ export enum Currency { ATOM = 'ATOM', IOTA = 'IOTA', CSPR = 'CSPR', + TON = 'TON' } export function networkToCurrency(network: Network): Currency { diff --git a/src/dto/Network.ts b/src/dto/Network.ts index 6b2499d4d..76a1fa610 100644 --- a/src/dto/Network.ts +++ b/src/dto/Network.ts @@ -56,6 +56,7 @@ export enum Network { ZILLIQA = 'zilliqa-mainnet', BITCOIN_ELECTRS = 'bitcoin-mainnet-electrs', CASPER = 'casper-mainnet', + TON = 'ton-mainnet', // Testnets @@ -110,6 +111,7 @@ export enum Network { IOTA_TESTNET = 'iota-testnet', BITCOIN_ELECTRS_TESTNET = 'bitcoin-testnet-electrs', ROSTRUM_TESTNET = 'bch-testnet-rostrum', + TON_TESTNET = 'ton-testnet' } export const EVM_BASED_NETWORKS = [ @@ -267,6 +269,7 @@ export const IOTA_LOAD_BALANCER_NETWORKS = [Network.IOTA] export const BITCOIN_ELECTRS_NETWORKS = [Network.BITCOIN_ELECTRS, Network.BITCOIN_ELECTRS_TESTNET] export const IOTA_NETWORKS = [Network.IOTA, Network.IOTA_TESTNET] export const CASPER_NETWORKS = [Network.CASPER] +export const TON_NETWORKS = [Network.TON, Network.TON_TESTNET] export const LOAD_BALANCER_NETWORKS = [ ...UTXO_LOAD_BALANCER_NETWORKS, @@ -288,6 +291,7 @@ export const LOAD_BALANCER_NETWORKS = [ ...IOTA_LOAD_BALANCER_NETWORKS, ...BITCOIN_ELECTRS_NETWORKS, ...CASPER_NETWORKS, + ...TON_NETWORKS, ] export const EVM_ARCHIVE_NON_ARCHIVE_LOAD_BALANCER_NETWORKS = [ @@ -388,6 +392,8 @@ export const isElectrsNetwork = (network: Network) => BITCOIN_ELECTRS_NETWORKS.i export const isCasperNetwork = (network: Network) => CASPER_NETWORKS.includes(network) +export const isTonNetwork = (network: Network) => TON_NETWORKS.includes(network) + export const isSameGetBlockNetwork = (network: Network) => isUtxoBasedNetwork(network) || isEvmBasedNetwork(network) || @@ -960,5 +966,13 @@ export const NETWORK_METADATA: Record = { [Network.CASPER]: { currency: Currency.CSPR, testnet: false, + }, + [Network.TON]: { + currency: Currency.TON, + testnet: false, + }, + [Network.TON_TESTNET]: { + currency: Currency.TON, + testnet: true } } diff --git a/src/dto/rpc/ton/TonRpcSuite.ts b/src/dto/rpc/ton/TonRpcSuite.ts new file mode 100644 index 000000000..956770cc5 --- /dev/null +++ b/src/dto/rpc/ton/TonRpcSuite.ts @@ -0,0 +1,542 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { BlockchainAccountInspect } from './models/BlockchainAccountInspect'; +import type { BlockchainBlock } from './models/BlockchainBlock'; +import type { BlockchainBlocks } from './models/BlockchainBlocks'; +import type { BlockchainBlockShards } from './models/BlockchainBlockShards'; +import type { BlockchainConfig } from './models/BlockchainConfig'; +import type { BlockchainRawAccount } from './models/BlockchainRawAccount'; +import type { MethodExecutionResult } from './models/MethodExecutionResult'; +import type { RawBlockchainConfig } from './models/RawBlockchainConfig'; +import type { ReducedBlocks } from './models/ReducedBlocks'; +import type { ServiceStatus } from './models/ServiceStatus'; +import type { Transaction } from './models/Transaction'; +import type { Transactions } from './models/Transactions'; +import type { Validators } from './models/Validators'; +import type { Account } from './models/Account'; +import type { AccountEvents } from './models/AccountEvents'; +import type { Accounts } from './models/Accounts'; +import type { DnsExpiring } from './models/DnsExpiring'; +import type { DomainNames } from './models/DomainNames'; +import type { FoundAccounts } from './models/FoundAccounts'; +import type { JettonBalance } from './models/JettonBalance'; +import type { JettonsBalances } from './models/JettonsBalances'; +import type { Multisigs } from './models/Multisigs'; +import type { NftItems } from './models/NftItems'; +import type { Subscriptions } from './models/Subscriptions'; +import type { TraceIDs } from './models/TraceIDs'; +import type { AccountInfoByStateInit } from './models/AccountInfoByStateInit'; +import type { Auctions } from './models/Auctions'; +import type { DnsRecord } from './models/DnsRecord'; +import type { DomainBids } from './models/DomainBids'; +import type { DomainInfo } from './models/DomainInfo'; +import type { AccountEvent } from './models/AccountEvent'; +import type { DecodedMessage } from './models/DecodedMessage'; +import type { Event } from './models/Event'; +import type { MessageConsequences } from './models/MessageConsequences'; +import type { Trace } from './models/Trace'; +import type { GaslessConfig } from './models/GaslessConfig'; +import type { SignRawParams } from './models/SignRawParams'; +import type { InscriptionBalances } from './models/InscriptionBalances'; +import type { JettonHolders } from './models/JettonHolders'; +import type { JettonInfo } from './models/JettonInfo'; +import type { Jettons } from './models/Jettons'; +import type { BlockRaw } from './models/BlockRaw'; +import type { InitStateRaw } from './models/InitStateRaw'; +import type { Multisig } from './models/Multisig'; +import type { NftCollection } from './models/NftCollection'; +import type { NftCollections } from './models/NftCollections'; +import type { MarketTonRates } from './models/MarketTonRates'; +import type { TokenRates } from './models/TokenRates'; +import type { AccountStaking } from './models/AccountStaking'; +import type { ApyHistory } from './models/ApyHistory'; +import type { PoolImplementation } from './models/PoolImplementation'; +import type { PoolInfo } from './models/PoolInfo'; +import type { StorageProvider } from './models/StorageProvider'; +import type { Seqno } from './models/Seqno'; +import { NftItem } from './models/NftItem' + +export interface TonRpcSuite { + status(): Promise; + + getReducedBlockchainBlocks( + from: number, + to: number + ): Promise; + + getBlockchainBlock(blockId: string): Promise; + + getBlockchainMasterchainShards(masterchainSeqno: number): Promise; + + getBlockchainMasterchainBlocks(masterchainSeqno: number): Promise; + + getBlockchainMasterchainTransactions(masterchainSeqno: number): Promise; + + getBlockchainConfigFromBlock(masterchainSeqno: number): Promise; + + getRawBlockchainConfigFromBlock(masterchainSeqno: number): Promise; + + getBlockchainBlockTransactions(blockId: string): Promise; + + getBlockchainTransaction(transactionId: string): Promise; + + getBlockchainTransactionByMessageHash(msgId: string): Promise; + + getBlockchainValidators(): Promise; + + getBlockchainMasterchainHead(): Promise; + + getBlockchainRawAccount(accountId: string): Promise; + + getBlockchainAccountTransactions( + accountId: string, + afterLt?: number, + beforeLt?: number, + limit?: number, + sortOrder?: 'desc' | 'asc' + ): Promise; + + execGetMethodForBlockchainAccount( + accountId: string, + methodName: string, + args?: Array + ): Promise; + + sendBlockchainMessage(requestBody: { boc?: string; batch?: Array }): Promise; + + getBlockchainConfig(): Promise; + + getRawBlockchainConfig(): Promise; + + blockchainAccountInspect(accountId: string): Promise; + + addressParse(accountId: string): Promise<{ + raw_form: string; + bounceable: { + b64: string; + b64url: string; + }; + non_bounceable: { + b64: string; + b64url: string; + }; + given_type: string; + test_only: boolean; + }>; + + getAccounts( + currency?: string, + requestBody?: { + account_ids: Array; + } + ): Promise; + + getAccount(accountId: string): Promise; + + accountDnsBackResolve(accountId: string): Promise; + + getAccountJettonsBalances( + accountId: string, + currencies?: Array + ): Promise; + + getAccountJettonBalance( + accountId: string, + jettonId: string, + currencies?: Array + ): Promise; + + getAccountJettonsHistory( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise; + + getAccountJettonHistoryById( + accountId: string, + jettonId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise; + + getAccountNftItems( + accountId: string, + collection?: string, + limit?: number, + indirectOwnership?: boolean, + offset?: number + ): Promise; + + getAccountEvents( + accountId: string, + limit: number, + initiator?: boolean, + subjectOnly?: boolean, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise; + + getAccountEvent( + accountId: string, + eventId: string, + subjectOnly?: boolean + ): Promise; + + getAccountTraces( + accountId: string, + beforeLt?: number, + limit?: number + ): Promise; + + getAccountSubscriptions(accountId: string): Promise; + + reindexAccount(accountId: string): Promise; + + searchAccounts(name: string): Promise; + + getAccountDnsExpiring(accountId: string, period?: number): Promise; + + getAccountPublicKey(accountId: string): Promise<{ public_key: string }>; + + getAccountMultisigs(accountId: string): Promise; + + getAccountDiff(accountId: string, startDate: number, endDate: number): Promise<{ balance_change: number }>; + + + // Connect + getTonConnectPayload(): Promise<{ payload: string }>; + + getAccountInfoByStateInit(requestBody: { state_init: string }): Promise; + + // DNS + getDnsInfo(domainName: string): Promise; + + dnsResolve(domainName: string): Promise; + + getDomainBids(domainName: string): Promise; + + getAllAuctions(tld?: string): Promise; + + // Emulation + decodeMessage(requestBody: { boc: string }): Promise; + + emulateMessageToEvent( + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise; + + emulateMessageToTrace( + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise; + + emulateMessageToWallet( + requestBody: { + boc: string; + params?: Array<{ + address: string; + balance?: number; + }>; + }, + acceptLanguage?: string + ): Promise; + + emulateMessageToAccountEvent( + accountId: string, + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise; + + // Events + getEvent( + eventId: string, + acceptLanguage?: string + ): Promise; + + // GasLess + gaslessConfig(): Promise; + + gaslessEstimate( + masterId: string, + requestBody: { + wallet_address: string; + wallet_public_key: string; + messages: Array<{ boc: string }>; + } + ): Promise; + + gaslessSend( + requestBody: { + wallet_public_key: string; + boc: string; + } + ): Promise; + + // Inscriptions + getAccountInscriptions( + accountId: string, + limit?: number, + offset?: number + ): Promise; + + getAccountInscriptionsHistory( + accountId: string, + beforeLt?: number, + limit?: number + ): Promise; + + getAccountInscriptionsHistoryByTicker( + accountId: string, + ticker: string, + beforeLt?: number, + limit?: number + ): Promise; + + getInscriptionOpTemplate( + type: 'ton20' | 'gram20', + operation: 'transfer', + amount: string, + ticker: string, + who: string, + destination?: string, + comment?: string + ): Promise<{ comment: string; destination: string }>; + + // Jettons + getJettons(limit?: number, offset?: number): Promise; + + getJettonInfo(accountId: string): Promise; + + getJettonHolders(accountId: string, limit?: number, offset?: number): Promise; + + getJettonsEvents(eventId: string, acceptLanguage?: string): Promise; + + // LiteServer + + getRawMasterchainInfo(): Promise<{ + last: BlockRaw; + state_root_hash: string; + init: InitStateRaw; + }>; + + getRawMasterchainInfoExt(mode: number): Promise<{ + mode: number; + version: number; + capabilities: number; + last: BlockRaw; + last_utime: number; + now: number; + state_root_hash: string; + init: InitStateRaw; + }>; + + getRawTime(): Promise<{ time: number }>; + + getRawBlockchainBlock(blockId: string): Promise<{ + id: BlockRaw; + data: string; + }>; + + getRawBlockchainBlockState(blockId: string): Promise<{ + id: BlockRaw; + root_hash: string; + file_hash: string; + data: string; + }>; + + getRawBlockchainBlockHeader(blockId: string, mode: number): Promise<{ + id: BlockRaw; + mode: number; + header_proof: string; + }>; + + sendRawMessage(requestBody: { body: string }): Promise<{ code: number }>; + + getRawAccountState(accountId: string, targetBlock?: string): Promise<{ + id: BlockRaw; + shardblk: BlockRaw; + shard_proof: string; + proof: string; + state: string; + }>; + + getRawShardInfo(blockId: string, workchain: number, shard: number, exact: boolean): Promise<{ + id: BlockRaw; + shardblk: BlockRaw; + shard_proof: string; + shard_descr: string; + }>; + + getAllRawShardsInfo(blockId: string): Promise<{ + id: BlockRaw; + proof: string; + data: string; + }>; + + getRawTransactions(accountId: string, count: number, lt: number, hash: string): Promise<{ + ids: Array; + transactions: string; + }>; + + getRawListBlockTransactions( + blockId: string, + mode: number, + count: number, + accountId?: string, + lt?: number + ): Promise<{ + id: BlockRaw; + req_count: number; + incomplete: boolean; + ids: Array<{ + mode: number; + account?: string; + lt?: number; + hash?: string; + }>; + proof: string; + }>; + + getRawBlockProof(knownBlock: string, mode: number, targetBlock?: string): Promise<{ + complete: boolean; + from: BlockRaw; + to: BlockRaw; + steps: Array<{ + lite_server_block_link_back: { + to_key_block: boolean; + from: BlockRaw; + to: BlockRaw; + dest_proof: string; + proof: string; + state_proof: string; + }; + lite_server_block_link_forward: { + to_key_block: boolean; + from: BlockRaw; + to: BlockRaw; + dest_proof: string; + config_proof: string; + signatures: { + validator_set_hash: number; + catchain_seqno: number; + signatures: Array<{ + node_id_short: string; + signature: string; + }>; + }; + }; + }>; + }>; + + getRawConfig(blockId: string, mode: number): Promise<{ + mode: number; + id: BlockRaw; + state_proof: string; + config_proof: string; + }>; + + getRawShardBlockProof(blockId: string): Promise<{ + masterchain_id: BlockRaw; + links: Array<{ + id: BlockRaw; + proof: string; + }>; + }>; + + getOutMsgQueueSizes(): Promise<{ + ext_msg_queue_size_limit: number; + shards: Array<{ + id: BlockRaw; + size: number; + }>; + }>; + + // Multisig + getMultisigAccount(accountId: string): Promise; + + // NFT + getAccountNftHistory( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise; + + getNftCollections(limit?: number, offset?: number): Promise; + + getNftCollection(accountId: string): Promise; + + getItemsFromCollection(accountId: string, limit?: number, offset?: number): Promise; + + getNftItemsByAddresses(requestBody?: { account_ids: Array }): Promise; + + getNftItemByAddress(accountId: string): Promise; + + getNftHistoryById( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise; + + // Rates + getRates(tokens: Array, currencies: Array): Promise<{ rates: Record }>; + + getChartRates( + token: string, + currency?: string, + startDate?: number, + endDate?: number, + pointsCount?: number + ): Promise<{ points: any }>; + + getMarketsRates(): Promise<{ markets: Array }>; + + // Staking + getAccountNominatorsPools(accountId: string): Promise; + + getStakingPoolInfo(accountId: string): Promise<{ implementation: PoolImplementation; pool: PoolInfo }>; + + getStakingPoolHistory(accountId: string): Promise<{ apy: Array }>; + + getStakingPools( + availableFor?: string, + includeUnverified?: boolean + ): Promise<{ pools: Array; implementations: Record }>; + + + // Storage + getStorageProviders(): Promise<{ providers: Array }>; + + // Trace + getTrace(traceId: string): Promise; + + // Wallet + getWalletBackup(xTonConnectAuth: string): Promise<{ dump: string }>; + + setWalletBackup(xTonConnectAuth: string, requestBody: Blob): Promise; + + tonConnectProof(requestBody: { + address: string; + proof: { + timestamp: number; + domain: { + length_bytes?: number; + value: string; + }; + signature: string; + payload: string; + state_init?: string; + }; + }): Promise<{ token: string }>; + + getWalletsByPublicKey(publicKey: string): Promise; + + getAccountSeqno(accountId: string): Promise; +} diff --git a/src/dto/rpc/ton/models/AccStatusChange.ts b/src/dto/rpc/ton/models/AccStatusChange.ts new file mode 100644 index 000000000..771cfe30f --- /dev/null +++ b/src/dto/rpc/ton/models/AccStatusChange.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccStatusChange = 'acst_unchanged' | 'acst_frozen' | 'acst_deleted'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/Account.ts b/src/dto/rpc/ton/models/Account.ts new file mode 100644 index 000000000..efb41935f --- /dev/null +++ b/src/dto/rpc/ton/models/Account.ts @@ -0,0 +1,27 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountStatus } from './AccountStatus'; + +export type Account = { + address: string; + balance: number; + /** + * {'USD': 1, 'IDR': 1000} + */ + currencies_balance?: any; + /** + * unix timestamp + */ + last_activity: number; + status: AccountStatus; + interfaces?: Array; + name?: string; + is_scam?: boolean; + icon?: string; + memo_required?: boolean; + get_methods: Array; + is_suspended?: boolean; + is_wallet: boolean; +}; diff --git a/src/dto/rpc/ton/models/AccountAddress.ts b/src/dto/rpc/ton/models/AccountAddress.ts new file mode 100644 index 000000000..a50f5cf18 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountAddress.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccountAddress = { + address: string; + /** + * Display name. Data collected from different sources like moderation lists, dns, collections names and over. + */ + name?: string; + /** + * Is this account was marked as part of scammers activity + */ + is_scam: boolean; + icon?: string; + is_wallet: boolean; +}; diff --git a/src/dto/rpc/ton/models/AccountEvent.ts b/src/dto/rpc/ton/models/AccountEvent.ts new file mode 100644 index 000000000..5da00c454 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountEvent.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { Action } from './Action'; + +/** + * An event is built on top of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the trace into actions, where a single action represents a meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not to build any logic on top of actions because actions can be changed at any time. + */ +export type AccountEvent = { + event_id: string; + account: AccountAddress; + timestamp: number; + actions: Array; + /** + * scam + */ + is_scam: boolean; + lt: number; + /** + * Event is not finished yet. Transactions still happening + */ + in_progress: boolean; + /** + * TODO + */ + extra: number; +}; diff --git a/src/dto/rpc/ton/models/AccountEvents.ts b/src/dto/rpc/ton/models/AccountEvents.ts new file mode 100644 index 000000000..5f741c81c --- /dev/null +++ b/src/dto/rpc/ton/models/AccountEvents.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountEvent } from './AccountEvent'; + +export type AccountEvents = { + events: Array; + next_from: number; +}; diff --git a/src/dto/rpc/ton/models/AccountInfoByStateInit.ts b/src/dto/rpc/ton/models/AccountInfoByStateInit.ts new file mode 100644 index 000000000..9772b5fe4 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountInfoByStateInit.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccountInfoByStateInit = { + public_key: string; + address: string; +}; diff --git a/src/dto/rpc/ton/models/AccountStaking.ts b/src/dto/rpc/ton/models/AccountStaking.ts new file mode 100644 index 000000000..1420b29f6 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountStaking.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountStakingInfo } from './AccountStakingInfo'; + +export type AccountStaking = { + pools: Array; +}; diff --git a/src/dto/rpc/ton/models/AccountStakingInfo.ts b/src/dto/rpc/ton/models/AccountStakingInfo.ts new file mode 100644 index 000000000..f3f02a9b1 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountStakingInfo.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccountStakingInfo = { + pool: string; + amount: number; + pending_deposit: number; + pending_withdraw: number; + ready_withdraw: number; +}; diff --git a/src/dto/rpc/ton/models/AccountStatus.ts b/src/dto/rpc/ton/models/AccountStatus.ts new file mode 100644 index 000000000..42c9e820e --- /dev/null +++ b/src/dto/rpc/ton/models/AccountStatus.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccountStatus = 'nonexist' | 'uninit' | 'active' | 'frozen'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/AccountStorageInfo.ts b/src/dto/rpc/ton/models/AccountStorageInfo.ts new file mode 100644 index 000000000..868c6bb95 --- /dev/null +++ b/src/dto/rpc/ton/models/AccountStorageInfo.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type AccountStorageInfo = { + used_cells: number; + used_bits: number; + used_public_cells: number; + /** + * time of the last payment + */ + last_paid: number; + due_payment: number; +}; diff --git a/src/dto/rpc/ton/models/Accounts.ts b/src/dto/rpc/ton/models/Accounts.ts new file mode 100644 index 000000000..6a0b241b7 --- /dev/null +++ b/src/dto/rpc/ton/models/Accounts.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Account } from './Account'; + +export type Accounts = { + accounts: Array; +}; diff --git a/src/dto/rpc/ton/models/Action.ts b/src/dto/rpc/ton/models/Action.ts new file mode 100644 index 000000000..c8bd12a97 --- /dev/null +++ b/src/dto/rpc/ton/models/Action.ts @@ -0,0 +1,52 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ActionSimplePreview } from './ActionSimplePreview'; +import type { AuctionBidAction } from './AuctionBidAction'; +import type { ContractDeployAction } from './ContractDeployAction'; +import type { DepositStakeAction } from './DepositStakeAction'; +import type { DomainRenewAction } from './DomainRenewAction'; +import type { ElectionsDepositStakeAction } from './ElectionsDepositStakeAction'; +import type { ElectionsRecoverStakeAction } from './ElectionsRecoverStakeAction'; +import type { InscriptionMintAction } from './InscriptionMintAction'; +import type { InscriptionTransferAction } from './InscriptionTransferAction'; +import type { JettonBurnAction } from './JettonBurnAction'; +import type { JettonMintAction } from './JettonMintAction'; +import type { JettonSwapAction } from './JettonSwapAction'; +import type { JettonTransferAction } from './JettonTransferAction'; +import type { NftItemTransferAction } from './NftItemTransferAction'; +import type { NftPurchaseAction } from './NftPurchaseAction'; +import type { SmartContractAction } from './SmartContractAction'; +import type { SubscriptionAction } from './SubscriptionAction'; +import type { TonTransferAction } from './TonTransferAction'; +import type { UnSubscriptionAction } from './UnSubscriptionAction'; +import type { WithdrawStakeAction } from './WithdrawStakeAction'; +import type { WithdrawStakeRequestAction } from './WithdrawStakeRequestAction'; + +export type Action = { + type: 'TonTransfer' | 'JettonTransfer' | 'JettonBurn' | 'JettonMint' | 'NftItemTransfer' | 'ContractDeploy' | 'Subscribe' | 'UnSubscribe' | 'AuctionBid' | 'NftPurchase' | 'DepositStake' | 'WithdrawStake' | 'WithdrawStakeRequest' | 'JettonSwap' | 'SmartContractExec' | 'ElectionsRecoverStake' | 'ElectionsDepositStake' | 'DomainRenew' | 'InscriptionTransfer' | 'InscriptionMint' | 'Unknown'; + status: 'ok' | 'failed'; + TonTransfer?: TonTransferAction; + ContractDeploy?: ContractDeployAction; + JettonTransfer?: JettonTransferAction; + JettonBurn?: JettonBurnAction; + JettonMint?: JettonMintAction; + NftItemTransfer?: NftItemTransferAction; + Subscribe?: SubscriptionAction; + UnSubscribe?: UnSubscriptionAction; + AuctionBid?: AuctionBidAction; + NftPurchase?: NftPurchaseAction; + DepositStake?: DepositStakeAction; + WithdrawStake?: WithdrawStakeAction; + WithdrawStakeRequest?: WithdrawStakeRequestAction; + ElectionsDepositStake?: ElectionsDepositStakeAction; + ElectionsRecoverStake?: ElectionsRecoverStakeAction; + JettonSwap?: JettonSwapAction; + SmartContractExec?: SmartContractAction; + DomainRenew?: DomainRenewAction; + InscriptionTransfer?: InscriptionTransferAction; + InscriptionMint?: InscriptionMintAction; + simple_preview: ActionSimplePreview; + base_transactions: Array; +}; diff --git a/src/dto/rpc/ton/models/ActionPhase.ts b/src/dto/rpc/ton/models/ActionPhase.ts new file mode 100644 index 000000000..25d555b11 --- /dev/null +++ b/src/dto/rpc/ton/models/ActionPhase.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ActionPhase = { + success: boolean; + result_code: number; + total_actions: number; + skipped_actions: number; + fwd_fees: number; + total_fees: number; + result_code_description?: string; +}; diff --git a/src/dto/rpc/ton/models/ActionSimplePreview.ts b/src/dto/rpc/ton/models/ActionSimplePreview.ts new file mode 100644 index 000000000..073857245 --- /dev/null +++ b/src/dto/rpc/ton/models/ActionSimplePreview.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +/** + * shortly describes what this action is about. + */ +export type ActionSimplePreview = { + name: string; + description: string; + /** + * a link to an image for this particular action. + */ + action_image?: string; + value?: string; + /** + * a link to an image that depicts this action's asset. + */ + value_image?: string; + accounts: Array; +}; diff --git a/src/dto/rpc/ton/models/ApyHistory.ts b/src/dto/rpc/ton/models/ApyHistory.ts new file mode 100644 index 000000000..f357dc8cb --- /dev/null +++ b/src/dto/rpc/ton/models/ApyHistory.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ApyHistory = { + apy: number; + time: number; +}; diff --git a/src/dto/rpc/ton/models/Auction.ts b/src/dto/rpc/ton/models/Auction.ts new file mode 100644 index 000000000..a0f9e1c7c --- /dev/null +++ b/src/dto/rpc/ton/models/Auction.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Auction = { + domain: string; + owner: string; + price: number; + bids: number; + date: number; +}; diff --git a/src/dto/rpc/ton/models/AuctionBidAction.ts b/src/dto/rpc/ton/models/AuctionBidAction.ts new file mode 100644 index 000000000..6c2c6d799 --- /dev/null +++ b/src/dto/rpc/ton/models/AuctionBidAction.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { NftItem } from './NftItem'; +import type { Price } from './Price'; + +export type AuctionBidAction = { + auction_type: 'DNS.ton' | 'DNS.tg' | 'NUMBER.tg' | 'getgems'; + amount: Price; + nft?: NftItem; + bidder: AccountAddress; + auction: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/Auctions.ts b/src/dto/rpc/ton/models/Auctions.ts new file mode 100644 index 000000000..adc508cbf --- /dev/null +++ b/src/dto/rpc/ton/models/Auctions.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Auction } from './Auction'; + +export type Auctions = { + data: Array; + total: number; +}; diff --git a/src/dto/rpc/ton/models/BlockCurrencyCollection.ts b/src/dto/rpc/ton/models/BlockCurrencyCollection.ts new file mode 100644 index 000000000..d72df05a0 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockCurrencyCollection.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type BlockCurrencyCollection = { + grams: number; + other: Array<{ + id: number; + value: string; + }>; +}; diff --git a/src/dto/rpc/ton/models/BlockLimits.ts b/src/dto/rpc/ton/models/BlockLimits.ts new file mode 100644 index 000000000..0f7279297 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockLimits.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockParamLimits } from './BlockParamLimits'; + +export type BlockLimits = { + bytes: BlockParamLimits; + gas: BlockParamLimits; + lt_delta: BlockParamLimits; +}; diff --git a/src/dto/rpc/ton/models/BlockParamLimits.ts b/src/dto/rpc/ton/models/BlockParamLimits.ts new file mode 100644 index 000000000..61d42ec99 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockParamLimits.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type BlockParamLimits = { + underload: number; + soft_limit: number; + hard_limit: number; +}; diff --git a/src/dto/rpc/ton/models/BlockRaw.ts b/src/dto/rpc/ton/models/BlockRaw.ts new file mode 100644 index 000000000..8f1c97e42 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockRaw.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type BlockRaw = { + workchain: number; + shard: string; + seqno: number; + root_hash: string; + file_hash: string; +}; diff --git a/src/dto/rpc/ton/models/BlockValueFlow.ts b/src/dto/rpc/ton/models/BlockValueFlow.ts new file mode 100644 index 000000000..c2c446b84 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockValueFlow.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockCurrencyCollection } from './BlockCurrencyCollection'; + +export type BlockValueFlow = { + from_prev_blk: BlockCurrencyCollection; + to_next_blk: BlockCurrencyCollection; + imported: BlockCurrencyCollection; + exported: BlockCurrencyCollection; + fees_collected: BlockCurrencyCollection; + burned?: BlockCurrencyCollection; + fees_imported: BlockCurrencyCollection; + recovered: BlockCurrencyCollection; + created: BlockCurrencyCollection; + minted: BlockCurrencyCollection; +}; diff --git a/src/dto/rpc/ton/models/BlockchainAccountInspect.ts b/src/dto/rpc/ton/models/BlockchainAccountInspect.ts new file mode 100644 index 000000000..a4bb76574 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainAccountInspect.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type BlockchainAccountInspect = { + code: string; + code_hash: string; + methods: Array<{ + id: number; + method: string; + }>; + compiler?: 'func'; +}; diff --git a/src/dto/rpc/ton/models/BlockchainBlock.ts b/src/dto/rpc/ton/models/BlockchainBlock.ts new file mode 100644 index 000000000..962a4eb6c --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainBlock.ts @@ -0,0 +1,38 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockValueFlow } from './BlockValueFlow'; + +export type BlockchainBlock = { + tx_quantity: number; + value_flow: BlockValueFlow; + workchain_id: number; + shard: string; + seqno: number; + root_hash: string; + file_hash: string; + global_id: number; + version: number; + after_merge: boolean; + before_split: boolean; + after_split: boolean; + want_split: boolean; + want_merge: boolean; + key_block: boolean; + gen_utime: number; + start_lt: number; + end_lt: number; + vert_seqno: number; + gen_catchain_seqno: number; + min_ref_mc_seqno: number; + prev_key_block_seqno: number; + gen_software_version?: number; + gen_software_capabilities?: number; + master_ref?: string; + prev_refs: Array; + in_msg_descr_length: number; + out_msg_descr_length: number; + rand_seed: string; + created_by: string; +}; diff --git a/src/dto/rpc/ton/models/BlockchainBlockShards.ts b/src/dto/rpc/ton/models/BlockchainBlockShards.ts new file mode 100644 index 000000000..21820795d --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainBlockShards.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockchainBlock } from './BlockchainBlock'; + +export type BlockchainBlockShards = { + shards: Array<{ + last_known_block_id: string; + last_known_block: BlockchainBlock; + }>; +}; diff --git a/src/dto/rpc/ton/models/BlockchainBlocks.ts b/src/dto/rpc/ton/models/BlockchainBlocks.ts new file mode 100644 index 000000000..de8887cde --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainBlocks.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockchainBlock } from './BlockchainBlock'; + +export type BlockchainBlocks = { + blocks: Array; +}; diff --git a/src/dto/rpc/ton/models/BlockchainConfig.ts b/src/dto/rpc/ton/models/BlockchainConfig.ts new file mode 100644 index 000000000..577006184 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainConfig.ts @@ -0,0 +1,278 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlockLimits } from './BlockLimits'; +import type { ConfigProposalSetup } from './ConfigProposalSetup'; +import type { GasLimitPrices } from './GasLimitPrices'; +import type { JettonBridgeParams } from './JettonBridgeParams'; +import type { MisbehaviourPunishmentConfig } from './MisbehaviourPunishmentConfig'; +import type { MsgForwardPrices } from './MsgForwardPrices'; +import type { OracleBridgeParams } from './OracleBridgeParams'; +import type { SizeLimitsConfig } from './SizeLimitsConfig'; +import type { ValidatorsSet } from './ValidatorsSet'; +import type { WorkchainDescr } from './WorkchainDescr'; + +export type BlockchainConfig = { + /** + * config address + */ + '0': string; + /** + * elector address + */ + '1': string; + /** + * minter address + */ + '2': string; + /** + * The address of the transaction fee collector. + */ + '3'?: string; + /** + * dns root address + */ + '4': string; + '5'?: { + blackhole_addr?: string; + fee_burn_nom: number; + fee_burn_denom: number; + }; + /** + * Minting fees of new currencies. + */ + '6'?: { + mint_new_price: number; + mint_add_price: number; + }; + /** + * The volume of each of the additional currencies in circulation. + */ + '7'?: { + currencies: Array<{ + currency_id: number; + amount: string; + }>; + }; + /** + * The network version and additional capabilities supported by the validators. + */ + '8'?: { + version: number; + capabilities: number; + }; + /** + * List of mandatory parameters of the blockchain config. + */ + '9'?: { + mandatory_params: Array; + }; + /** + * List of critical TON parameters, the change of which significantly affects the network, so more voting rounds are held. + */ + '10'?: { + critical_params: Array; + }; + /** + * This parameter indicates under what conditions proposals to change the TON configuration are accepted. + */ + '11'?: { + normal_params: ConfigProposalSetup; + critical_params: ConfigProposalSetup; + }; + /** + * Workchains in the TON Blockchain + */ + '12'?: { + workchains: Array; + }; + /** + * The cost of filing complaints about incorrect operation of validators. + */ + '13'?: { + deposit: number; + bit_price: number; + cell_price: number; + }; + /** + * The reward in nanoTons for block creation in the TON blockchain. + */ + '14'?: { + masterchain_block_fee: number; + basechain_block_fee: number; + }; + /** + * The reward in nanoTons for block creation in the TON blockchain. + */ + '15'?: { + validators_elected_for: number; + elections_start_before: number; + elections_end_before: number; + stake_held_for: number; + }; + /** + * The limits on the number of validators in the TON blockchain. + */ + '16'?: { + max_validators: number; + max_main_validators: number; + min_validators: number; + }; + /** + * The stake parameters configuration in the TON blockchain. + */ + '17'?: { + min_stake: string; + max_stake: string; + min_total_stake: string; + max_stake_factor: number; + }; + /** + * The prices for data storage. + */ + '18'?: { + storage_prices: Array<{ + utime_since: number; + bit_price_ps: number; + cell_price_ps: number; + mc_bit_price_ps: number; + mc_cell_price_ps: number; + }>; + }; + /** + * The cost of computations in the masterchain. The complexity of any computation is estimated in gas units. + */ + '20'?: { + gas_limits_prices: GasLimitPrices; + }; + /** + * The cost of computations in the basechains. The complexity of any computation is estimated in gas units. + */ + '21'?: { + gas_limits_prices: GasLimitPrices; + }; + /** + * The limits on the block in the masterchain, upon reaching which the block is finalized and the callback of the remaining messages (if any) is carried over to the next block. + */ + '22'?: { + block_limits: BlockLimits; + }; + /** + * The limits on the block in the basechains, upon reaching which the block is finalized and the callback of the remaining messages (if any) is carried over to the next block. + */ + '23'?: { + block_limits: BlockLimits; + }; + /** + * The cost of sending messages in the masterchain of the TON blockchain. + */ + '24'?: { + msg_forward_prices: MsgForwardPrices; + }; + /** + * The cost of sending messages in the basechains of the TON blockchain. + */ + '25'?: { + msg_forward_prices: MsgForwardPrices; + }; + /** + * The configuration for the Catchain protocol. + */ + '28'?: { + mc_catchain_lifetime: number; + shard_catchain_lifetime: number; + shard_validators_lifetime: number; + shard_validators_num: number; + flags?: number; + shuffle_mc_validators?: boolean; + }; + /** + * The configuration for the consensus protocol above catchain. + */ + '29'?: { + flags?: number; + new_catchain_ids?: boolean; + round_candidates: number; + next_candidate_delay_ms: number; + consensus_timeout_ms: number; + fast_attempts: number; + attempt_duration: number; + catchain_max_deps: number; + max_block_bytes: number; + max_collated_bytes: number; + proto_version?: number; + catchain_max_blocks_coeff?: number; + }; + /** + * The configuration for the consensus protocol above catchain. + */ + '31'?: { + fundamental_smc_addr: Array; + }; + '32'?: ValidatorsSet; + '33'?: ValidatorsSet; + '34'?: ValidatorsSet; + '35'?: ValidatorsSet; + '36'?: ValidatorsSet; + '37'?: ValidatorsSet; + /** + * The configuration for punishment for improper behavior (non-validation). In the absence of the parameter, the default fine size is 101 TON + */ + '40'?: { + misbehaviour_punishment_config: MisbehaviourPunishmentConfig; + }; + /** + * The size limits and some other characteristics of accounts and messages. + */ + '43'?: { + size_limits_config: SizeLimitsConfig; + }; + /** + * suspended accounts + */ + '44': { + accounts: Array; + suspended_until: number; + }; + /** + * Bridge parameters for wrapping TON in other networks. + */ + '71'?: { + oracle_bridge_params: OracleBridgeParams; + }; + /** + * Bridge parameters for wrapping TON in other networks. + */ + '72'?: { + oracle_bridge_params: OracleBridgeParams; + }; + /** + * Bridge parameters for wrapping TON in other networks. + */ + '73'?: { + oracle_bridge_params: OracleBridgeParams; + }; + /** + * Bridge parameters for wrapping tokens from other networks into tokens on the TON network. + */ + '79'?: { + jetton_bridge_params: JettonBridgeParams; + }; + /** + * Bridge parameters for wrapping tokens from other networks into tokens on the TON network. + */ + '81'?: { + jetton_bridge_params: JettonBridgeParams; + }; + /** + * Bridge parameters for wrapping tokens from other networks into tokens on the TON network. + */ + '82'?: { + jetton_bridge_params: JettonBridgeParams; + }; + /** + * config boc in hex format + */ + raw: string; +}; diff --git a/src/dto/rpc/ton/models/BlockchainRawAccount.ts b/src/dto/rpc/ton/models/BlockchainRawAccount.ts new file mode 100644 index 000000000..d013b9202 --- /dev/null +++ b/src/dto/rpc/ton/models/BlockchainRawAccount.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountStatus } from './AccountStatus'; +import type { AccountStorageInfo } from './AccountStorageInfo'; + +export type BlockchainRawAccount = { + address: string; + balance: number; + extra_balance?: Record; + code?: string; + data?: string; + last_transaction_lt: number; + last_transaction_hash?: string; + frozen_hash?: string; + status: AccountStatus; + storage: AccountStorageInfo; + libraries?: Array<{ + public: boolean; + root: string; + }>; +}; diff --git a/src/dto/rpc/ton/models/BouncePhaseType.ts b/src/dto/rpc/ton/models/BouncePhaseType.ts new file mode 100644 index 000000000..f4e6fe76a --- /dev/null +++ b/src/dto/rpc/ton/models/BouncePhaseType.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type BouncePhaseType = 'TrPhaseBounceNegfunds' | 'TrPhaseBounceNofunds' | 'TrPhaseBounceOk'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/ComputePhase.ts b/src/dto/rpc/ton/models/ComputePhase.ts new file mode 100644 index 000000000..cf9bcedb8 --- /dev/null +++ b/src/dto/rpc/ton/models/ComputePhase.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ComputeSkipReason } from './ComputeSkipReason'; + +export type ComputePhase = { + skipped: boolean; + skip_reason?: ComputeSkipReason; + success?: boolean; + gas_fees?: number; + gas_used?: number; + vm_steps?: number; + exit_code?: number; + exit_code_description?: string; +}; diff --git a/src/dto/rpc/ton/models/ComputeSkipReason.ts b/src/dto/rpc/ton/models/ComputeSkipReason.ts new file mode 100644 index 000000000..c3ed13288 --- /dev/null +++ b/src/dto/rpc/ton/models/ComputeSkipReason.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ComputeSkipReason = 'cskip_no_state' | 'cskip_bad_state' | 'cskip_no_gas'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/ConfigProposalSetup.ts b/src/dto/rpc/ton/models/ConfigProposalSetup.ts new file mode 100644 index 000000000..3048a63b9 --- /dev/null +++ b/src/dto/rpc/ton/models/ConfigProposalSetup.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ConfigProposalSetup = { + min_tot_rounds: number; + max_tot_rounds: number; + min_wins: number; + max_losses: number; + min_store_sec: number; + max_store_sec: number; + bit_price: number; + cell_price: number; +}; diff --git a/src/dto/rpc/ton/models/ContractDeployAction.ts b/src/dto/rpc/ton/models/ContractDeployAction.ts new file mode 100644 index 000000000..b7ae0ce78 --- /dev/null +++ b/src/dto/rpc/ton/models/ContractDeployAction.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ContractDeployAction = { + address: string; + interfaces: Array; +}; diff --git a/src/dto/rpc/ton/models/CreditPhase.ts b/src/dto/rpc/ton/models/CreditPhase.ts new file mode 100644 index 000000000..c29a7f74e --- /dev/null +++ b/src/dto/rpc/ton/models/CreditPhase.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type CreditPhase = { + fees_collected: number; + credit: number; +}; diff --git a/src/dto/rpc/ton/models/DecodedMessage.ts b/src/dto/rpc/ton/models/DecodedMessage.ts new file mode 100644 index 000000000..0a3e75972 --- /dev/null +++ b/src/dto/rpc/ton/models/DecodedMessage.ts @@ -0,0 +1,31 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { DecodedRawMessage } from './DecodedRawMessage'; + +export type DecodedMessage = { + destination: AccountAddress; + destination_wallet_version: string; + ext_in_msg_decoded?: { + wallet_v3?: { + subwallet_id: number; + valid_until: number; + seqno: number; + raw_messages: Array; + }; + wallet_v4?: { + subwallet_id: number; + valid_until: number; + seqno: number; + op: number; + raw_messages: Array; + }; + wallet_highload_v2?: { + subwallet_id: number; + bounded_query_id: string; + raw_messages: Array; + }; + }; +}; diff --git a/src/dto/rpc/ton/models/DecodedRawMessage.ts b/src/dto/rpc/ton/models/DecodedRawMessage.ts new file mode 100644 index 000000000..19b4d0183 --- /dev/null +++ b/src/dto/rpc/ton/models/DecodedRawMessage.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type DecodedRawMessage = { + message: { + boc: string; + decoded_op_name?: string; + op_code?: string; + decoded_body?: any; + }; + mode: number; +}; diff --git a/src/dto/rpc/ton/models/DepositStakeAction.ts b/src/dto/rpc/ton/models/DepositStakeAction.ts new file mode 100644 index 000000000..d6d9e72ae --- /dev/null +++ b/src/dto/rpc/ton/models/DepositStakeAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { PoolImplementationType } from './PoolImplementationType'; + +/** + * validator's participation in elections + */ +export type DepositStakeAction = { + amount: number; + staker: AccountAddress; + pool: AccountAddress; + implementation: PoolImplementationType; +}; diff --git a/src/dto/rpc/ton/models/DnsExpiring.ts b/src/dto/rpc/ton/models/DnsExpiring.ts new file mode 100644 index 000000000..a439e85e6 --- /dev/null +++ b/src/dto/rpc/ton/models/DnsExpiring.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NftItem } from './NftItem'; + +export type DnsExpiring = { + items: Array<{ + expiring_at: number; + name: string; + dns_item?: NftItem; + }>; +}; diff --git a/src/dto/rpc/ton/models/DnsRecord.ts b/src/dto/rpc/ton/models/DnsRecord.ts new file mode 100644 index 000000000..d84361da7 --- /dev/null +++ b/src/dto/rpc/ton/models/DnsRecord.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { WalletDNS } from './WalletDNS'; + +export type DnsRecord = { + wallet?: WalletDNS; + next_resolver?: string; + sites: Array; + /** + * tonstorage bag id + */ + storage?: string; +}; diff --git a/src/dto/rpc/ton/models/DomainBid.ts b/src/dto/rpc/ton/models/DomainBid.ts new file mode 100644 index 000000000..f75fdb26c --- /dev/null +++ b/src/dto/rpc/ton/models/DomainBid.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type DomainBid = { + success: boolean; + value: number; + txTime: number; + txHash: string; + bidder: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/DomainBids.ts b/src/dto/rpc/ton/models/DomainBids.ts new file mode 100644 index 000000000..293cc203e --- /dev/null +++ b/src/dto/rpc/ton/models/DomainBids.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { DomainBid } from './DomainBid'; + +export type DomainBids = { + data: Array; +}; diff --git a/src/dto/rpc/ton/models/DomainInfo.ts b/src/dto/rpc/ton/models/DomainInfo.ts new file mode 100644 index 000000000..56edee992 --- /dev/null +++ b/src/dto/rpc/ton/models/DomainInfo.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NftItem } from './NftItem'; + +export type DomainInfo = { + name: string; + /** + * date of expiring. optional. not all domain in ton has expiration date + */ + expiring_at?: number; + item?: NftItem; +}; diff --git a/src/dto/rpc/ton/models/DomainNames.ts b/src/dto/rpc/ton/models/DomainNames.ts new file mode 100644 index 000000000..558406387 --- /dev/null +++ b/src/dto/rpc/ton/models/DomainNames.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type DomainNames = { + domains: Array; +}; diff --git a/src/dto/rpc/ton/models/DomainRenewAction.ts b/src/dto/rpc/ton/models/DomainRenewAction.ts new file mode 100644 index 000000000..1c115c02e --- /dev/null +++ b/src/dto/rpc/ton/models/DomainRenewAction.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type DomainRenewAction = { + domain: string; + contract_address: string; + renewer: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/ElectionsDepositStakeAction.ts b/src/dto/rpc/ton/models/ElectionsDepositStakeAction.ts new file mode 100644 index 000000000..1b4b303bf --- /dev/null +++ b/src/dto/rpc/ton/models/ElectionsDepositStakeAction.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type ElectionsDepositStakeAction = { + amount: number; + staker: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/ElectionsRecoverStakeAction.ts b/src/dto/rpc/ton/models/ElectionsRecoverStakeAction.ts new file mode 100644 index 000000000..02857e691 --- /dev/null +++ b/src/dto/rpc/ton/models/ElectionsRecoverStakeAction.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type ElectionsRecoverStakeAction = { + amount: number; + staker: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/EncryptedComment.ts b/src/dto/rpc/ton/models/EncryptedComment.ts new file mode 100644 index 000000000..a0a02573b --- /dev/null +++ b/src/dto/rpc/ton/models/EncryptedComment.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type EncryptedComment = { + encryption_type: string; + cipher_text: string; +}; diff --git a/src/dto/rpc/ton/models/Error.ts b/src/dto/rpc/ton/models/Error.ts new file mode 100644 index 000000000..0dbbb655f --- /dev/null +++ b/src/dto/rpc/ton/models/Error.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Error = { + error: string; +}; diff --git a/src/dto/rpc/ton/models/Event.ts b/src/dto/rpc/ton/models/Event.ts new file mode 100644 index 000000000..3cc88ff7e --- /dev/null +++ b/src/dto/rpc/ton/models/Event.ts @@ -0,0 +1,22 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Action } from './Action'; +import type { ValueFlow } from './ValueFlow'; + +export type Event = { + event_id: string; + timestamp: number; + actions: Array; + value_flow: Array; + /** + * scam + */ + is_scam: boolean; + lt: number; + /** + * Event is not finished yet. Transactions still happening + */ + in_progress: boolean; +}; diff --git a/src/dto/rpc/ton/models/FoundAccounts.ts b/src/dto/rpc/ton/models/FoundAccounts.ts new file mode 100644 index 000000000..fe24f3780 --- /dev/null +++ b/src/dto/rpc/ton/models/FoundAccounts.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type FoundAccounts = { + addresses: Array<{ + address: string; + name: string; + preview: string; + }>; +}; diff --git a/src/dto/rpc/ton/models/GasLimitPrices.ts b/src/dto/rpc/ton/models/GasLimitPrices.ts new file mode 100644 index 000000000..29451f4c0 --- /dev/null +++ b/src/dto/rpc/ton/models/GasLimitPrices.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type GasLimitPrices = { + special_gas_limit?: number; + flat_gas_limit?: number; + flat_gas_price?: number; + gas_price: number; + gas_limit: number; + gas_credit: number; + block_gas_limit: number; + freeze_due_limit: number; + delete_due_limit: number; +}; diff --git a/src/dto/rpc/ton/models/GaslessConfig.ts b/src/dto/rpc/ton/models/GaslessConfig.ts new file mode 100644 index 000000000..a7a182a07 --- /dev/null +++ b/src/dto/rpc/ton/models/GaslessConfig.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type GaslessConfig = { + /** + * sending excess to this address decreases the commission of a gasless transfer + */ + relay_address: string; + /** + * list of jettons, any of them can be used to pay for gas + */ + gas_jettons: Array<{ + master_id: string; + }>; +}; diff --git a/src/dto/rpc/ton/models/ImagePreview.ts b/src/dto/rpc/ton/models/ImagePreview.ts new file mode 100644 index 000000000..1947690b7 --- /dev/null +++ b/src/dto/rpc/ton/models/ImagePreview.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ImagePreview = { + resolution: string; + url: string; +}; diff --git a/src/dto/rpc/ton/models/InitStateRaw.ts b/src/dto/rpc/ton/models/InitStateRaw.ts new file mode 100644 index 000000000..2e2c40e29 --- /dev/null +++ b/src/dto/rpc/ton/models/InitStateRaw.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type InitStateRaw = { + workchain: number; + root_hash: string; + file_hash: string; +}; diff --git a/src/dto/rpc/ton/models/InscriptionBalance.ts b/src/dto/rpc/ton/models/InscriptionBalance.ts new file mode 100644 index 000000000..ea5dedb75 --- /dev/null +++ b/src/dto/rpc/ton/models/InscriptionBalance.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type InscriptionBalance = { + type: 'ton20' | 'gram20'; + ticker: string; + balance: string; + decimals: number; +}; diff --git a/src/dto/rpc/ton/models/InscriptionBalances.ts b/src/dto/rpc/ton/models/InscriptionBalances.ts new file mode 100644 index 000000000..4c126ad94 --- /dev/null +++ b/src/dto/rpc/ton/models/InscriptionBalances.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { InscriptionBalance } from './InscriptionBalance'; + +export type InscriptionBalances = { + inscriptions: Array; +}; diff --git a/src/dto/rpc/ton/models/InscriptionMintAction.ts b/src/dto/rpc/ton/models/InscriptionMintAction.ts new file mode 100644 index 000000000..c66164fd1 --- /dev/null +++ b/src/dto/rpc/ton/models/InscriptionMintAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type InscriptionMintAction = { + recipient: AccountAddress; + /** + * amount in minimal particles + */ + amount: string; + type: 'ton20' | 'gram20'; + ticker: string; + decimals: number; +}; diff --git a/src/dto/rpc/ton/models/InscriptionTransferAction.ts b/src/dto/rpc/ton/models/InscriptionTransferAction.ts new file mode 100644 index 000000000..ad85a2bae --- /dev/null +++ b/src/dto/rpc/ton/models/InscriptionTransferAction.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type InscriptionTransferAction = { + sender: AccountAddress; + recipient: AccountAddress; + /** + * amount in minimal particles + */ + amount: string; + comment?: string; + type: 'ton20' | 'gram20'; + ticker: string; + decimals: number; +}; diff --git a/src/dto/rpc/ton/models/JettonBalance.ts b/src/dto/rpc/ton/models/JettonBalance.ts new file mode 100644 index 000000000..0f15b76e1 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonBalance.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; +import type { TokenRates } from './TokenRates'; + +export type JettonBalance = { + balance: string; + price?: TokenRates; + wallet_address: AccountAddress; + jetton: JettonPreview; + lock?: { + amount: string; + till: number; + }; +}; diff --git a/src/dto/rpc/ton/models/JettonBridgeParams.ts b/src/dto/rpc/ton/models/JettonBridgeParams.ts new file mode 100644 index 000000000..f2878dc47 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonBridgeParams.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { JettonBridgePrices } from './JettonBridgePrices'; +import type { Oracle } from './Oracle'; + +export type JettonBridgeParams = { + bridge_address: string; + oracles_address: string; + state_flags: number; + burn_bridge_fee?: number; + oracles: Array; + external_chain_address?: string; + prices?: JettonBridgePrices; +}; diff --git a/src/dto/rpc/ton/models/JettonBridgePrices.ts b/src/dto/rpc/ton/models/JettonBridgePrices.ts new file mode 100644 index 000000000..ce94bdc39 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonBridgePrices.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type JettonBridgePrices = { + bridge_burn_fee: number; + bridge_mint_fee: number; + wallet_min_tons_for_storage: number; + wallet_gas_consumption: number; + minter_min_tons_for_storage: number; + discover_gas_consumption: number; +}; diff --git a/src/dto/rpc/ton/models/JettonBurnAction.ts b/src/dto/rpc/ton/models/JettonBurnAction.ts new file mode 100644 index 000000000..fe1fc6f3d --- /dev/null +++ b/src/dto/rpc/ton/models/JettonBurnAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; + +export type JettonBurnAction = { + sender: AccountAddress; + senders_wallet: string; + /** + * amount in quanta of tokens + */ + amount: string; + jetton: JettonPreview; +}; diff --git a/src/dto/rpc/ton/models/JettonHolders.ts b/src/dto/rpc/ton/models/JettonHolders.ts new file mode 100644 index 000000000..1f3efb63c --- /dev/null +++ b/src/dto/rpc/ton/models/JettonHolders.ts @@ -0,0 +1,20 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type JettonHolders = { + addresses: Array<{ + address: string; + owner: AccountAddress; + /** + * balance in the smallest jetton's units + */ + balance: string; + }>; + /** + * total number of holders + */ + total: number; +}; diff --git a/src/dto/rpc/ton/models/JettonInfo.ts b/src/dto/rpc/ton/models/JettonInfo.ts new file mode 100644 index 000000000..cca8666ac --- /dev/null +++ b/src/dto/rpc/ton/models/JettonInfo.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonMetadata } from './JettonMetadata'; +import type { JettonVerificationType } from './JettonVerificationType'; + +export type JettonInfo = { + mintable: boolean; + total_supply: string; + admin?: AccountAddress; + metadata: JettonMetadata; + verification: JettonVerificationType; + holders_count: number; +}; diff --git a/src/dto/rpc/ton/models/JettonMetadata.ts b/src/dto/rpc/ton/models/JettonMetadata.ts new file mode 100644 index 000000000..910de5b08 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonMetadata.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type JettonMetadata = { + address: string; + name: string; + symbol: string; + decimals: string; + image?: string; + description?: string; + social?: Array; + websites?: Array; + catalogs?: Array; +}; diff --git a/src/dto/rpc/ton/models/JettonMintAction.ts b/src/dto/rpc/ton/models/JettonMintAction.ts new file mode 100644 index 000000000..775fa64a8 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonMintAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; + +export type JettonMintAction = { + recipient: AccountAddress; + recipients_wallet: string; + /** + * amount in quanta of tokens + */ + amount: string; + jetton: JettonPreview; +}; diff --git a/src/dto/rpc/ton/models/JettonPreview.ts b/src/dto/rpc/ton/models/JettonPreview.ts new file mode 100644 index 000000000..47d5cf5d2 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonPreview.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { JettonVerificationType } from './JettonVerificationType'; + +export type JettonPreview = { + address: string; + name: string; + symbol: string; + decimals: number; + image: string; + verification: JettonVerificationType; +}; diff --git a/src/dto/rpc/ton/models/JettonQuantity.ts b/src/dto/rpc/ton/models/JettonQuantity.ts new file mode 100644 index 000000000..8b06ea129 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonQuantity.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; + +export type JettonQuantity = { + quantity: string; + wallet_address: AccountAddress; + jetton: JettonPreview; +}; diff --git a/src/dto/rpc/ton/models/JettonSwapAction.ts b/src/dto/rpc/ton/models/JettonSwapAction.ts new file mode 100644 index 000000000..1191bcd5d --- /dev/null +++ b/src/dto/rpc/ton/models/JettonSwapAction.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; + +export type JettonSwapAction = { + dex: 'stonfi' | 'dedust' | 'megatonfi'; + amount_in: string; + amount_out: string; + ton_in?: number; + ton_out?: number; + user_wallet: AccountAddress; + router: AccountAddress; + jetton_master_in?: JettonPreview; + jetton_master_out?: JettonPreview; +}; diff --git a/src/dto/rpc/ton/models/JettonTransferAction.ts b/src/dto/rpc/ton/models/JettonTransferAction.ts new file mode 100644 index 000000000..116dd5574 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonTransferAction.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { EncryptedComment } from './EncryptedComment'; +import type { JettonPreview } from './JettonPreview'; +import type { Refund } from './Refund'; + +export type JettonTransferAction = { + sender?: AccountAddress; + recipient?: AccountAddress; + senders_wallet: string; + recipients_wallet: string; + /** + * amount in quanta of tokens + */ + amount: string; + comment?: string; + encrypted_comment?: EncryptedComment; + refund?: Refund; + jetton: JettonPreview; +}; diff --git a/src/dto/rpc/ton/models/JettonVerificationType.ts b/src/dto/rpc/ton/models/JettonVerificationType.ts new file mode 100644 index 000000000..ef5d3f6b1 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonVerificationType.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type JettonVerificationType = 'whitelist' | 'blacklist' | 'none'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/Jettons.ts b/src/dto/rpc/ton/models/Jettons.ts new file mode 100644 index 000000000..75a88f24e --- /dev/null +++ b/src/dto/rpc/ton/models/Jettons.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { JettonInfo } from './JettonInfo'; + +export type Jettons = { + jettons: Array; +}; diff --git a/src/dto/rpc/ton/models/JettonsBalances.ts b/src/dto/rpc/ton/models/JettonsBalances.ts new file mode 100644 index 000000000..8ebe8c5c9 --- /dev/null +++ b/src/dto/rpc/ton/models/JettonsBalances.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { JettonBalance } from './JettonBalance'; + +export type JettonsBalances = { + balances: Array; +}; diff --git a/src/dto/rpc/ton/models/MarketTonRates.ts b/src/dto/rpc/ton/models/MarketTonRates.ts new file mode 100644 index 000000000..ad21290b8 --- /dev/null +++ b/src/dto/rpc/ton/models/MarketTonRates.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MarketTonRates = { + market: string; + usd_price: number; + last_date_update: number; +}; diff --git a/src/dto/rpc/ton/models/Message.ts b/src/dto/rpc/ton/models/Message.ts new file mode 100644 index 000000000..99b3cdc6e --- /dev/null +++ b/src/dto/rpc/ton/models/Message.ts @@ -0,0 +1,30 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { StateInit } from './StateInit'; + +export type Message = { + msg_type: 'int_msg' | 'ext_in_msg' | 'ext_out_msg'; + created_lt: number; + ihr_disabled: boolean; + bounce: boolean; + bounced: boolean; + value: number; + fwd_fee: number; + ihr_fee: number; + destination?: AccountAddress; + source?: AccountAddress; + import_fee: number; + created_at: number; + op_code?: string; + init?: StateInit; + hash: string; + /** + * hex-encoded BoC with raw message body + */ + raw_body?: string; + decoded_op_name?: string; + decoded_body?: any; +}; diff --git a/src/dto/rpc/ton/models/MessageConsequences.ts b/src/dto/rpc/ton/models/MessageConsequences.ts new file mode 100644 index 000000000..3f4125485 --- /dev/null +++ b/src/dto/rpc/ton/models/MessageConsequences.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountEvent } from './AccountEvent'; +import type { Risk } from './Risk'; +import type { Trace } from './Trace'; + +export type MessageConsequences = { + trace: Trace; + risk: Risk; + event: AccountEvent; +}; diff --git a/src/dto/rpc/ton/models/MethodExecutionResult.ts b/src/dto/rpc/ton/models/MethodExecutionResult.ts new file mode 100644 index 000000000..c06133aa6 --- /dev/null +++ b/src/dto/rpc/ton/models/MethodExecutionResult.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TvmStackRecord } from './TvmStackRecord'; + +export type MethodExecutionResult = { + success: boolean; + /** + * tvm exit code + */ + exit_code: number; + stack: Array; + decoded?: any; +}; diff --git a/src/dto/rpc/ton/models/MisbehaviourPunishmentConfig.ts b/src/dto/rpc/ton/models/MisbehaviourPunishmentConfig.ts new file mode 100644 index 000000000..ae9f68e04 --- /dev/null +++ b/src/dto/rpc/ton/models/MisbehaviourPunishmentConfig.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MisbehaviourPunishmentConfig = { + default_flat_fine: number; + default_proportional_fine: number; + severity_flat_mult: number; + severity_proportional_mult: number; + unpunishable_interval: number; + long_interval: number; + long_flat_mult: number; + long_proportional_mult: number; + medium_interval: number; + medium_flat_mult: number; + medium_proportional_mult: number; +}; diff --git a/src/dto/rpc/ton/models/MsgForwardPrices.ts b/src/dto/rpc/ton/models/MsgForwardPrices.ts new file mode 100644 index 000000000..b5f23e888 --- /dev/null +++ b/src/dto/rpc/ton/models/MsgForwardPrices.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MsgForwardPrices = { + lump_price: number; + bit_price: number; + cell_price: number; + ihr_price_factor: number; + first_frac: number; + next_frac: number; +}; diff --git a/src/dto/rpc/ton/models/Multisig.ts b/src/dto/rpc/ton/models/Multisig.ts new file mode 100644 index 000000000..4bf26dc91 --- /dev/null +++ b/src/dto/rpc/ton/models/Multisig.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { MultisigOrder } from './MultisigOrder'; + +export type Multisig = { + address: string; + seqno: number; + threshold: number; + signers: Array; + proposers: Array; + orders: Array; +}; diff --git a/src/dto/rpc/ton/models/MultisigOrder.ts b/src/dto/rpc/ton/models/MultisigOrder.ts new file mode 100644 index 000000000..28cbed1ac --- /dev/null +++ b/src/dto/rpc/ton/models/MultisigOrder.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MultisigOrder = { + address: string; + order_seqno: number; + threshold: number; + sent_for_execution: boolean; + signers: Array; + approvals_num: number; + expiration_date: number; +}; diff --git a/src/dto/rpc/ton/models/Multisigs.ts b/src/dto/rpc/ton/models/Multisigs.ts new file mode 100644 index 000000000..2829b54da --- /dev/null +++ b/src/dto/rpc/ton/models/Multisigs.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Multisig } from './Multisig'; + +export type Multisigs = { + multisigs: Array; +}; diff --git a/src/dto/rpc/ton/models/NftApprovedBy.ts b/src/dto/rpc/ton/models/NftApprovedBy.ts new file mode 100644 index 000000000..e1b310115 --- /dev/null +++ b/src/dto/rpc/ton/models/NftApprovedBy.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type NftApprovedBy = Array<'getgems' | 'tonkeeper' | 'ton.diamonds'>; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/NftCollection.ts b/src/dto/rpc/ton/models/NftCollection.ts new file mode 100644 index 000000000..2bd396589 --- /dev/null +++ b/src/dto/rpc/ton/models/NftCollection.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { ImagePreview } from './ImagePreview'; +import type { NftApprovedBy } from './NftApprovedBy'; + +export type NftCollection = { + address: string; + next_item_index: number; + owner?: AccountAddress; + raw_collection_content: string; + metadata?: any; + previews?: Array; + approved_by: NftApprovedBy; +}; diff --git a/src/dto/rpc/ton/models/NftCollections.ts b/src/dto/rpc/ton/models/NftCollections.ts new file mode 100644 index 000000000..0b1c82cfc --- /dev/null +++ b/src/dto/rpc/ton/models/NftCollections.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NftCollection } from './NftCollection'; + +export type NftCollections = { + nft_collections: Array; +}; diff --git a/src/dto/rpc/ton/models/NftItem.ts b/src/dto/rpc/ton/models/NftItem.ts new file mode 100644 index 000000000..6d84d71f1 --- /dev/null +++ b/src/dto/rpc/ton/models/NftItem.ts @@ -0,0 +1,28 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { ImagePreview } from './ImagePreview'; +import type { NftApprovedBy } from './NftApprovedBy'; +import type { Sale } from './Sale'; +import type { TrustType } from './TrustType'; + +export type NftItem = { + address: string; + index: number; + owner?: AccountAddress; + collection?: { + address: string; + name: string; + description: string; + }; + verified: boolean; + metadata: any; + sale?: Sale; + previews?: Array; + dns?: string; + approved_by: NftApprovedBy; + include_cnft?: boolean; + trust: TrustType; +}; diff --git a/src/dto/rpc/ton/models/NftItemTransferAction.ts b/src/dto/rpc/ton/models/NftItemTransferAction.ts new file mode 100644 index 000000000..b3e00620c --- /dev/null +++ b/src/dto/rpc/ton/models/NftItemTransferAction.ts @@ -0,0 +1,20 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { EncryptedComment } from './EncryptedComment'; +import type { Refund } from './Refund'; + +export type NftItemTransferAction = { + sender?: AccountAddress; + recipient?: AccountAddress; + nft: string; + comment?: string; + encrypted_comment?: EncryptedComment; + /** + * raw hex encoded payload + */ + payload?: string; + refund?: Refund; +}; diff --git a/src/dto/rpc/ton/models/NftItems.ts b/src/dto/rpc/ton/models/NftItems.ts new file mode 100644 index 000000000..72ad61e1b --- /dev/null +++ b/src/dto/rpc/ton/models/NftItems.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { NftItem } from './NftItem'; + +export type NftItems = { + nft_items: Array; +}; diff --git a/src/dto/rpc/ton/models/NftPurchaseAction.ts b/src/dto/rpc/ton/models/NftPurchaseAction.ts new file mode 100644 index 000000000..e79585681 --- /dev/null +++ b/src/dto/rpc/ton/models/NftPurchaseAction.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { NftItem } from './NftItem'; +import type { Price } from './Price'; + +export type NftPurchaseAction = { + auction_type: 'DNS.ton' | 'DNS.tg' | 'NUMBER.tg' | 'getgems'; + amount: Price; + nft: NftItem; + seller: AccountAddress; + buyer: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/Oracle.ts b/src/dto/rpc/ton/models/Oracle.ts new file mode 100644 index 000000000..4ca9d2abe --- /dev/null +++ b/src/dto/rpc/ton/models/Oracle.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Oracle = { + address: string; + secp_pubkey: string; +}; diff --git a/src/dto/rpc/ton/models/OracleBridgeParams.ts b/src/dto/rpc/ton/models/OracleBridgeParams.ts new file mode 100644 index 000000000..a406b417e --- /dev/null +++ b/src/dto/rpc/ton/models/OracleBridgeParams.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Oracle } from './Oracle'; + +export type OracleBridgeParams = { + bridge_addr: string; + oracle_multisig_address: string; + external_chain_address: string; + oracles: Array; +}; diff --git a/src/dto/rpc/ton/models/PoolImplementation.ts b/src/dto/rpc/ton/models/PoolImplementation.ts new file mode 100644 index 000000000..c76170b90 --- /dev/null +++ b/src/dto/rpc/ton/models/PoolImplementation.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type PoolImplementation = { + name: string; + description: string; + url: string; + socials: Array; +}; diff --git a/src/dto/rpc/ton/models/PoolImplementationType.ts b/src/dto/rpc/ton/models/PoolImplementationType.ts new file mode 100644 index 000000000..399600fa1 --- /dev/null +++ b/src/dto/rpc/ton/models/PoolImplementationType.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type PoolImplementationType = 'whales' | 'tf' | 'liquidTF'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/PoolInfo.ts b/src/dto/rpc/ton/models/PoolInfo.ts new file mode 100644 index 000000000..5f969a00b --- /dev/null +++ b/src/dto/rpc/ton/models/PoolInfo.ts @@ -0,0 +1,50 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { PoolImplementationType } from './PoolImplementationType'; + +export type PoolInfo = { + address: string; + name: string; + total_amount: number; + implementation: PoolImplementationType; + /** + * APY in percent + */ + apy: number; + min_stake: number; + /** + * current nomination cycle beginning timestamp + */ + cycle_start: number; + /** + * current nomination cycle ending timestamp + */ + cycle_end: number; + /** + * this pool has verified source code or managed by trusted company + */ + verified: boolean; + /** + * current number of nominators + */ + current_nominators: number; + /** + * maximum number of nominators + */ + max_nominators: number; + /** + * for liquid staking master account of jetton + */ + liquid_jetton_master?: string; + /** + * total stake of all nominators + */ + nominators_stake: number; + /** + * stake of validator + */ + validator_stake: number; + cycle_length?: number; +}; diff --git a/src/dto/rpc/ton/models/Price.ts b/src/dto/rpc/ton/models/Price.ts new file mode 100644 index 000000000..51d54a8fb --- /dev/null +++ b/src/dto/rpc/ton/models/Price.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Price = { + value: string; + token_name: string; +}; diff --git a/src/dto/rpc/ton/models/RawBlockchainConfig.ts b/src/dto/rpc/ton/models/RawBlockchainConfig.ts new file mode 100644 index 000000000..e4f607aaf --- /dev/null +++ b/src/dto/rpc/ton/models/RawBlockchainConfig.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type RawBlockchainConfig = { + config: any; +}; diff --git a/src/dto/rpc/ton/models/ReducedBlock.ts b/src/dto/rpc/ton/models/ReducedBlock.ts new file mode 100644 index 000000000..96e9af73c --- /dev/null +++ b/src/dto/rpc/ton/models/ReducedBlock.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ReducedBlock = { + workchain_id: number; + shard: string; + seqno: number; + master_ref?: string; + tx_quantity: number; + utime: number; + shards_blocks: Array; + parent: Array; +}; diff --git a/src/dto/rpc/ton/models/ReducedBlocks.ts b/src/dto/rpc/ton/models/ReducedBlocks.ts new file mode 100644 index 000000000..817784cb2 --- /dev/null +++ b/src/dto/rpc/ton/models/ReducedBlocks.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ReducedBlock } from './ReducedBlock'; + +export type ReducedBlocks = { + blocks: Array; +}; diff --git a/src/dto/rpc/ton/models/Refund.ts b/src/dto/rpc/ton/models/Refund.ts new file mode 100644 index 000000000..f3d3037bd --- /dev/null +++ b/src/dto/rpc/ton/models/Refund.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Refund = { + type: 'DNS.ton' | 'DNS.tg' | 'GetGems'; + origin: string; +}; diff --git a/src/dto/rpc/ton/models/Risk.ts b/src/dto/rpc/ton/models/Risk.ts new file mode 100644 index 000000000..9fd49b5fa --- /dev/null +++ b/src/dto/rpc/ton/models/Risk.ts @@ -0,0 +1,19 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { JettonQuantity } from './JettonQuantity'; +import type { NftItem } from './NftItem'; + +/** + * Risk specifies assets that could be lost if a message would be sent to a malicious smart contract. It makes sense to understand the risk BEFORE sending a message to the blockchain. + */ +export type Risk = { + /** + * transfer all the remaining balance of the wallet. + */ + transfer_all_remaining_balance: boolean; + ton: number; + jettons: Array; + nfts: Array; +}; diff --git a/src/dto/rpc/ton/models/Sale.ts b/src/dto/rpc/ton/models/Sale.ts new file mode 100644 index 000000000..69d1ba2fc --- /dev/null +++ b/src/dto/rpc/ton/models/Sale.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { Price } from './Price'; + +export type Sale = { + address: string; + market: AccountAddress; + owner?: AccountAddress; + price: Price; +}; diff --git a/src/dto/rpc/ton/models/Seqno.ts b/src/dto/rpc/ton/models/Seqno.ts new file mode 100644 index 000000000..5fac1f255 --- /dev/null +++ b/src/dto/rpc/ton/models/Seqno.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Seqno = { + seqno: number; +}; diff --git a/src/dto/rpc/ton/models/ServiceStatus.ts b/src/dto/rpc/ton/models/ServiceStatus.ts new file mode 100644 index 000000000..0906e0dd4 --- /dev/null +++ b/src/dto/rpc/ton/models/ServiceStatus.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ServiceStatus = { + rest_online: boolean; + indexing_latency: number; +}; diff --git a/src/dto/rpc/ton/models/SignRawMessage.ts b/src/dto/rpc/ton/models/SignRawMessage.ts new file mode 100644 index 000000000..8a823a70a --- /dev/null +++ b/src/dto/rpc/ton/models/SignRawMessage.ts @@ -0,0 +1,19 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type SignRawMessage = { + address: string; + /** + * Number of nanocoins to send. Decimal string. + */ + amount: string; + /** + * Raw one-cell BoC encoded in hex. + */ + payload?: string; + /** + * Raw once-cell BoC encoded in hex. + */ + stateInit?: string; +}; diff --git a/src/dto/rpc/ton/models/SignRawParams.ts b/src/dto/rpc/ton/models/SignRawParams.ts new file mode 100644 index 000000000..a509c1bf4 --- /dev/null +++ b/src/dto/rpc/ton/models/SignRawParams.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { SignRawMessage } from './SignRawMessage'; + +export type SignRawParams = { + relay_address: string; + /** + * Commission for the transaction. In nanocoins. + */ + commission: string; + from: string; + valid_until: number; + messages: Array; +}; diff --git a/src/dto/rpc/ton/models/SizeLimitsConfig.ts b/src/dto/rpc/ton/models/SizeLimitsConfig.ts new file mode 100644 index 000000000..f57074081 --- /dev/null +++ b/src/dto/rpc/ton/models/SizeLimitsConfig.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type SizeLimitsConfig = { + max_msg_bits: number; + max_msg_cells: number; + max_library_cells: number; + max_vm_data_depth: number; + max_ext_msg_size: number; + max_ext_msg_depth: number; + max_acc_state_cells?: number; + max_acc_state_bits?: number; +}; diff --git a/src/dto/rpc/ton/models/SmartContractAction.ts b/src/dto/rpc/ton/models/SmartContractAction.ts new file mode 100644 index 000000000..aa96c57f8 --- /dev/null +++ b/src/dto/rpc/ton/models/SmartContractAction.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { Refund } from './Refund'; + +export type SmartContractAction = { + executor: AccountAddress; + contract: AccountAddress; + /** + * amount in nanotons + */ + ton_attached: number; + operation: string; + payload?: string; + refund?: Refund; +}; diff --git a/src/dto/rpc/ton/models/StateInit.ts b/src/dto/rpc/ton/models/StateInit.ts new file mode 100644 index 000000000..7b1f83e0d --- /dev/null +++ b/src/dto/rpc/ton/models/StateInit.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type StateInit = { + boc: string; + interfaces: Array; +}; diff --git a/src/dto/rpc/ton/models/StoragePhase.ts b/src/dto/rpc/ton/models/StoragePhase.ts new file mode 100644 index 000000000..0a4226efe --- /dev/null +++ b/src/dto/rpc/ton/models/StoragePhase.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccStatusChange } from './AccStatusChange'; + +export type StoragePhase = { + fees_collected: number; + fees_due?: number; + status_change: AccStatusChange; +}; diff --git a/src/dto/rpc/ton/models/StorageProvider.ts b/src/dto/rpc/ton/models/StorageProvider.ts new file mode 100644 index 000000000..e433af40f --- /dev/null +++ b/src/dto/rpc/ton/models/StorageProvider.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type StorageProvider = { + address: string; + accept_new_contracts: boolean; + rate_per_mb_day: number; + max_span: number; + minimal_file_size: number; + maximal_file_size: number; +}; diff --git a/src/dto/rpc/ton/models/Subscription.ts b/src/dto/rpc/ton/models/Subscription.ts new file mode 100644 index 000000000..ce8aff141 --- /dev/null +++ b/src/dto/rpc/ton/models/Subscription.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Subscription = { + address: string; + wallet_address: string; + beneficiary_address: string; + amount: number; + period: number; + start_time: number; + timeout: number; + last_payment_time: number; + last_request_time: number; + subscription_id: number; + failed_attempts: number; +}; diff --git a/src/dto/rpc/ton/models/SubscriptionAction.ts b/src/dto/rpc/ton/models/SubscriptionAction.ts new file mode 100644 index 000000000..381a21a0c --- /dev/null +++ b/src/dto/rpc/ton/models/SubscriptionAction.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type SubscriptionAction = { + subscriber: AccountAddress; + subscription: string; + beneficiary: AccountAddress; + amount: number; + initial: boolean; +}; diff --git a/src/dto/rpc/ton/models/Subscriptions.ts b/src/dto/rpc/ton/models/Subscriptions.ts new file mode 100644 index 000000000..c9711351c --- /dev/null +++ b/src/dto/rpc/ton/models/Subscriptions.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Subscription } from './Subscription'; + +export type Subscriptions = { + subscriptions: Array; +}; diff --git a/src/dto/rpc/ton/models/TokenRates.ts b/src/dto/rpc/ton/models/TokenRates.ts new file mode 100644 index 000000000..62d1cb8d2 --- /dev/null +++ b/src/dto/rpc/ton/models/TokenRates.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TokenRates = { + prices?: Record; + diff_24h?: Record; + diff_7d?: Record; + diff_30d?: Record; +}; diff --git a/src/dto/rpc/ton/models/TonTransferAction.ts b/src/dto/rpc/ton/models/TonTransferAction.ts new file mode 100644 index 000000000..6657cb6b9 --- /dev/null +++ b/src/dto/rpc/ton/models/TonTransferAction.ts @@ -0,0 +1,19 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { EncryptedComment } from './EncryptedComment'; +import type { Refund } from './Refund'; + +export type TonTransferAction = { + sender: AccountAddress; + recipient: AccountAddress; + /** + * amount in nanotons + */ + amount: number; + comment?: string; + encrypted_comment?: EncryptedComment; + refund?: Refund; +}; diff --git a/src/dto/rpc/ton/models/Trace.ts b/src/dto/rpc/ton/models/Trace.ts new file mode 100644 index 000000000..be92917a7 --- /dev/null +++ b/src/dto/rpc/ton/models/Trace.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Transaction } from './Transaction'; + +export type Trace = { + transaction: Transaction; + interfaces: Array; + children?: Array; + emulated?: boolean; +}; diff --git a/src/dto/rpc/ton/models/TraceID.ts b/src/dto/rpc/ton/models/TraceID.ts new file mode 100644 index 000000000..9f7dd9793 --- /dev/null +++ b/src/dto/rpc/ton/models/TraceID.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TraceID = { + id: string; + utime: number; +}; diff --git a/src/dto/rpc/ton/models/TraceIDs.ts b/src/dto/rpc/ton/models/TraceIDs.ts new file mode 100644 index 000000000..17e20a625 --- /dev/null +++ b/src/dto/rpc/ton/models/TraceIDs.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TraceID } from './TraceID'; + +export type TraceIDs = { + traces: Array; +}; diff --git a/src/dto/rpc/ton/models/Transaction.ts b/src/dto/rpc/ton/models/Transaction.ts new file mode 100644 index 000000000..b6c0ef767 --- /dev/null +++ b/src/dto/rpc/ton/models/Transaction.ts @@ -0,0 +1,44 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { AccountStatus } from './AccountStatus'; +import type { ActionPhase } from './ActionPhase'; +import type { BouncePhaseType } from './BouncePhaseType'; +import type { ComputePhase } from './ComputePhase'; +import type { CreditPhase } from './CreditPhase'; +import type { Message } from './Message'; +import type { StoragePhase } from './StoragePhase'; +import type { TransactionType } from './TransactionType'; + +export type Transaction = { + hash: string; + lt: number; + account: AccountAddress; + success: boolean; + utime: number; + orig_status: AccountStatus; + end_status: AccountStatus; + total_fees: number; + end_balance: number; + transaction_type: TransactionType; + state_update_old: string; + state_update_new: string; + in_msg?: Message; + out_msgs: Array; + block: string; + prev_trans_hash?: string; + prev_trans_lt?: number; + compute_phase?: ComputePhase; + storage_phase?: StoragePhase; + credit_phase?: CreditPhase; + action_phase?: ActionPhase; + bounce_phase?: BouncePhaseType; + aborted: boolean; + destroyed: boolean; + /** + * hex encoded boc with raw transaction + */ + raw: string; +}; diff --git a/src/dto/rpc/ton/models/TransactionType.ts b/src/dto/rpc/ton/models/TransactionType.ts new file mode 100644 index 000000000..782513948 --- /dev/null +++ b/src/dto/rpc/ton/models/TransactionType.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TransactionType = 'TransOrd' | 'TransTickTock' | 'TransSplitPrepare' | 'TransSplitInstall' | 'TransMergePrepare' | 'TransMergeInstall' | 'TransStorage'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/Transactions.ts b/src/dto/rpc/ton/models/Transactions.ts new file mode 100644 index 000000000..a66b65d96 --- /dev/null +++ b/src/dto/rpc/ton/models/Transactions.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Transaction } from './Transaction'; + +export type Transactions = { + transactions: Array; +}; diff --git a/src/dto/rpc/ton/models/TrustType.ts b/src/dto/rpc/ton/models/TrustType.ts new file mode 100644 index 000000000..083637767 --- /dev/null +++ b/src/dto/rpc/ton/models/TrustType.ts @@ -0,0 +1,5 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TrustType = 'whitelist' | 'graylist' | 'blacklist' | 'none'; \ No newline at end of file diff --git a/src/dto/rpc/ton/models/TvmStackRecord.ts b/src/dto/rpc/ton/models/TvmStackRecord.ts new file mode 100644 index 000000000..3eb1ea4b5 --- /dev/null +++ b/src/dto/rpc/ton/models/TvmStackRecord.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type TvmStackRecord = { + type: 'cell' | 'num' | 'nan' | 'null' | 'tuple'; + cell?: string; + slice?: string; + num?: string; + tuple?: Array; +}; diff --git a/src/dto/rpc/ton/models/UnSubscriptionAction.ts b/src/dto/rpc/ton/models/UnSubscriptionAction.ts new file mode 100644 index 000000000..5a12b9576 --- /dev/null +++ b/src/dto/rpc/ton/models/UnSubscriptionAction.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type UnSubscriptionAction = { + subscriber: AccountAddress; + subscription: string; + beneficiary: AccountAddress; +}; diff --git a/src/dto/rpc/ton/models/Validator.ts b/src/dto/rpc/ton/models/Validator.ts new file mode 100644 index 000000000..f1748b098 --- /dev/null +++ b/src/dto/rpc/ton/models/Validator.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Validator = { + address: string; + adnl_address: string; + stake: number; + max_factor: number; +}; diff --git a/src/dto/rpc/ton/models/Validators.ts b/src/dto/rpc/ton/models/Validators.ts new file mode 100644 index 000000000..ae7ffafb6 --- /dev/null +++ b/src/dto/rpc/ton/models/Validators.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Validator } from './Validator'; + +export type Validators = { + elect_at: number; + elect_close: number; + min_stake: number; + total_stake: number; + validators: Array; +}; diff --git a/src/dto/rpc/ton/models/ValidatorsSet.ts b/src/dto/rpc/ton/models/ValidatorsSet.ts new file mode 100644 index 000000000..14d406bcf --- /dev/null +++ b/src/dto/rpc/ton/models/ValidatorsSet.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ValidatorsSet = { + utime_since: number; + utime_until: number; + total: number; + main: number; + total_weight?: string; + list: Array<{ + public_key: string; + weight: number; + adnl_addr?: string; + }>; +}; diff --git a/src/dto/rpc/ton/models/ValueFlow.ts b/src/dto/rpc/ton/models/ValueFlow.ts new file mode 100644 index 000000000..e80694319 --- /dev/null +++ b/src/dto/rpc/ton/models/ValueFlow.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { JettonPreview } from './JettonPreview'; + +export type ValueFlow = { + account: AccountAddress; + ton: number; + fees: number; + jettons?: Array<{ + account: AccountAddress; + jetton: JettonPreview; + quantity: number; + }>; +}; diff --git a/src/dto/rpc/ton/models/WalletDNS.ts b/src/dto/rpc/ton/models/WalletDNS.ts new file mode 100644 index 000000000..681214d9b --- /dev/null +++ b/src/dto/rpc/ton/models/WalletDNS.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; + +export type WalletDNS = { + address: string; + account: AccountAddress; + is_wallet: boolean; + has_method_pubkey: boolean; + has_method_seqno: boolean; + names: Array; +}; diff --git a/src/dto/rpc/ton/models/WithdrawStakeAction.ts b/src/dto/rpc/ton/models/WithdrawStakeAction.ts new file mode 100644 index 000000000..af8496601 --- /dev/null +++ b/src/dto/rpc/ton/models/WithdrawStakeAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { PoolImplementationType } from './PoolImplementationType'; + +/** + * validator's participation in elections + */ +export type WithdrawStakeAction = { + amount: number; + staker: AccountAddress; + pool: AccountAddress; + implementation: PoolImplementationType; +}; diff --git a/src/dto/rpc/ton/models/WithdrawStakeRequestAction.ts b/src/dto/rpc/ton/models/WithdrawStakeRequestAction.ts new file mode 100644 index 000000000..55cb20073 --- /dev/null +++ b/src/dto/rpc/ton/models/WithdrawStakeRequestAction.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { AccountAddress } from './AccountAddress'; +import type { PoolImplementationType } from './PoolImplementationType'; + +/** + * validator's participation in elections + */ +export type WithdrawStakeRequestAction = { + amount?: number; + staker: AccountAddress; + pool: AccountAddress; + implementation: PoolImplementationType; +}; diff --git a/src/dto/rpc/ton/models/WorkchainDescr.ts b/src/dto/rpc/ton/models/WorkchainDescr.ts new file mode 100644 index 000000000..602475097 --- /dev/null +++ b/src/dto/rpc/ton/models/WorkchainDescr.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type WorkchainDescr = { + workchain: number; + enabled_since: number; + actual_min_split: number; + min_split: number; + max_split: number; + basic: number; + active: boolean; + accept_msgs: boolean; + flags: number; + zerostate_root_hash: string; + zerostate_file_hash: string; + version: number; +}; diff --git a/src/e2e/e2e.constant.ts b/src/e2e/e2e.constant.ts index ca513a804..0a3187064 100644 --- a/src/e2e/e2e.constant.ts +++ b/src/e2e/e2e.constant.ts @@ -38,6 +38,10 @@ export const AddressEventNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -77,6 +81,10 @@ export const IncomingNativeTxNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -114,6 +122,10 @@ export const OutgoingNativeTxNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -139,6 +151,10 @@ export const OutgoingFailedNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -168,6 +184,10 @@ export const PaidFeeNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -197,6 +217,10 @@ export const FungibleTxNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -226,6 +250,10 @@ export const NftNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -250,6 +278,10 @@ export const MultitokenNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -279,6 +311,10 @@ export const FailedTxPerBlockNetworks = [ Network.FLARE_SONGBIRD, Network.CRONOS, Network.CRONOS_TESTNET, + Network.FANTOM, + Network.FANTOM_TESTNET, + Network.OPTIMISM, + Network.OPTIMISM_TESTNET, Network.BASE, Network.BASE_SEPOLIA, Network.AVALANCHE_C, @@ -302,6 +338,7 @@ export const ContractAddressLogEventNetworks = [ Network.FLARE_COSTON_2, Network.FLARE_SONGBIRD, Network.CRONOS, + Network.FANTOM, Network.BASE, Network.AVALANCHE_C, ] @@ -318,6 +355,7 @@ export const InternalTxNetworks = [ Network.FLARE_COSTON_2, Network.FLARE_SONGBIRD, Network.CRONOS, + Network.FANTOM, Network.BASE, Network.AVALANCHE_C, ] diff --git a/src/e2e/e2e.util.ts b/src/e2e/e2e.util.ts index 40c2cdd21..a5860c147 100644 --- a/src/e2e/e2e.util.ts +++ b/src/e2e/e2e.util.ts @@ -39,6 +39,10 @@ export const e2eUtil = { case Network.BASE_SEPOLIA: case Network.AVALANCHE_C: case Network.AVALANCHE_C_TESTNET: + case Network.FANTOM: + case Network.FANTOM_TESTNET: + case Network.OPTIMISM: + case Network.OPTIMISM_TESTNET: return '0xdb4C3b4350EE869F2D0a2F43ce0292865E2Aa149' case Network.CELO_ALFAJORES: return '0xdf083B077F1FD890fC71feCaBbd3F68F94cD21Bf' diff --git a/src/e2e/rpc/evm/evm.rpc.spec.ts b/src/e2e/rpc/evm/evm.rpc.spec.ts index e401e9103..5d8d4c38c 100644 --- a/src/e2e/rpc/evm/evm.rpc.spec.ts +++ b/src/e2e/rpc/evm/evm.rpc.spec.ts @@ -28,7 +28,7 @@ const testNetworks = [ { network: Network.FANTOM }, { network: Network.FANTOM_TESTNET, apiKey: process.env.V3_API_KEY_TESTNET }, { network: Network.ETHEREUM_CLASSIC }, - { network: Network.POLYGON }, + // { network: Network.POLYGON }, { network: Network.POLYGON_AMOY }, // { network: Network.OPTIMISM }, { network: Network.HAQQ }, diff --git a/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts b/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts index 33df37c6e..8ba77d073 100644 --- a/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts +++ b/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts @@ -11,7 +11,7 @@ const getStellarRpc = async (testnet?: boolean) => version: testnet ? ApiVersion.V3 : ApiVersion.V4, }) -describe('Stellar', () => { +describe.skip('Stellar', () => { let tatum: Stellar describe('mainnet', () => { diff --git a/src/e2e/rpc/other/tatum.rpc.ton.spec.ts b/src/e2e/rpc/other/tatum.rpc.ton.spec.ts new file mode 100644 index 000000000..6c57ea6ed --- /dev/null +++ b/src/e2e/rpc/other/tatum.rpc.ton.spec.ts @@ -0,0 +1,35 @@ +import { Network, RpcNodeType, TatumSDK, Ton } from '../../../service' +import { e2eUtil } from '../../e2e.util' + +const getTonRpc = async (testnet: boolean) => { + return await TatumSDK.init({ + ...e2eUtil.initConfig(testnet ? Network.TON_TESTNET : Network.TON), rpc: { + nodes: [ + { + url: testnet ? 'https://testnet.tonapi.io' : 'https://tonapi.io', + type: RpcNodeType.NORMAL, + }, + ], + }, + }) +} + +describe('Ton', () => { + [true, false].forEach(testnet => { + describe(testnet ? 'Testnet' : 'Mainnet', () => { + it('status', async () => { + const ton = await getTonRpc(testnet) + const result = await ton.rpc.status() + await ton.destroy() + expect(result).toBeDefined() + }) + + it('getBlockchainValidators', async () => { + const ton = await getTonRpc(testnet) + const result = await ton.rpc.getBlockchainValidators() + await ton.destroy() + expect(result).toBeDefined() + }) + }) + }) +}) diff --git a/src/e2e/tatum.notification.spec.ts b/src/e2e/tatum.notification.spec.ts index 941655dea..bf409538d 100644 --- a/src/e2e/tatum.notification.spec.ts +++ b/src/e2e/tatum.notification.spec.ts @@ -17,7 +17,7 @@ import { } from './e2e.constant' import { e2eUtil } from './e2e.util' -describe('notification', () => { +describe.skip('notification', () => { describe('createSubscription', () => { describe('IP auth', () => { describe('Address Event', () => { diff --git a/src/service/rpc/other/AbstractTonRpc.ts b/src/service/rpc/other/AbstractTonRpc.ts new file mode 100644 index 000000000..060d9ba1f --- /dev/null +++ b/src/service/rpc/other/AbstractTonRpc.ts @@ -0,0 +1,1044 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { PostI } from '../../../dto/PostI' +import { GetI } from '../../../dto/GetI' +import { QueryParams } from '../../../dto' +import { Utils } from '../../../util' +import { TonRpcSuite } from '../../../dto/rpc/ton/TonRpcSuite' +import { ServiceStatus } from '../../../dto/rpc/ton/models/ServiceStatus' +import { ApiParams, NetworkParams } from '../../../dto/rpc/KadenaRpcSuite' +import { Accounts } from '../../../dto/rpc/ton/models/Accounts' +import { Seqno } from '../../../dto/rpc/ton/models/Seqno' +import { StorageProvider } from '../../../dto/rpc/ton/models/StorageProvider' +import { Trace } from '../../../dto/rpc/ton/models/Trace' +import { Multisig } from '../../../dto/rpc/ton/models/Multisig' +import { AccountEvents } from '../../../dto/rpc/ton/models/AccountEvents' +import { NftCollections } from '../../../dto/rpc/ton/models/NftCollections' +import { NftCollection } from '../../../dto/rpc/ton/models/NftCollection' +import { NftItems } from '../../../dto/rpc/ton/models/NftItems' +import { NftItem } from '../../../dto/rpc/ton/models/NftItem' +import { TokenRates } from '../../../dto/rpc/ton/models/TokenRates' +import { MarketTonRates } from '../../../dto/rpc/ton/models/MarketTonRates' +import { AccountStaking } from '../../../dto/rpc/ton/models/AccountStaking' +import { PoolImplementation } from '../../../dto/rpc/ton/models/PoolImplementation' +import { PoolInfo } from '../../../dto/rpc/ton/models/PoolInfo' +import { ApyHistory } from '../../../dto/rpc/ton/models/ApyHistory' +import { BlockRaw } from '../../../dto/rpc/ton/models/BlockRaw' +import { InitStateRaw } from '../../../dto/rpc/ton/models/InitStateRaw' +import { GaslessConfig } from '../../../dto/rpc/ton/models/GaslessConfig' +import { Jettons } from '../../../dto/rpc/ton/models/Jettons' +import { JettonInfo } from '../../../dto/rpc/ton/models/JettonInfo' +import { JettonHolders } from '../../../dto/rpc/ton/models/JettonHolders' +import { SignRawParams } from '../../../dto/rpc/ton/models/SignRawParams' +import { InscriptionBalances } from '../../../dto/rpc/ton/models/InscriptionBalances' +import { Event } from '../../../dto/rpc/ton/models/Event' +import { Multisigs } from '../../../dto/rpc/ton/models/Multisigs' +import { DnsExpiring } from '../../../dto/rpc/ton/models/DnsExpiring' +import { FoundAccounts } from '../../../dto/rpc/ton/models/FoundAccounts' +import { Subscriptions } from '../../../dto/rpc/ton/models/Subscriptions' +import { TraceIDs } from '../../../dto/rpc/ton/models/TraceIDs' +import { AccountEvent } from '../../../dto/rpc/ton/models/AccountEvent' +import { DecodedMessage } from '../../../dto/rpc/ton/models/DecodedMessage' +import { MessageConsequences } from '../../../dto/rpc/ton/models/MessageConsequences' +import { JettonBalance } from '../../../dto/rpc/ton/models/JettonBalance' +import { AccountInfoByStateInit } from '../../../dto/rpc/ton/models/AccountInfoByStateInit' +import { DomainInfo } from '../../../dto/rpc/ton/models/DomainInfo' +import { DnsRecord } from '../../../dto/rpc/ton/models/DnsRecord' +import { DomainBids } from '../../../dto/rpc/ton/models/DomainBids' +import { Auctions } from '../../../dto/rpc/ton/models/Auctions' +import { ReducedBlocks } from '../../../dto/rpc/ton/models/ReducedBlocks' +import { BlockchainBlock } from '../../../dto/rpc/ton/models/BlockchainBlock' +import { BlockchainBlockShards } from '../../../dto/rpc/ton/models/BlockchainBlockShards' +import { BlockchainBlocks } from '../../../dto/rpc/ton/models/BlockchainBlocks' +import { Transactions } from '../../../dto/rpc/ton/models/Transactions' +import { BlockchainConfig } from '../../../dto/rpc/ton/models/BlockchainConfig' +import { RawBlockchainConfig } from '../../../dto/rpc/ton/models/RawBlockchainConfig' +import { Transaction } from '../../../dto/rpc/ton/models/Transaction' +import { Validators } from '../../../dto/rpc/ton/models/Validators' +import { BlockchainRawAccount } from '../../../dto/rpc/ton/models/BlockchainRawAccount' +import { MethodExecutionResult } from '../../../dto/rpc/ton/models/MethodExecutionResult' +import { BlockchainAccountInspect } from '../../../dto/rpc/ton/models/BlockchainAccountInspect' +import { Account } from '../../../dto/rpc/ton/models/Account' +import { DomainNames } from '../../../dto/rpc/ton/models/DomainNames' +import { JettonsBalances } from '../../../dto/rpc/ton/models/JettonsBalances' + +interface RequestI { + path: string + body?: any + notConvertCamelToSnake?: boolean + queryParams?: QueryParams + network?: NetworkParams | ApiParams +} + +export abstract class AbstractTonRpc implements TonRpcSuite { + + private prepareRequest({ path, body, queryParams }: RequestI): PostI { + return { + path: Utils.addQueryParams({ + basePath: path, + strategy: Utils.camelToDashCase, + queryParams: queryParams, + }), + body, + } + } + + protected abstract post(post: PostI): Promise + + protected abstract get(get: GetI): Promise + + protected abstract put(post: PostI): Promise + + private sendPost(request: RequestI): Promise { + return this.post(this.prepareRequest(request)) + } + + private sendPut(request: RequestI): Promise { + return this.put(this.prepareRequest(request)) + } + + private async sendGet({ path, queryParams }: { path: string; queryParams?: QueryParams }): Promise { + return this.get({ path: Utils.addQueryParams({ basePath: path, queryParams: queryParams }) }) + } + + // Multisig + getMultisigAccount(accountId: string): Promise { + return this.sendGet({ path: `/v2/multisig/${accountId}` }) + } + + // NftE2eClient + getAccountNftHistory( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/nfts/history`, + queryParams: { limit, before_lt: beforeLt, start_date: startDate, end_date: endDate } + }) + } + + getNftCollections(limit: number, offset?: number): Promise { + return this.sendGet({ + path: `/v2/nfts/collections`, + queryParams: { limit, offset } + }) + } + + getNftCollection(accountId: string): Promise { + return this.sendGet({ path: `/v2/nfts/collections/${accountId}` }) + } + + getItemsFromCollection(accountId: string, limit: number, offset?: number): Promise { + return this.sendGet({ + path: `/v2/nfts/collections/${accountId}/items`, + queryParams: { limit, offset } + }) + } + + getNftItemsByAddresses(requestBody?: { account_ids: Array }): Promise { + return this.sendPost({ + path: `/v2/nfts/_bulk`, + body: requestBody + }) + } + + getNftItemByAddress(accountId: string): Promise { + return this.sendGet({ path: `/v2/nfts/${accountId}` }) + } + + getNftHistoryById( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise { + return this.sendGet({ + path: `/v2/nfts/${accountId}/history`, + queryParams: { limit, before_lt: beforeLt, start_date: startDate, end_date: endDate } + }) + } + + // RatesE2eClient + getRates(tokens: Array, currencies: Array): Promise<{ rates: Record }> { + return this.sendGet({ + path: `/v2/rates`, + queryParams: { tokens: tokens.join(','), currencies: currencies.join(',') } + }) + } + + getChartRates( + token: string, + currency?: string, + startDate?: number, + endDate?: number, + pointsCount?: number + ): Promise<{ points: any }> { + return this.sendGet({ + path: `/v2/rates/chart`, + queryParams: { token, currency, start_date: startDate, end_date: endDate, points_count: pointsCount } + }) + } + + getMarketsRates(): Promise<{ markets: Array }> { + return this.sendGet({ path: `/v2/rates/markets` }) + } + + // StakingE2eClient + getAccountNominatorsPools(accountId: string): Promise { + return this.sendGet({ path: `/v2/staking/nominator/${accountId}/pools` }) + } + + getStakingPoolInfo(accountId: string): Promise<{ implementation: PoolImplementation; pool: PoolInfo }> { + return this.sendGet({ + path: `/v2/staking/pool/${accountId}`, + }) + } + + getStakingPoolHistory(accountId: string): Promise<{ apy: Array }> { + return this.sendGet({ path: `/v2/staking/pool/${accountId}/history` }) + } + + getStakingPools( + availableFor?: string, + includeUnverified?: boolean, + ): Promise<{ pools: Array; implementations: Record }> { + return this.sendGet({ + path: `/v2/staking/pools`, + queryParams: { available_for: availableFor, include_unverified: includeUnverified} + }) + } + + // StorageE2eClient + getStorageProviders(): Promise<{ providers: Array }> { + return this.sendGet({ path: `/v2/storage/providers` }) + } + + // TracesE2eClient + getTrace(traceId: string): Promise { + return this.sendGet({ path: `/v2/traces/${traceId}` }) + } + + // WalletE2eClient + getWalletBackup(xTonConnectAuth: string): Promise<{ dump: string }> { + return this.sendGet({ + path: `/v2/wallet/backup`, + queryParams: { 'X-TonConnect-Auth': xTonConnectAuth } + }) + } + + setWalletBackup(xTonConnectAuth: string, requestBody: Blob): Promise { + return this.sendPut({ + path: `/v2/wallet/backup`, + body: requestBody, + queryParams: { 'X-TonConnect-Auth': xTonConnectAuth } + }) + } + + tonConnectProof(requestBody: { + address: string + proof: { + timestamp: number + domain: { + length_bytes?: number + value: string + } + signature: string + payload: string + state_init?: string + } + }): Promise<{ token: string }> { + return this.sendPost({ + path: `/v2/wallet/auth/proof`, + body: requestBody + }) + } + + getWalletsByPublicKey(publicKey: string): Promise { + return this.sendGet({ path: `/v2/pubkeys/${publicKey}/wallets` }) + } + + getAccountSeqno(accountId: string): Promise { + return this.sendGet({ path: `/v2/wallet/${accountId}/seqno` }) + } + + // Lite Server + getRawMasterchainInfo(): Promise<{ + last: BlockRaw; + state_root_hash: string; + init: InitStateRaw; + }> { + return this.sendGet({ path: '/v2/liteserver/get_masterchain_info' }); + } + + getRawMasterchainInfoExt(mode: number): Promise<{ + mode: number; + version: number; + capabilities: number; + last: BlockRaw; + last_utime: number; + now: number; + state_root_hash: string; + init: InitStateRaw; + }> { + return this.sendGet({ + path: '/v2/liteserver/get_masterchain_info_ext', + queryParams: { mode }, + }); + } + + getRawTime(): Promise<{ time: number }> { + return this.sendGet({ path: '/v2/liteserver/get_time' }); + } + + getRawBlockchainBlock(blockId: string): Promise<{ + id: BlockRaw; + data: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_block/${blockId}`, + }); + } + + getRawBlockchainBlockState(blockId: string): Promise<{ + id: BlockRaw; + root_hash: string; + file_hash: string; + data: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_state/${blockId}`, + }); + } + + getRawBlockchainBlockHeader(blockId: string, mode: number): Promise<{ + id: BlockRaw; + mode: number; + header_proof: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_block_header/${blockId}`, + queryParams: { mode }, + }); + } + + sendRawMessage(requestBody: { body: string }): Promise<{ code: number }> { + return this.sendPost({ + path: '/v2/liteserver/send_message', + body: requestBody, + }); + } + + getRawAccountState(accountId: string, targetBlock?: string): Promise<{ + id: BlockRaw; + shardblk: BlockRaw; + shard_proof: string; + proof: string; + state: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_account_state/${accountId}`, + queryParams: { target_block: targetBlock }, + }); + } + + getRawShardInfo(blockId: string, workchain: number, shard: number, exact: boolean): Promise<{ + id: BlockRaw; + shardblk: BlockRaw; + shard_proof: string; + shard_descr: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_shard_info/${blockId}`, + queryParams: { workchain, shard, exact }, + }); + } + + getAllRawShardsInfo(blockId: string): Promise<{ + id: BlockRaw; + proof: string; + data: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_all_shards_info/${blockId}`, + }); + } + + getRawTransactions(accountId: string, count: number, lt: number, hash: string): Promise<{ + ids: Array; + transactions: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_transactions/${accountId}`, + queryParams: { count, lt, hash }, + }); + } + + getRawListBlockTransactions( + blockId: string, + mode: number, + count: number, + accountId?: string, + lt?: number, + ): Promise<{ + id: BlockRaw; + req_count: number; + incomplete: boolean; + ids: Array<{ + mode: number; + account?: string; + lt?: number; + hash?: string; + }>; + proof: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/list_block_transactions/${blockId}`, + queryParams: { mode, count, account_id: accountId, lt }, + }); + } + + getRawBlockProof(knownBlock: string, mode: number, targetBlock?: string): Promise<{ + complete: boolean; + from: BlockRaw; + to: BlockRaw; + steps: Array<{ + lite_server_block_link_back: { + to_key_block: boolean; + from: BlockRaw; + to: BlockRaw; + dest_proof: string; + proof: string; + state_proof: string; + }; + lite_server_block_link_forward: { + to_key_block: boolean; + from: BlockRaw; + to: BlockRaw; + dest_proof: string; + config_proof: string; + signatures: { + validator_set_hash: number; + catchain_seqno: number; + signatures: Array<{ + node_id_short: string; + signature: string; + }>; + }; + }; + }>; + }> { + return this.sendGet({ + path: '/v2/liteserver/get_block_proof', + queryParams: { known_block: knownBlock, target_block: targetBlock, mode }, + }); + } + + getRawConfig(blockId: string, mode: number): Promise<{ + mode: number; + id: BlockRaw; + state_proof: string; + config_proof: string; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_config_all/${blockId}`, + queryParams: { mode }, + }); + } + + getRawShardBlockProof(blockId: string): Promise<{ + masterchain_id: BlockRaw; + links: Array<{ + id: BlockRaw; + proof: string; + }>; + }> { + return this.sendGet({ + path: `/v2/liteserver/get_shard_block_proof/${blockId}`, + }); + } + + getOutMsgQueueSizes(): Promise<{ + ext_msg_queue_size_limit: number; + shards: Array<{ + id: BlockRaw; + size: number; + }>; + }> { + return this.sendGet({ path: '/v2/liteserver/get_out_msg_queue_sizes' }); + } + + // GasLess + gaslessConfig(): Promise { + return this.sendGet({ path: '/v2/gasless/config' }); + } + + gaslessEstimate(masterId: string, requestBody: { wallet_address: string; wallet_public_key: string; messages: Array<{ boc: string }> }): Promise { + return this.sendPost({ + path: `/v2/gasless/estimate/${masterId}`, + body: requestBody, + }); + } + + gaslessSend(requestBody: { wallet_public_key: string; boc: string }): Promise { + return this.sendPost({ + path: '/v2/gasless/send', + body: requestBody, + }); + } + + // Inscriptions + getAccountInscriptions(accountId: string, limit?: number, offset?: number): Promise { + return this.sendGet({ + path: `/v2/experimental/accounts/${accountId}/inscriptions`, + queryParams: { limit, offset }, + }); + } + + getAccountInscriptionsHistory(accountId: string, beforeLt?: number, limit?: number): Promise { + return this.sendGet({ + path: `/v2/experimental/accounts/${accountId}/inscriptions/history`, + queryParams: { before_lt: beforeLt, limit }, + }); + } + + getAccountInscriptionsHistoryByTicker( + accountId: string, + ticker: string, + beforeLt?: number, + limit?: number + ): Promise { + return this.sendGet({ + path: `/v2/experimental/accounts/${accountId}/inscriptions/${ticker}/history`, + queryParams: { before_lt: beforeLt, limit }, + }); + } + + getInscriptionOpTemplate( + type: 'ton20' | 'gram20', + operation: 'transfer', + amount: string, + ticker: string, + who: string, + destination?: string, + comment?: string + ): Promise<{ comment: string; destination: string }> { + return this.sendGet({ + path: '/v2/experimental/inscriptions/op-template', + queryParams: { type, destination, comment, operation, amount, ticker, who }, + }); + } + + // Jettons + getJettons(limit?: number, offset?: number): Promise { + return this.sendGet({ + path: '/v2/jettons', + queryParams: { limit, offset }, + }); + } + + getJettonInfo(accountId: string): Promise { + return this.sendGet({ + path: `/v2/jettons/${accountId}`, + }); + } + + getJettonHolders(accountId: string, limit?: number, offset?: number): Promise { + return this.sendGet({ + path: `/v2/jettons/${accountId}/holders`, + queryParams: { limit, offset }, + }); + } + + getJettonsEvents(eventId: string): Promise { + return this.sendGet({ + path: `/v2/events/${eventId}/jettons`, + }); + } + + getEvent(eventId: string): Promise { + return this.sendGet({ + path: `/v2/events/${eventId}`, + }); + } + + // emulation + public decodeMessage( + requestBody: { boc: string } + ): Promise { + return this.sendPost({ + path: '/v2/message/decode', + body: requestBody, + }); + } + + public emulateMessageToEvent( + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise { + return this.sendPost({ + path: '/v2/events/emulate', + body: requestBody, + queryParams: { ignore_signature_check: ignoreSignatureCheck }, + }); + } + + public emulateMessageToTrace( + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise { + return this.sendPost({ + path: '/v2/traces/emulate', + body: requestBody, + queryParams: { ignore_signature_check: ignoreSignatureCheck }, + }); + } + + public emulateMessageToWallet( + requestBody: { + boc: string; + params?: Array<{ address: string; balance?: number }>; + }, + ): Promise { + return this.sendPost({ + path: '/v2/wallet/emulate', + body: requestBody, + }); + } + + public emulateMessageToAccountEvent( + accountId: string, + requestBody: { boc: string }, + ignoreSignatureCheck?: boolean + ): Promise { + return this.sendPost({ + path: `/v2/accounts/${accountId}/events/emulate`, + body: requestBody, + queryParams: { ignore_signature_check: ignoreSignatureCheck }, + }); + } + + // Connect + public getTonConnectPayload(): Promise<{ payload: string }> { + return this.sendGet({ + path: '/v2/tonconnect/payload', + }); + } + + public getAccountInfoByStateInit( + requestBody: { state_init: string } + ): Promise { + return this.sendPost({ + path: '/v2/tonconnect/stateinit', + body: requestBody, + }); + } + + // DNS + public getDnsInfo( + domainName: string + ): Promise { + return this.sendGet({ + path: `/v2/dns/${domainName}`, + }); + } + + public dnsResolve( + domainName: string + ): Promise { + return this.sendGet({ + path: `/v2/dns/${domainName}/resolve`, + }); + } + + public getDomainBids( + domainName: string + ): Promise { + return this.sendGet({ + path: `/v2/dns/${domainName}/bids`, + }); + } + + public getAllAuctions(tld?: string): Promise { + return this.sendGet({ + path: '/v2/dns/auctions', + queryParams: { tld }, + }); + } + + // blockchain + public status(): Promise { + return this.sendGet({ + path: '/v2/status', + }); + } + + public getReducedBlockchainBlocks( + from: number, + to: number + ): Promise { + return this.sendGet({ + path: '/v2/blockchain/reduced/blocks', + queryParams: { from, to }, + }); + } + + public getBlockchainBlock( + blockId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/blocks/${blockId}`, + }); + } + + public getBlockchainMasterchainShards( + masterchainSeqno: number + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/masterchain/${masterchainSeqno}/shards`, + }); + } + + public getBlockchainMasterchainBlocks( + masterchainSeqno: number + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/masterchain/${masterchainSeqno}/blocks`, + }); + } + + public getBlockchainMasterchainTransactions( + masterchainSeqno: number + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/masterchain/${masterchainSeqno}/transactions`, + }); + } + + public getBlockchainConfigFromBlock( + masterchainSeqno: number + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/masterchain/${masterchainSeqno}/config`, + }); + } + + public getRawBlockchainConfigFromBlock( + masterchainSeqno: number + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/masterchain/${masterchainSeqno}/config/raw`, + }); + } + + public getBlockchainBlockTransactions( + blockId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/blocks/${blockId}/transactions`, + }); + } + + public getBlockchainTransaction( + transactionId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/transactions/${transactionId}`, + }); + } + + public getBlockchainTransactionByMessageHash( + msgId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/messages/${msgId}/transaction`, + }); + } + + public getBlockchainValidators(): Promise { + return this.sendGet({ + path: '/v2/blockchain/validators', + }); + } + + public getBlockchainMasterchainHead(): Promise { + return this.sendGet({ + path: '/v2/blockchain/masterchain-head', + }); + } + + public getBlockchainRawAccount( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/accounts/${accountId}`, + }); + } + + public getBlockchainAccountTransactions( + accountId: string, + afterLt?: number, + beforeLt?: number, + limit?: number, + sortOrder: 'desc' | 'asc' = 'desc' + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/accounts/${accountId}/transactions`, + queryParams: { + after_lt: afterLt, + before_lt: beforeLt, + limit, + sort_order: sortOrder, + }, + }); + } + + public execGetMethodForBlockchainAccount( + accountId: string, + methodName: string, + args?: Array + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/accounts/${accountId}/methods/${methodName}`, + queryParams: { args }, + }); + } + + public sendBlockchainMessage( + requestBody: { boc?: string; batch?: Array } + ): Promise { + return this.sendPost({ + path: '/v2/blockchain/message', + body: requestBody, + }); + } + + public getBlockchainConfig(): Promise { + return this.sendGet({ + path: '/v2/blockchain/config', + }); + } + + public getRawBlockchainConfig(): Promise { + return this.sendGet({ + path: '/v2/blockchain/config/raw', + }); + } + + public blockchainAccountInspect( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/blockchain/accounts/${accountId}/inspect`, + }); + } + + public addressParse( + accountId: string + ): Promise<{ + raw_form: string; + bounceable: { + b64: string; + b64url: string; + }; + non_bounceable: { + b64: string; + b64url: string; + }; + given_type: string; + test_only: boolean; + }> { + return this.sendGet({ + path: `/v2/address/${accountId}/parse`, + }); + } + + public getAccounts( + currency?: string, + requestBody?: { account_ids: Array } + ): Promise { + return this.sendPost({ + path: '/v2/accounts/_bulk', + body: requestBody, + queryParams: { currency }, + }); + } + + public getAccount( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}`, + }); + } + + public accountDnsBackResolve( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/dns/backresolve`, + }); + } + + public getAccountJettonsBalances( + accountId: string, + currencies?: Array + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/jettons`, + queryParams: { currencies }, + }); + } + + public getAccountJettonBalance( + accountId: string, + jettonId: string, + currencies?: Array + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/jettons/${jettonId}`, + queryParams: { currencies }, + }); + } + + public getAccountJettonsHistory( + accountId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/jettons/history`, + queryParams: { before_lt: beforeLt, limit, start_date: startDate, end_date: endDate }, + }); + } + + public getAccountJettonHistoryById( + accountId: string, + jettonId: string, + limit: number, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/jettons/${jettonId}/history`, + queryParams: { before_lt: beforeLt, limit, start_date: startDate, end_date: endDate }, + }); + } + + public getAccountNftItems( + accountId: string, + collection?: string, + limit?: number, + indirectOwnership?: boolean, + offset?: number, + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/nfts`, + queryParams: { collection, limit, offset, indirect_ownership: indirectOwnership }, + }); + } + + public getAccountEvents( + accountId: string, + limit: number, + initiator?: boolean, + subjectOnly?: boolean, + beforeLt?: number, + startDate?: number, + endDate?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/events`, + queryParams: { initiator, subject_only: subjectOnly, before_lt: beforeLt, limit, start_date: startDate, end_date: endDate }, + }); + } + + public getAccountEvent( + accountId: string, + eventId: string, + subjectOnly: boolean + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/events/${eventId}`, + queryParams: { subject_only: subjectOnly }, + }); + } + + public getAccountTraces( + accountId: string, + beforeLt?: number, + limit?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/traces`, + queryParams: { before_lt: beforeLt, limit }, + }); + } + + public getAccountSubscriptions( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/subscriptions`, + }); + } + + public reindexAccount( + accountId: string + ): Promise { + return this.sendPost({ + path: `/v2/accounts/${accountId}/reindex`, + }); + } + + public searchAccounts( + name: string + ): Promise { + return this.sendGet({ + path: '/v2/accounts/search', + queryParams: { name }, + }); + } + + public getAccountDnsExpiring( + accountId: string, + period?: number + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/dns/expiring`, + queryParams: { period }, + }); + } + + public getAccountPublicKey( + accountId: string + ): Promise<{ public_key: string }> { + return this.sendGet({ + path: `/v2/accounts/${accountId}/publickey`, + }); + } + + public getAccountMultisigs( + accountId: string + ): Promise { + return this.sendGet({ + path: `/v2/accounts/${accountId}/multisigs`, + }); + } + + public getAccountDiff( + accountId: string, + startDate: number, + endDate: number + ): Promise<{ balance_change: number }> { + return this.sendGet({ + path: `/v2/accounts/${accountId}/diff`, + queryParams: { start_date: startDate, end_date: endDate }, + }); + } +} diff --git a/src/service/rpc/other/TonRpc.ts b/src/service/rpc/other/TonRpc.ts new file mode 100644 index 000000000..befa937e0 --- /dev/null +++ b/src/service/rpc/other/TonRpc.ts @@ -0,0 +1,45 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { GetI } from 'src/dto/GetI' +import { Container, Service } from 'typedi' +import { TatumConnector } from '../../../connector/tatum.connector' +import { PostI } from '../../../dto/PostI' +import { CONFIG, Utils } from '../../../util' +import { TatumConfig } from '../../tatum' +import { AbstractTonRpc } from './AbstractTonRpc' +import { TonRpcSuite } from '../../../dto/rpc/ton/TonRpcSuite' + +@Service({ + factory: (data: { id: string }) => { + return new TonRpc(data.id) + }, + transient: true, +}) +export class TonRpc extends AbstractTonRpc implements TonRpcSuite { + protected readonly connector: TatumConnector + protected readonly config: TatumConfig + + constructor(id: string) { + super() + this.connector = Container.of(id).get(TatumConnector) + this.config = Container.of(id).get(CONFIG) + } + + public destroy() { + // Do nothing + } + + protected post(post: PostI): Promise { + const basePath = Utils.getV3RpcUrl(this.config) + return this.connector.post({ ...post, basePath }) + } + + protected get(get: GetI): Promise { + const basePath = Utils.getV3RpcUrl(this.config) + return this.connector.get({ ...get, basePath }) + } + + protected put(put: PostI): Promise { + const basePath = Utils.getV3RpcUrl(this.config) + return this.connector.post({ ...put, basePath }) + } +} diff --git a/src/service/tatum/tatum.evm.ts b/src/service/tatum/tatum.evm.ts index 9a45bb89c..b813a4b1e 100644 --- a/src/service/tatum/tatum.evm.ts +++ b/src/service/tatum/tatum.evm.ts @@ -55,13 +55,13 @@ export class Aurora extends BaseEvm {} export class AvalancheC extends NotificationEvm {} export class Cronos extends NotificationEvm {} export class EthereumClassic extends BaseEvm {} -export class Fantom extends BaseEvm {} +export class Fantom extends NotificationEvm {} export class Gnosis extends BaseEvm {} export class Haqq extends BaseEvm {} export class HarmonyOne extends BaseEvm {} export class Kucoin extends BaseEvm {} export class Oasis extends BaseEvm {} -export class Optimism extends BaseEvm {} +export class Optimism extends NotificationEvm {} export class Palm extends BaseEvm {} export class Vechain extends BaseEvm {} export class XinFin extends BaseEvm {} diff --git a/src/service/tatum/tatum.other.ts b/src/service/tatum/tatum.other.ts index 74fc2e3a6..76b0f69bc 100644 --- a/src/service/tatum/tatum.other.ts +++ b/src/service/tatum/tatum.other.ts @@ -19,6 +19,7 @@ import { Token } from '../token' import { TatumSdkChain } from './tatum' import { CosmosRpcSuite } from '../../dto/rpc/CosmosRpcSuite' import { CasperRpcSuite } from '../../dto/rpc/CasperRpcSuite' +import { TonRpcSuite } from '../../dto/rpc/ton/TonRpcSuite' export abstract class BaseOther extends TatumSdkChain { ipfs: Ipfs @@ -151,6 +152,15 @@ export class Casper extends BaseOther { } } +export class Ton extends BaseOther { + rpc: TonRpcSuite + + constructor(id: string) { + super(id) + this.rpc = Utils.getRpc(id, Container.of(id).get(CONFIG)) + } +} + export class AlgorandAlgod extends BaseOther { rpc: AlgorandAlgodRpcSuite diff --git a/src/util/constant.ts b/src/util/constant.ts index 140c0c864..a13ec9a5d 100644 --- a/src/util/constant.ts +++ b/src/util/constant.ts @@ -126,7 +126,9 @@ export const Constant = { [Network.BITCOIN_ELECTRS]: 18, [Network.BITCOIN_ELECTRS_TESTNET]: 18, [Network.ROSTRUM_TESTNET]: 18, - [Network.CASPER]: 18 + [Network.CASPER]: 18, + [Network.TON]: 9, + [Network.TON_TESTNET]: 9, }, CURRENCY_NAMES: { [Network.BITCOIN]: 'BTC', @@ -233,7 +235,9 @@ export const Constant = { [Network.BITCOIN_ELECTRS]: 'BTC', [Network.BITCOIN_ELECTRS_TESTNET]: 'BTC', [Network.ROSTRUM_TESTNET]: 'BCH', - [Network.CASPER]: 'CASPER' + [Network.CASPER]: 'CASPER', + [Network.TON]: 'TON', + [Network.TON_TESTNET]: 'TON', }, RPC: { MAINNETS: [ diff --git a/src/util/util.shared.ts b/src/util/util.shared.ts index b67467b78..212d70f8e 100644 --- a/src/util/util.shared.ts +++ b/src/util/util.shared.ts @@ -7,7 +7,9 @@ import { isAlgorandAlgodNetwork, isAlgorandIndexerNetwork, isBnbLoadBalancerNetwork, - isCardanoNetwork, isCasperNetwork, isCosmosNetwork, + isCardanoNetwork, + isCasperNetwork, + isCosmosNetwork, isDogecoinLoadBalancedNetwork, isEosLoadBalancerNetwork, isEosNetwork, @@ -15,7 +17,8 @@ import { isEvmArchiveNonArchiveLoadBalancerNetwork, isEvmBasedNetwork, isEvmLoadBalancerNetwork, - isIotaLoadBalancerNetwork, isIotaNetwork, + isIotaLoadBalancerNetwork, + isIotaNetwork, isKadenaLoadBalancerNetwork, isNativeEvmLoadBalancerNetwork, isRostrumLoadBalancerNetwork, @@ -24,6 +27,7 @@ import { isStellarLoadBalancerNetwork, isStellarNetwork, isTezosNetwork, + isTonNetwork, isTronLoadBalancerNetwork, isTronNetwork, isUtxoBasedNetwork, @@ -50,11 +54,14 @@ import { Base, BinanceSmartChain, Bitcoin, - BitcoinCash, BitcoinElectrs, + BitcoinCash, + BitcoinElectrs, Bnb, - CardanoRosetta, Casper, + CardanoRosetta, + Casper, Celo, - Chiliz, CosmosRosetta, + Chiliz, + CosmosRosetta, Cronos, Dogecoin, Eos, @@ -83,7 +90,7 @@ import { Solana, Stellar, TatumConfig, - Tezos, + Tezos, Ton, Tron, UtxoRpc, Vechain, @@ -119,11 +126,16 @@ import { CONFIG, LOGGER } from './di.tokens' import { IotaRpc } from '../service/rpc/other/IotaRpc' import { CosmosLoadBalancerRpc } from '../service/rpc/other/CosmosLoadBalancerRpc' import { CasperLoadBalancerRpc } from '../service/rpc/other/CasperLoadBalancerRpc' +import { TonRpc } from '../service/rpc/other/TonRpc' export const Utils = { getRpc: (id: string, config: TatumConfig): T => { const { network } = config + if(isTonNetwork(network)) { + return Container.of(id).get(TonRpc) as T + } + if(isCasperNetwork(network)) { return Container.of(id).get(CasperLoadBalancerRpc) as T } @@ -341,7 +353,8 @@ export const Utils = { isAlgorandIndexerNetwork(network) || isStellarLoadBalancerNetwork(network) || isKadenaLoadBalancerNetwork(network) || - isIotaLoadBalancerNetwork(network) + isIotaLoadBalancerNetwork(network) || + isTonNetwork(network) ) { return null } @@ -349,6 +362,10 @@ export const Utils = { throw new Error(`Network ${network} is not supported.`) }, getStatusUrl(network: Network, url: string): string { + if (isTonNetwork(network)) { + return `${url}v2/liteserver/get_masterchain_info` + } + if (isIotaLoadBalancerNetwork(network)) { return `${url}api/core/v2/info` } @@ -410,13 +427,18 @@ export const Utils = { isAlgorandIndexerNetwork(network) || isStellarLoadBalancerNetwork(network) || isKadenaLoadBalancerNetwork(network) || - isIotaLoadBalancerNetwork(network) + isIotaLoadBalancerNetwork(network) || + isTonNetwork(network) ) { return 'GET' } return 'POST' }, parseStatusPayload: (network: Network, response: JsonRpcResponse | any) => { + if (isTonNetwork(network)) { + return new BigNumber((response.last.seqno as number) || -1).toNumber() + } + if (isCasperNetwork(network)) { return new BigNumber((response.result.last_added_block_info.height as number) || -1).toNumber() } @@ -472,6 +494,10 @@ export const Utils = { throw new Error(`Network ${network} is not supported.`) }, isResponseOk: (network: Network, response: JsonRpcResponse | any) => { + if (isTonNetwork(network)) { + return response.last.seqno !== undefined + } + if (isCasperNetwork(network)) { return response.result.last_added_block_info.height !== undefined } @@ -625,6 +651,12 @@ export const Utils = { case Network.AVALANCHE_C: case Network.AVALANCHE_C_TESTNET: return AddressEventNotificationChain.AVAX + case Network.FANTOM: + case Network.FANTOM_TESTNET: + return AddressEventNotificationChain.FTM + case Network.OPTIMISM: + case Network.OPTIMISM_TESTNET: + return AddressEventNotificationChain.OPTIMISM default: throw new Error(`Network ${network} is not supported.`) } @@ -886,6 +918,9 @@ export const Utils = { return new BitcoinElectrs(id) as T case Network.CASPER: return new Casper(id) as T + case Network.TON: + case Network.TON_TESTNET: + return new Ton(id) as T default: return new FullSdk(id) as T } @@ -976,10 +1011,14 @@ export const Utils = { Object.entries(query).forEach(([key, value]) => { if (Array.isArray(value)) { value.forEach((val) => { - params.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`) + if (val != null) { + params.push(`${encodeURIComponent(key)}=${encodeURIComponent(val)}`) + } }) } else { - params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`) + if (value != null) { + params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`) + } } })