From b9d9a69aae2fa5d22d62cc32cf2690eafd16888c Mon Sep 17 00:00:00 2001 From: Daniel Rudolph Date: Tue, 25 Mar 2025 06:57:23 +0100 Subject: [PATCH 1/2] fork --- Readme.md | 2 ++ composer.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index ce8bca8..d50c3df 100644 --- a/Readme.md +++ b/Readme.md @@ -1 +1,3 @@ +Fork off https://github.com/jaddek/fireblocks-sdk-php + Fireblocks api (11.2021) \ No newline at end of file diff --git a/composer.json b/composer.json index b287184..ef24fc2 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "jaddek/fireblocks-sdk-php", - "description": "Fireblocks http api client", + "name": "decrypted/fireblocks-sdk-php", + "description": "Fork - Fireblocks http api client - from jaddek", "keywords": [ "fireblocks", "sdk", From 7d2f5131d25d4894e2f26c2a95a5183d1c75dce9 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 25 Mar 2025 08:19:17 +0100 Subject: [PATCH 2/2] urlencode all url parameters --- src/Endpoint/ExchangeAccounts.php | 8 ++--- src/Endpoint/ExternalWallets.php | 18 +++++----- src/Endpoint/FiatAccounts.php | 6 ++-- src/Endpoint/InternalWallets.php | 18 +++++----- src/Endpoint/NetworkConnections.php | 2 +- src/Endpoint/SmartTransfers.php | 12 +++---- src/Endpoint/Transactions.php | 20 +++++------ src/Endpoint/Vault.php | 56 ++++++++++++++--------------- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/Endpoint/ExchangeAccounts.php b/src/Endpoint/ExchangeAccounts.php index fff3828..fa1d2f0 100644 --- a/src/Endpoint/ExchangeAccounts.php +++ b/src/Endpoint/ExchangeAccounts.php @@ -17,7 +17,7 @@ public function getAccounts(): ResponseInterface public function retrieveAccount(string $exchangeAccountId): ResponseInterface { $url = strtr('/v1/exchange_accounts/{exchangeAccountId}', [ - '{exchangeAccountId}' => $exchangeAccountId, + '{exchangeAccountId}' => urlencode($exchangeAccountId), ]); return $this->request('GET', $url); @@ -26,8 +26,8 @@ public function retrieveAccount(string $exchangeAccountId): ResponseInterface public function retrieveAsset(string $exchangeAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/exchange_accounts/{exchangeAccountId}/{assetId}', [ - '{exchangeAccountId}' => $exchangeAccountId, - '{assetId}' => $assetId, + '{exchangeAccountId}' => urlencode($exchangeAccountId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -36,7 +36,7 @@ public function retrieveAsset(string $exchangeAccountId, string $assetId): Respo public function exchangeInternalTransfer(string $exchangeAccountId, ExchangeInternalTransfer $transfer): ResponseInterface { $url = strtr('/v1/exchange_accounts/{exchangeAccountId}/internal_transfer', [ - '{exchangeAccountId}' => $exchangeAccountId, + '{exchangeAccountId}' => urlencode($exchangeAccountId), ]); return $this->request('POST', $url, [ diff --git a/src/Endpoint/ExternalWallets.php b/src/Endpoint/ExternalWallets.php index bc72679..c11daf6 100644 --- a/src/Endpoint/ExternalWallets.php +++ b/src/Endpoint/ExternalWallets.php @@ -25,7 +25,7 @@ public function createWallet(Wallet $wallet): ResponseInterface public function retrieveWallet(string $walletId): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('GET', $url); @@ -34,7 +34,7 @@ public function retrieveWallet(string $walletId): ResponseInterface public function deleteWallet(string $walletId): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('DELETE', $url); @@ -43,8 +43,8 @@ public function deleteWallet(string $walletId): ResponseInterface public function retrieveAsset(string $walletId, string $assetId): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -53,8 +53,8 @@ public function retrieveAsset(string $walletId, string $assetId): ResponseInterf public function addAsset(string $walletId, string $assetId, Asset $asset): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('POST', $url, [ @@ -65,8 +65,8 @@ public function addAsset(string $walletId, string $assetId, Asset $asset): Respo public function deleteAsset(string $walletId, string $assetId): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('DELETE', $url); @@ -75,7 +75,7 @@ public function deleteAsset(string $walletId, string $assetId): ResponseInterfac public function setAmlCustomerRefId(string $walletId, string $customerRefId): ResponseInterface { $url = strtr('/v1/external_wallets/{walletId}/set_customer_ref_id', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('POST', $url, [ diff --git a/src/Endpoint/FiatAccounts.php b/src/Endpoint/FiatAccounts.php index b048979..61ca84a 100644 --- a/src/Endpoint/FiatAccounts.php +++ b/src/Endpoint/FiatAccounts.php @@ -18,7 +18,7 @@ public function getAccounts(): ResponseInterface public function retrieveAccount(string $accountId): ResponseInterface { $url = strtr('/v1/fiat_accounts/{accountId}', [ - '{accountId}' => $accountId, + '{accountId}' => urlencode($accountId), ]); return $this->request('GET', $url); @@ -27,7 +27,7 @@ public function retrieveAccount(string $accountId): ResponseInterface public function redeemFundsToLinkedDDA(string $accountId, string $amount): ResponseInterface { $url = strtr('/v1/fiat_accounts/{accountId}/redeem_to_linked_dda', [ - '{accountId}' => $accountId, + '{accountId}' => urlencode($accountId), ]); return $this->request('POST', $url, [ @@ -38,7 +38,7 @@ public function redeemFundsToLinkedDDA(string $accountId, string $amount): Respo public function depositFundsFromLinkedDDA(string $accountId, string $amount): ResponseInterface { $url = strtr('/v1/fiat_accounts/{accountId}/deposit_from_linked_dda', [ - '{accountId}' => $accountId, + '{accountId}' => urlencode($accountId), ]); return $this->request('POST', $url, [ diff --git a/src/Endpoint/InternalWallets.php b/src/Endpoint/InternalWallets.php index 40096fa..f53238f 100644 --- a/src/Endpoint/InternalWallets.php +++ b/src/Endpoint/InternalWallets.php @@ -29,7 +29,7 @@ public function createWallet(Wallet $wallet): ResponseInterface public function retrieveWallet(string $walletId): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('GET', $url); @@ -38,7 +38,7 @@ public function retrieveWallet(string $walletId): ResponseInterface public function deleteWallet(string $walletId): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('DELETE', $url); @@ -47,8 +47,8 @@ public function deleteWallet(string $walletId): ResponseInterface public function retrieveAsset(string $walletId, string $assetId): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -57,8 +57,8 @@ public function retrieveAsset(string $walletId, string $assetId): ResponseInterf public function addAsset(string $walletId, string $assetId, Asset $asset): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('POST', $url, [ @@ -69,8 +69,8 @@ public function addAsset(string $walletId, string $assetId, Asset $asset): Respo public function deleteAsset(string $walletId, string $assetId): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}/{assetId}', [ - '{walletId}' => $walletId, - '{assetId}' => $assetId, + '{walletId}' => urlencode($walletId), + '{assetId}' => urlencode($assetId), ]); return $this->request('DELETE', $url); @@ -79,7 +79,7 @@ public function deleteAsset(string $walletId, string $assetId): ResponseInterfac public function setAmlCustomerRefId(string $walletId, string $customerRefId): ResponseInterface { $url = strtr('/v1/internal_wallets/{walletId}/set_customer_ref_id', [ - '{walletId}' => $walletId, + '{walletId}' => urlencode($walletId), ]); return $this->request('POST', $url, [ diff --git a/src/Endpoint/NetworkConnections.php b/src/Endpoint/NetworkConnections.php index f271852..4d5c3ae 100644 --- a/src/Endpoint/NetworkConnections.php +++ b/src/Endpoint/NetworkConnections.php @@ -18,7 +18,7 @@ public function getNetworkConnections(): ResponseInterface public function retrieveNetworkConnection(string $connectionId): ResponseInterface { $url = strtr('/v1/network_connections/{connectionId}', [ - '{connectionId}' => $connectionId, + '{connectionId}' => urlencode($connectionId), ]); return $this->request('GET', $url); diff --git a/src/Endpoint/SmartTransfers.php b/src/Endpoint/SmartTransfers.php index cf7aabf..f73ccb7 100644 --- a/src/Endpoint/SmartTransfers.php +++ b/src/Endpoint/SmartTransfers.php @@ -29,7 +29,7 @@ public function createTransferTicket(Ticket $ticket): ResponseInterface public function retrieveTransferTicket(string $ticketId): ResponseInterface { $url = strtr('/v1/transfer_tickets/{ticketId}', [ - '{ticketId}' => $ticketId + '{ticketId}' => urlencode($ticketId) ]); return $this->request('GET', $url); @@ -38,8 +38,8 @@ public function retrieveTransferTicket(string $ticketId): ResponseInterface public function retrieveTermOfTransactionTicket(string $ticketId, string $termId): ResponseInterface { $url = strtr('/v1/transfer_tickets/{ticketId}/{termId}', [ - '{ticketId}' => $ticketId, - '{termId}' => $termId, + '{ticketId}' => urlencode($ticketId), + '{termId}' => urlencode($termId), ]); return $this->request('GET', $url); @@ -48,7 +48,7 @@ public function retrieveTermOfTransactionTicket(string $ticketId, string $termId public function cancelTransferRequest(string $ticketId): ResponseInterface { $url = strtr('/v1/transfer_tickets/{ticketId}/cancel', [ - '{ticketId}' => $ticketId + '{ticketId}' => urlencode($ticketId) ]); return $this->request('POST', $url); @@ -57,8 +57,8 @@ public function cancelTransferRequest(string $ticketId): ResponseInterface public function makeTransferFromTransferTermContext(string $ticketId, string $termId, TransferPeerPath $path): ResponseInterface { $url = strtr('/v1/transfer_tickets/{ticketId}/{termId}/transfer', [ - '{ticketId}' => $ticketId, - '{termId}' => $termId, + '{ticketId}' => urlencode($ticketId), + '{termId}' => urlencode($termId), ]); return $this->request('POST', $url, [ diff --git a/src/Endpoint/Transactions.php b/src/Endpoint/Transactions.php index 7081589..0dc2276 100644 --- a/src/Endpoint/Transactions.php +++ b/src/Endpoint/Transactions.php @@ -35,7 +35,7 @@ public function createTransaction(CreateTransactionRequest $transaction): Respon public function retrieveTransaction(string $txId): ResponseInterface { $url = strtr('/v1/transactions/{txId}', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); return $this->request('GET', $url); @@ -44,7 +44,7 @@ public function retrieveTransaction(string $txId): ResponseInterface public function retrieveTransactionByExternalId(string $externalTxId): ResponseInterface { $url = strtr('/v1/transactions/external_tx_id/{externalTxId}', [ - 'externalTxId' => $externalTxId, + 'externalTxId' => urlencode($externalTxId), ]); return $this->request('GET', $url); @@ -53,7 +53,7 @@ public function retrieveTransactionByExternalId(string $externalTxId): ResponseI public function cancelTransaction(string $txId): ResponseInterface { $url = strtr('/v1/transactions/{txId}/cancel', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); return $this->request('POST', $url); @@ -62,7 +62,7 @@ public function cancelTransaction(string $txId): ResponseInterface public function dropTransaction(string $txId, ?string $feeLevel = null): ResponseInterface { $url = strtr('/v1/transactions/{txId}/drop', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); $options = []; @@ -79,7 +79,7 @@ public function dropTransaction(string $txId, ?string $feeLevel = null): Respons public function freezeTransaction(string $txId): ResponseInterface { $url = strtr('/v1/transactions/{txId}/freeze', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); return $this->request('POST', $url); @@ -88,7 +88,7 @@ public function freezeTransaction(string $txId): ResponseInterface public function unFreezeTransaction(string $txId): ResponseInterface { $url = strtr('/v1/transactions/{txId}/unfreeze', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); return $this->request('POST', $url); @@ -97,8 +97,8 @@ public function unFreezeTransaction(string $txId): ResponseInterface public function validateDestinationAddress(string $assetId, string $address): ResponseInterface { $url = strtr('/v1/transactions/validate_address/{assetId}/{address}', [ - '{assetId}' => $assetId, - '{address}' => $address + '{assetId}' => urlencode($assetId), + '{address}' => urlencode($address) ]); return $this->request('GET', $url); @@ -123,7 +123,7 @@ public function estimateTransactionFee(): ResponseInterface public function setConfirmationThresholdByTxId(string $txId): ResponseInterface { $url = strtr('/v1/transactions/{txId}/set_confirmation_threshold', [ - '{txId}' => $txId, + '{txId}' => urlencode($txId), ]); return $this->request('POST', $url); @@ -132,7 +132,7 @@ public function setConfirmationThresholdByTxId(string $txId): ResponseInterface public function setConfirmationThresholdByTxHash(string $txHash): ResponseInterface { $url = strtr('/v1/txHash/{txHash}/set_confirmation_threshold', [ - '{txHash}' => $txHash, + '{txHash}' => urlencode($txHash), ]); return $this->request('POST', $url); diff --git a/src/Endpoint/Vault.php b/src/Endpoint/Vault.php index dceeb8c..46a96a3 100644 --- a/src/Endpoint/Vault.php +++ b/src/Endpoint/Vault.php @@ -18,7 +18,7 @@ public function getAccounts(): ResponseInterface public function getAccount(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}', [ - '{vaultAccountId}' => $vaultAccountId + '{vaultAccountId}' => urlencode($vaultAccountId) ]); return $this->request('GET', $url); @@ -34,7 +34,7 @@ public function createNewAccount(): ResponseInterface public function renameAccount(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}', [ - '{vaultAccountId}' => $vaultAccountId + '{vaultAccountId}' => urlencode($vaultAccountId) ]); return $this->request('PUT', $url); @@ -43,8 +43,8 @@ public function renameAccount(string $vaultAccountId): ResponseInterface public function getBalanceOfAccountAsset(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId) ]); return $this->request('GET', $url); @@ -53,8 +53,8 @@ public function getBalanceOfAccountAsset(string $vaultAccountId, string $assetId public function createNewWallet(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId) ]); return $this->request('POST', $url); @@ -63,7 +63,7 @@ public function createNewWallet(string $vaultAccountId, string $assetId): Respon public function hideAccountInWebConsole(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/hide', [ - '{vaultAccountId}' => $vaultAccountId, + '{vaultAccountId}' => urlencode($vaultAccountId), ]); return $this->request('POST', $url); @@ -72,7 +72,7 @@ public function hideAccountInWebConsole(string $vaultAccountId): ResponseInterfa public function showAccountInWebConsole(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/unhide', [ - '{vaultAccountId}' => $vaultAccountId, + '{vaultAccountId}' => urlencode($vaultAccountId), ]); return $this->request('POST', $url); @@ -81,8 +81,8 @@ public function showAccountInWebConsole(string $vaultAccountId): ResponseInterfa public function getAccountAddresses(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/addresses', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -91,8 +91,8 @@ public function getAccountAddresses(string $vaultAccountId, string $assetId): Re public function createDepositAddress(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/addresses', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), ]); return $this->request('POST', $url); @@ -101,9 +101,9 @@ public function createDepositAddress(string $vaultAccountId, string $assetId): R public function renameAddress(string $vaultAccountId, string $assetId, string $addressId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, - '{addressId}' => $addressId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), + '{addressId}' => urlencode($addressId), ]); return $this->request('PUT', $url); @@ -112,8 +112,8 @@ public function renameAddress(string $vaultAccountId, string $assetId, string $a public function getMaximumSpendableAmount(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/max_spendable_amount', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -122,7 +122,7 @@ public function getMaximumSpendableAmount(string $vaultAccountId, string $assetI public function setAmlCustomerRefIDForAccount(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/set_customer_ref_id', [ - '{vaultAccountId}' => $vaultAccountId, + '{vaultAccountId}' => urlencode($vaultAccountId), ]); return $this->request('POST', $url); @@ -131,8 +131,8 @@ public function setAmlCustomerRefIDForAccount(string $vaultAccountId): ResponseI public function setAmlCustomerRefIDForAddress(string $vaultAccountId, string $addressId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}/set_customer_ref_id', [ - '{vaultAccountId}' => $vaultAccountId, - '{addressId}' => $addressId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{addressId}' => urlencode($addressId), ]); return $this->request('POST', $url); @@ -141,8 +141,8 @@ public function setAmlCustomerRefIDForAddress(string $vaultAccountId, string $ad public function getUnspentInputs(string $vaultAccountId, string $assetId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/unspent_inputs', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url); @@ -158,10 +158,10 @@ public function getPublicKeyByDerivationPath(): ResponseInterface public function getPublicKeyOfFireBlockAddress(string $vaultAccountId, string $assetId, string $change, string $addressIndex): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/{assetId}/{change}/{addressIndex}/public_key_info', [ - '{vaultAccountId}' => $vaultAccountId, - '{assetId}' => $assetId, - '{change}' => $change, - '{addressIndex}' => $addressIndex, + '{vaultAccountId}' => urlencode($vaultAccountId), + '{assetId}' => urlencode($assetId), + '{change}' => urlencode($change), + '{addressIndex}' => urlencode($addressIndex), ]); return $this->request('GET', $url); @@ -170,7 +170,7 @@ public function getPublicKeyOfFireBlockAddress(string $vaultAccountId, string $a public function setAutoFuelProperties(string $vaultAccountId): ResponseInterface { $url = strtr('/v1/vault/accounts/{vaultAccountId}/set_auto_fuel', [ - '{vaultAccountId}' => $vaultAccountId, + '{vaultAccountId}' => urlencode($vaultAccountId), ]); return $this->request('POST', $url); @@ -186,7 +186,7 @@ public function getVaultBalance(): ResponseInterface public function getAssetValueBalance(string $assetId): ResponseInterface { $url = strtr('/v1/vault/assets/{assetId}', [ - '{assetId}' => $assetId, + '{assetId}' => urlencode($assetId), ]); return $this->request('GET', $url);