提款/提幣回調
從您所建立的其中一個錢包 (地址) 支付後所收到的資料
要接收回調,請確保您在 AkashicPay.com 上註冊了您的 URL。您可以接收 「待定」、「已確認」 和 「失敗」 狀態的交易回調。我們建議您設定所有三種狀態,不過如果需要的話,您可以跳過「待定」狀態。只有狀態為 「已確認」 或 「失敗」 的交易才是最終交易。
注意:如果回調的回應狀態代碼 (status code) >= 400,則回調最多會重試 15 次,延遲時間會增加,第一次嘗試後最多可延遲 10 小時左右。
注意: l2Txnhash
(「L2-hash」)應始終用作交易的唯一識別碼 (identifier)。這是 AkashicChain 上任何交易的唯一交易哈希 (transaction-hash)。它存在於已確認的存款和待定/已確認的提款中。這對於第二層交易尤其重要,因為第二層交易沒有第一層哈希值 (txHash
)
注意:雖然我們的目標是在 Akashic 的穩定性和一致性,我們不能保證下面的對象保持不變。舉例來說,新的功能可能需要在回調中加入額外的欄位。然而,我們的目標是不移除現有的欄位。為了方便起見,我們建議根據您的需求過濾和處理回調,同時對未來新增的可能性持開放態度。
範例
待提款/提幣 (L1Transaction)
{
"fromAddress": "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU", // sending wallet/account of transaction
"toAddress": "TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg", // receiving wallet/account of transaction
"layer": "L1Transaction", // 'L1Transaction' or 'L2Transaction'
"initiatedAt": "2024-08-19T10:02:54.000Z", // ISO8601 format
"amount": "1.000000", // Amount sent
"coinSymbol": "TRX", // NetworkSymbol, e.g. 'ETH' or 'TRX'
"status": "Confirmed", // TransactionStatus. 'Pending', 'Confirmed', or 'Failed'
"txHash": "28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc", // Network's hash if L1. Not present for L2
"feesEstimate": "6.114654", // Gas fee estimated by Akashic. Not present for L2
"l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // Akashic Transaction Hash. For both L1 and L2
"senderInfo": {
"identity": "ASbb8efead2d5ff2f618a85895bac8e8ac1bae236d4d730bf113400b7e6f108ca5", // Akashic Address of sender
},
"senderIdentity": "ASbb...", // DEPRECATED. Same as above. Please use senderInfo.identity instead
"tokenSymbol": "USDT", // TokenSymbol. Present only if token-transaction
"internalFee": {
"withdraw": "0.100000"
}, // Akashic Fee { deposit?: string, withdraw?: string}
"identifier": "user123", // User-identifier
"feeIsDelegated": false, // Whether L1 gas fees were paid using token instead of native coin
"directResolution": false // true if the transaction was never registered in the "Pending" state
}
提款/提幣 (L1Transaction)
{
"fromAddress": "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU", // sending wallet/account of transaction
"toAddress": "TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg", // receiving wallet/account of transaction
"layer": "L1Transaction", // 'L1Transaction' or 'L2Transaction'
"initiatedAt": "2024-08-19T10:02:54.000Z", // ISO8601 format
"confirmedAt": "2024-08-19T10:04:02.000Z", // Only present if status is 'Confirmed' or 'Failed'
"amount": "1.000000", // Amount sent
"coinSymbol": "TRX", // NetworkSymbol, e.g. 'ETH' or 'TRX'
"status": "Confirmed", // TransactionStatus. 'Pending', 'Confirmed', or 'Failed'
"txHash": "28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc", // Network's hash if L1. Not present for L2
"feesEstimate": "6.114654", // Gas fee estimated by Akashic. Not present for L2
"feesPaid": "5.822220", // Gas Fee paid on network. Not present for L2
"l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // Akashic Transaction Hash. For both L1 and L2
"senderInfo": {
"identity": "ASbb8efead2d5ff2f618a85895bac8e8ac1bae236d4d730bf113400b7e6f108ca5", // Akashic Address of sender
},
"senderIdentity": "ASbb...", // DEPRECATED. Same as above. Please use senderInfo.identity instead
"tokenSymbol": "USDT", // TokenSymbol. Present only if token-transaction
"internalFee": {
"withdraw": "0.100000"
}, // Akashic Fee { deposit?: string, withdraw?: string}
"identifier": "user123", // User-identifier
"feeIsDelegated": false, // Whether L1 gas fees were paid using token instead of native coin
"directResolution": false // true if the transaction was never registered in the "Pending" state
}
對於待處理交易,feesPaid
和 confirmedAt
尚未知道,因此不存在。
關於提款費用的說明
提款時,有幾種不同的費用。這些是:
Akashic 費用 (回調中的
internalFee.withdraw
),總是與交易貨幣相同。例如,ETH 轉帳用 ETH,USDT 轉帳用 USDT,等等。除非發生「費用代令」,否則通常為 0,請參閱下文。「費用代付」。Akashic 系統讓您用代幣而非原生幣來支付上述的原生費用,以簡化問題。如果這樣做,
feeIsDelegated
將會在回調中為 true。所有使用 SDK 完成的提款都應該是 「代付」 的,而從 AkashicLink 啟動的提款預設不會是 「代付」的。「代付」 費用所需的額外代幣金額在internalFee.withdraw
中。
利用這一點,我們可以計算使用者花費的總金額(假設上圖所示的回調資料在 txCallback
中):
// Token transaction (USDT)
if (txCallback.tokenSymbol) {
userTokenSpent = txCallback.amount + txCallback.internalFee.withdraw;
// If fee is not delegated, gas fees are paid in native coin
if (!feeIsDelegated) {
userNativeCoinSpent = txCallback.feesPaid;
}
} else {
// Coin transaction (ETH, TRX)
userNativeCoinSpent = txCallback.amount + txCallback.internalFee.withdraw
+ txCallback.feesPaid;
}
請注意,以上是偽碼。您可能需要額外注意處理潛在的未定義/空值(如 internalFee
),並根據您所選程式語言的一般慣例,安全正確地解析數字。
提款/提幣 (L2Transaction)
如果使用者要傳送資產給 Akashic 系統中的其他使用者,則會在 AkashicChain 中執行,這是我們的第 2 層區塊鏈,可降低第一層的礦工費和成本。
{
"initiatedAt": "2024-08-19T10:03:58.649Z",
"confirmedAt": "2024-08-19T10:03:58.649Z",
"fromAddress": "AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764", // Same as senderIdentity
"toAddress": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Same as receiverIdentity
"coinSymbol": "TRX-SHASTA",
"status": "Confirmed", // "Confirmed" or "Failed"
"layer": "L2Transaction", // Could be "L2Transaction" here
"amount": "10.000000",
"internalFee": {
"withdraw": "0.100000" // Akashic-fee, not present if Failed
},
"l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // AkashicChain txHash
"receiverInfo": {
"identity": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Akashic Address of receiver
},
"receiverIdentity": "AS18...", // DEPRECATED. Same as above. Please use receiverInfo.identity instead
"tokenSymbol": "USDT", // Only here if a token-transaction,
"identifier": "user123",
"senderInfo": {
"identity": "AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764", // Akashic Address of sender
},
"senderIdentity": "AS3c..." // DEPRECATED. Same as above. Please use senderInfo.identity instead
}
Last updated
Was this helpful?