From 954cd7661775100b73981ce3fd7ee4472adfc283 Mon Sep 17 00:00:00 2001 From: Ian Shim <100327837+ian-shim@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:29:52 -0700 Subject: [PATCH] leave fireblocks external tx id empty (#217) --- chainio/clients/fireblocks/contract_call.go | 15 ++++++++------- chainio/clients/wallet/fireblocks_wallet.go | 2 +- chainio/clients/wallet/fireblocks_wallet_test.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/chainio/clients/fireblocks/contract_call.go b/chainio/clients/fireblocks/contract_call.go index dfc5a0e5..8d958013 100644 --- a/chainio/clients/fireblocks/contract_call.go +++ b/chainio/clients/fireblocks/contract_call.go @@ -33,13 +33,14 @@ type extraParams struct { } type ContractCallRequest struct { - Operation TransactionOperation `json:"operation"` - ExternalTxID string `json:"externalTxId"` - AssetID AssetID `json:"assetId"` - Source account `json:"source"` - Destination account `json:"destination"` - Amount string `json:"amount,omitempty"` - ExtraParameters extraParams `json:"extraParameters"` + Operation TransactionOperation `json:"operation"` + // ExternalTxID is an optional field that can be used as an idempotency key. + ExternalTxID string `json:"externalTxId,omitempty"` + AssetID AssetID `json:"assetId"` + Source account `json:"source"` + Destination account `json:"destination"` + Amount string `json:"amount,omitempty"` + ExtraParameters extraParams `json:"extraParameters"` // In case a transaction is stuck, specify the hash of the stuck transaction to replace it // by this transaction with a higher fee, or to replace it with this transaction with a zero fee and drop it from the blockchain. ReplaceTxByHash string `json:"replaceTxByHash,omitempty"` diff --git a/chainio/clients/wallet/fireblocks_wallet.go b/chainio/clients/wallet/fireblocks_wallet.go index 4fbee2d3..d37606b0 100644 --- a/chainio/clients/wallet/fireblocks_wallet.go +++ b/chainio/clients/wallet/fireblocks_wallet.go @@ -182,7 +182,7 @@ func (t *fireblocksWallet) SendTransaction(ctx context.Context, tx *types.Transa } req := fireblocks.NewContractCallRequest( - tx.Hash().Hex(), + "", // externalTxID assetID, account.ID, // source account ID contract.ID, // destination account ID diff --git a/chainio/clients/wallet/fireblocks_wallet_test.go b/chainio/clients/wallet/fireblocks_wallet_test.go index 16782a90..a13c59ae 100644 --- a/chainio/clients/wallet/fireblocks_wallet_test.go +++ b/chainio/clients/wallet/fireblocks_wallet_test.go @@ -254,7 +254,7 @@ func TestSendTransactionReplaceTx(t *testing.T) { TxHash: expectedTxHash, }, nil) fireblocksClient.EXPECT().ContractCall(gomock.Any(), fireblocks.NewContractCallRequest( - replacementTx.Hash().Hex(), + "", "ETH_TEST3", "vaultAccountID", "contractID",