支援代幣
AkashicPay 目前支援兩個網路/鏈: 以太坊 (Ethereum) 和,波場 (Tron) 和幣安智能鏈 (BNB Smart Chain (BSC))。計劃在不久的將來支援其他區塊鏈,例如比特幣 (Bitcoin)。
請注意,只要 SDK 中需要網路參數 (network parameter),就會指定交易使用的區塊鏈(例如 Ethereum 或 Tron)。交易的貨幣(ETH、USDT-ERC20、TRX、USDT-TRC20、BNB、BSC-USD-BEP20)由代幣參數 (token parameter) 決定 - 原生交易不需要代幣參數(null 或 undefined 或類似)。更多詳情和範例請參閱下文。
Tron (波場)
在 Tron 網路上,AkashicPay 支援涉及原生代幣 (TRX) 和 Tether 穩定代幣 (USDT-TRC20) 的交易。以下是使用 SDK 以這兩種貨幣進行提幣的範例。所有其他接受網路和代幣參數的函式都以相同的方式運作。
TRX
const { l2Hash } = await akashicPay.payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
NetworkSymbol.Tron
);$result = $akashicPay->payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
NetworkSymbol::TRON
);APPayoutResult result = akashicPay.payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
APNetworkSymbol.TRX,
APTokenSymbol.NATIVE // or exclude this argument
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
TronNetworkSymbol.Value,
ApTokenSymbol.Native // Or exclude this argument
);ap.Payout("user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
akashicpay.Tron,
"")const { l2Hash } = await akashicPay.payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
NetworkSymbol.Tron,
TokenSymbol.USDT // Note the token here
);$result = $akashicPay->payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
NetworkSymbol::TRON,
TokenSymbol::USDT // Note the token here
);APPayoutResult result = akashicPay.payout(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
APNetworkSymbol.TRX,
APTokenSymbol.USDT // Note the token here
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
TronNetworkSymbol.Value,
ApTokenSymbol.Usdt // Note the token here
);ap.Payout("user123",
"TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
"100",
akashicpay.Tron,
akashicpay.USDT) // Note the token hereEthereum (以太坊)
與 Tron 相似,AkashicPay 也支援原生代幣 (ETH),Tether 穩定代幣 (USDT-ERC20) 和 Circle 穩定代幣 (USDC-ERC20) 的交易。以下是使用 SDK 以這兩種貨幣進行提幣的範例。所有其他接受網路和代幣參數的函式都以相同的方式運作。
ETH
const { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Ethereum_Mainnet
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::ETHEREUM_MAINNET
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.ETH,
APTokenSymbol.NATIVE // or exclude this argument
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
EthNetworkSymbol.Value,
ApTokenSymbol.Native // Or exclude this argument
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Ethereum_Mainnet,
"")const { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Ethereum_Mainnet,
TokenSymbol.USDT // Note the token here
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::ETHEREUM_MAINNET,
TokenSymbol::USDT // Note the token here
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.ETH,
APTokenSymbol.USDT // Note the token here
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
EthNetworkSymbol.Value,
ApTokenSymbol.Usdt // Note the token here
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Ethereum_Mainnet,
akashicpay.USDT) // Note the token hereconst { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Ethereum_Mainnet,
TokenSymbol.USDC // Note the token here
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::ETHEREUM_MAINNET,
TokenSymbol::USDC // Note the token here
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.ETH,
APTokenSymbol.USDC // Note the token here
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
EthNetworkSymbol.Value,
ApTokenSymbol.Usdc // Note the token here
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Ethereum_Mainnet,
akashicpay.USDC) // Note the token here幣安智能鏈 (BNB Smart Chain (BSC))
BNB
const { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Binance_Smart_Chain_Mainnet
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::BINANCE_SMART_CHAIN_MAINNET
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.BNB,
APTokenSymbol.NATIVE // or exclude this argument
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
BnbNetworkSymbol.Value,
ApTokenSymbol.Native // Or exclude this argument
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Binance_Smart_Chain_Mainnet,
"")USDT ()
const { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Binance_Smart_Chain_Mainnet,
TokenSymbol.USDT // Note the token here
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::BINANCE_SMART_CHAIN_MAINNET,
TokenSymbol::USDT // Note the token here
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.BNB,
APTokenSymbol.USDT // Note the token here
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
BnbNetworkSymbol.Value,
ApTokenSymbol.Usdt // Note the token here
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Binance_Smart_Chain_Mainnet,
akashicpay.USDT) // Note the token hereconst { l2Hash } = await akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol.Binance_Smart_Chain_Mainnet,
TokenSymbol.USDC // Note the token here
);$result = $akashicPay->payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
NetworkSymbol::BINANCE_SMART_CHAIN_MAINNET,
TokenSymbol::USDC // Note the token here
);APPayoutResult result = akashicPay.payout(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
APNetworkSymbol.BNB,
APTokenSymbol.USDC // Note the token here
);var trxPayoutResult = await sdk.PayoutAsync(
"user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
BnbNetworkSymbol.Value,
ApTokenSymbol.Usdc // Note the token here
);ap.Payout("user123",
"0x352ad0b65ccaaddd2c3e3b1a78be555171c239f3",
"100",
akashicpay.Binance_Smart_Chain_Mainnet,
akashicpay.USDC) // Note the token here測試網路 (Testnets)
為了測試目的,例如在開發或測試環境中,AkashicPay 支援與每個主網路相關聯的測試網路。對於Ethereum,相關的測試網稱為 「Sepolia」,而對於Tron,測試網稱為 「Shasta」。
所有功能都與在主網路上執行的操作相同,但您可以將代碼中的 「NetworkSymbols」 更換為:
NetworkSymbol.Tron_Shasta // Instead of NetworkSymbol.Tron
NetworkSymbol.Ethereum_Sepolia // Instead of NetworkSymbol.Ethereum_Mainnet
NetworkSymbol.Binance_Smart_Chain_Testnet // Instead of NetworkSymbol.Binance_Smart_Chain_MainnetNetworkSymbol::TRON_SHASTA // Instead of NetworkSymbol::TRON
NetworkSymbol::ETHEREUM_SEPOLIA // Instead of NetworkSymbol::ETHEREUM_MAINNET
NetworkSymbol::BINANCE_SMART_CHAIN_TESTNET // Instead of NetworkSymbol::BINANCE_SMART_CHAIN_MAINNETAPNetworkSymbol.TRX_SHASTA // Instead of APNetworkSymbol.TRX
APNetworkSymbol.SEP // Instead of APNetworkSymbol.ETH
APNetworkSymbol.tBNB // Instead of ApNetworkSymbol.BNBTronShastaNetworkSymbol.Value // Instead of TronNetworkSymbol.Value
EthSepNetworkSymbol.Value // Instead of EthNetworkSymbol.Value
TBnbNetworkSymbol.Value // Instead of BnbNetworkSymbol.Valueakashicpay.Tron_Shasta // Instead of akashicpay.Tron
akashicpay.Ethereum_Sepolia // Instead of akashicpay.Ethereum_Mainnet
akashicpay.Binance_Smart_Chain_Testnet // Instead of akashicpay.Binance_Smart_Chain_Mainnet請注意: 兩個測試網 (USDT-TRC20 和 USDT-ERC20) 也支援 USDT。不需要改變它們在主網路上的使用方式。也就是說,JS/TS 繼續使用
TokenSymbol.USDT,其他語言也同樣使用TokenSymbol.USDT。
Last updated
Was this helpful?