支援代幣
AkashicPay 目前支援四個網路/鏈: 以太坊 (Ethereum) 和,波場 (Tron),幣安智能鏈 (BNB Smart Chain (BSC)) 和索拉拉 (Solana)。計劃在不久的將來支援其他區塊鏈,例如比特幣 (Bitcoin)。
請注意,只要 SDK 中需要網路參數 (network parameter),就會指定交易使用的區塊鏈(例如 Ethereum 或 Tron)。交易的貨幣(ETH、USDT-ERC20、TRX、USDT-TRC20、BNB、BSC-USD-BEP20、SOL、USDT-SPL)由_代幣_參數 (token parameter) 決定 - 原生交易不需要代幣參數(null 或 undefined 或類似)。更多詳情和範例請參閱下文。
Tron (波場)
在 Tron 網路上,AkashicPay 支援涉及原生代幣 (TRX) 和 Tether 穩定代幣 (USDT-TRC20) 的交易。以下是使用 SDK 以這兩種貨幣進行提幣的範例。所有其他接受網路和代幣參數的函式都以相同的方式運作。
TRX
- TypeScript
- PHP
- Java
- C#
- Go
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,
"")
USDT (TRC20)1
- TypeScript
- PHP
- Java
- C#
- Go
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 here
Ethereum (以太坊)
與 Tron 相似,AkashicPay 也支援原生代幣 (ETH),Tether 穩定代幣 (USDT-ERC20) 和 Circle 穩定代幣 (USDC-ERC20) 的交易。以下是使用 SDK 以這兩種貨幣進行提幣的範例。所有其他接受網路和代幣參數的函式都以相同的方式運作。
ETH
- TypeScript
- PHP
- Java
- C#
- Go
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,
"")
USDT (ERC20)2
- TypeScript
- PHP
- Java
- C#
- Go
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 here
USDC (ERC20)3
- TypeScript
- PHP
- Java
- C#
- Go
const { 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
- TypeScript
- PHP
- Java
- C#
- Go
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 (BSC-USD4)
- TypeScript
- PHP
- Java
- C#
- Go
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 here
USDC (BSC-USD)5
- TypeScript
- PHP
- Java
- C#
- Go
const { 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
Solana (索拉拉)
SOL
- TypeScript
- PHP
- Java
- C#
- Go
const { l2Hash } = await akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol.Solana
);
$result = $akashicPay->payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol::SOLANA
);
APPayoutResult result = akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
APNetworkSymbol.SOL,
APTokenSymbol.NATIVE // or exclude this argument
);
var payoutResult = await sdk.PayoutAsync(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
SolanaNetworkSymbol.Value,
ApTokenSymbol.Native // Or exclude this argument
);
ap.Payout("user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
akashicpay.Solana,
"")
USDT (SPL)
- TypeScript
- PHP
- Java
- C#
- Go
const { l2Hash } = await akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol.Solana,
TokenSymbol.USDT // Note the token here
);
$result = $akashicPay->payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol::SOLANA,
TokenSymbol::USDT // Note the token here
);
APPayoutResult result = akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
APNetworkSymbol.SOL,
APTokenSymbol.USDT // Note the token here
);
var payoutResult = await sdk.PayoutAsync(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
SolanaNetworkSymbol.Value,
ApTokenSymbol.Usdt // Note the token here
);
ap.Payout("user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
akashicpay.Solana,
akashicpay.USDT) // Note the token here
USDC (SPL)
- TypeScript
- PHP
- Java
- C#
- Go
const { l2Hash } = await akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol.Solana,
TokenSymbol.USDC // Note the token here
);
$result = $akashicPay->payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
NetworkSymbol::SOLANA,
TokenSymbol::USDC // Note the token here
);
APPayoutResult result = akashicPay.payout(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
APNetworkSymbol.SOL,
APTokenSymbol.USDC // Note the token here
);
var payoutResult = await sdk.PayoutAsync(
"user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
SolanaNetworkSymbol.Value,
ApTokenSymbol.Usdc // Note the token here
);
ap.Payout("user123",
"8Yza6M8SfB3JWoyhmCL35aWBiEKz7wepWq19fHxcZ9mN",
"100",
akashicpay.Solana,
akashicpay.USDC) // Note the token here
測試網路 (Testnets)
為了測試目的,例如在開發或測試環境中,AkashicPay 支援與每個主網路相關聯的測試網路。對於Ethereum,相關的測試網稱為 「Sepolia」,對於Tron,測試網稱為 「Shasta」,對於幣安智能鏈 (BNB Smart Chain (BSC)),相關的測試網稱為 「BNB Smart Chain Testnet (幣安智能測試鏈)」,而對於 Solana,測試網稱為 「Solana Devnet」。
所有功能都與在主網路上執行的操作相同,但您可以將代碼中的 「NetworkSymbols」 更換為:
- TypeScript
- PHP
- Java
- C#
- Go
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_Mainnet
NetworkSymbol.Solana_Devnet // Instead of NetworkSymbol.Solana
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_MAINNET
NetworkSymbol::SOLANA_DEV // Instead of NetworkSymbol::SOL
APNetworkSymbol.TRX_SHASTA // Instead of APNetworkSymbol.TRX
APNetworkSymbol.SEP // Instead of APNetworkSymbol.ETH
APNetworkSymbol.tBNB // Instead of ApNetworkSymbol.BNB
APNetworkSymbol.SOL_DEV // Instead of ApNetworkSymbol.SOL
TronShastaNetworkSymbol.Value // Instead of TronNetworkSymbol.Value
EthSepNetworkSymbol.Value // Instead of EthNetworkSymbol.Value
TBnbNetworkSymbol.Value // Instead of BnbNetworkSymbol.Value
SolanaDevNetworkSymbol.Value // Instead of SolanaNetworkSymbol.Value
akashicpay.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
akashicpay.Solana_Devnet // Instead of akashicpay.Solana
註:USDT 亦支援 SEP、Shasta、SOL (Devnet) 及 BNB 測試網(USDT-TRC20、USDT-ERC20 與 USDT-BEP20)。其使用方式與主網完全相同,無需調整。即 JavaScript/TypeScript 仍使用
TokenSymbol.USDT,其他語言亦同。USDC 支援 SEP、SOL(Devnet)及 BNB 測試網。請使用
TokenSymbol.USDC,其他語言亦採用類似命名規則。