From fac62a2f495350517e62db6809180edcdf7fba05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 14 Feb 2025 16:39:21 +0100 Subject: [PATCH] Updates api-kit --- pages/reference-sdk-api-kit/decodeddata.mdx | 22 ++++++++- .../getincomingtransactions.mdx | 25 +++++++++- .../getmoduletransactions.mdx | 27 ++++++++-- .../getmultisigtransactions.mdx | 43 ++++++++++++++-- .../getpendingsafeoperations.mdx | 14 +++--- .../getpendingtransactions.mdx | 49 +++++++++++++------ .../getsafeoperationsbyaddress.mdx | 18 +++---- pages/reference-sdk-api-kit/gettokenlist.mdx | 32 ++++++++++++ 8 files changed, 189 insertions(+), 41 deletions(-) diff --git a/pages/reference-sdk-api-kit/decodeddata.mdx b/pages/reference-sdk-api-kit/decodeddata.mdx index c365b7f28..926d33040 100644 --- a/pages/reference-sdk-api-kit/decodeddata.mdx +++ b/pages/reference-sdk-api-kit/decodeddata.mdx @@ -33,10 +33,17 @@ Decodes the specified Safe transaction data. ## Returns -`Promise` +`Promise` The transaction data decoded. +```typescript +type DataDecoded = { + readonly method: string + readonly parameters: DecodedParameters[] +} +``` + ## Parameters ### `data` @@ -45,8 +52,19 @@ The transaction data decoded. The Safe transaction data to decode. -```typescript focus=2 +```typescript +const decodedData = await apiKit.decodeData('0x...') +``` + +### `to` (Optional) + +- **Type:** `string` + +The address of the receiving contract. If provided, the decoded data will be more accurate, as in case of an ABI collision the Safe Transaction Service would know which ABI to use + +```typescript const decodedData = await apiKit.decodeData( + '0x...', '0x...' ) ``` diff --git a/pages/reference-sdk-api-kit/getincomingtransactions.mdx b/pages/reference-sdk-api-kit/getincomingtransactions.mdx index ede33277f..fd2ae474b 100644 --- a/pages/reference-sdk-api-kit/getincomingtransactions.mdx +++ b/pages/reference-sdk-api-kit/getincomingtransactions.mdx @@ -14,8 +14,13 @@ Returns the history of incoming transactions of a Safe account. import { apiKit } from './setup.ts' const safeAddress = '0x...' + const options = { + _from: '0x...', + limit: 10, + offset: 10 + } - const incomingTxs = await apiKit.getIncomingTransactions(safeAddress) + const incomingTxs = await apiKit.getIncomingTransactions(safeAddress, options) ``` @@ -50,3 +55,21 @@ const incomingTxs = await apiKit.getIncomingTransactions( '0x...' ) ``` + +### `options._from` (Optional) + +- **Type:** `string` + +The transaction sender address. + +### `options.limit` (Optional) + +- **Type:** `number` + +The number of results to return per page. + +### `options.offset` (Optional) + +- **Type:** `number` + +The initial index from which to return the results. \ No newline at end of file diff --git a/pages/reference-sdk-api-kit/getmoduletransactions.mdx b/pages/reference-sdk-api-kit/getmoduletransactions.mdx index e0f4c7458..acca7d3bb 100644 --- a/pages/reference-sdk-api-kit/getmoduletransactions.mdx +++ b/pages/reference-sdk-api-kit/getmoduletransactions.mdx @@ -14,10 +14,13 @@ Returns the history of module transactions of a Safe account. import { apiKit } from './setup.ts' const safeAddress = '0x...' + const options = { + module: '0x...', + limit: 10, + offset: 10 + } - const moduleTxs = await apiKit.getModuleTransactions( - safeAddress - ) + const moduleTxs = await apiKit.getModuleTransactions(safeAddress, options) ``` @@ -52,3 +55,21 @@ const moduleTxs = await apiKit.getModuleTransactions( '0x...' ) ``` + +### `options.module` (Optional) + +- **Type:** `string` + +The module to get the transactions from. + +### `options.limit` (Optional) + +- **Type:** `number` + +The number of results to return per page. + +### `options.offset` (Optional) + +- **Type:** `number` + +The initial index from which to return the results. diff --git a/pages/reference-sdk-api-kit/getmultisigtransactions.mdx b/pages/reference-sdk-api-kit/getmultisigtransactions.mdx index 07782ffdb..b2918f619 100644 --- a/pages/reference-sdk-api-kit/getmultisigtransactions.mdx +++ b/pages/reference-sdk-api-kit/getmultisigtransactions.mdx @@ -14,10 +14,15 @@ Returns the history of multi-signature transactions of a Safe account. import { apiKit } from './setup.ts' const safeAddress = '0x...' - - const multisigTxs = await apiKit.getMultisigTransactions( - safeAddress - ) + const options = { + executed: true, + nonce: '0x...', + ordering: 'created', + limit: 10, + offset: 10 + } + + const multisigTxs = await apiKit.getMultisigTransactions(safeAddress, options) ``` @@ -52,3 +57,33 @@ const multisigTxs = await apiKit.getMultisigTransactions( '0x...' ) ``` + +### `options.executed` (Optional) + +- **Type:** `boolean` + +Filter the executed transactions if `true`. + +### `options.nonce` (Optional) + +- **Type:** `string` + +The nonce used to return the results. + +### `options.ordering` (Optional) + +- **Type:** `string` + +The field used to sort the results. + +### `options.limit` (Optional) + +- **Type:** `number` + +The number of results to return per page. + +### `options.offset` (Optional) + +- **Type:** `number` + +The initial index from which to return the results. diff --git a/pages/reference-sdk-api-kit/getpendingsafeoperations.mdx b/pages/reference-sdk-api-kit/getpendingsafeoperations.mdx index a1cc9c96f..801b8c0c8 100644 --- a/pages/reference-sdk-api-kit/getpendingsafeoperations.mdx +++ b/pages/reference-sdk-api-kit/getpendingsafeoperations.mdx @@ -14,14 +14,14 @@ Returns the list of Safe operations which are pending to be executed through a b import { GetSafeOperationListProps } from '@safe-global/api-kit' import { apiKit } from './setup.ts' - const config: Omit = { - safeAddress: '0x...', + const safeAddress = '0x...' + const options: Omit = { ordering: 'created', // Optional limit: '10', // Optional offset: '50' // Optional } - const safeOperationsResponse = await apiKit.getPendingSafeOperations(config) + const safeOperationsResponse = await apiKit.getPendingSafeOperations(safeAddress, options) ``` @@ -45,7 +45,7 @@ The paginated list of Safe operations. ## Parameters -### `config.safeAddress` +### `safeAddress` - **Type:** `string` @@ -57,7 +57,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations({ }) ``` -### `config.ordering` (Optional) +### `options.ordering` (Optional) - **Type:** `string` - **Default:** `-user_operation__nonce` @@ -75,7 +75,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations( ) ``` -### `config.limit` (Optional) +### `options.limit` (Optional) - **Type:** `number` @@ -90,7 +90,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations( ) ``` -### `config.offset` (Optional) +### `options.offset` (Optional) - **Type:** `number` diff --git a/pages/reference-sdk-api-kit/getpendingtransactions.mdx b/pages/reference-sdk-api-kit/getpendingtransactions.mdx index 9c547d5f1..c9f7f2f55 100644 --- a/pages/reference-sdk-api-kit/getpendingtransactions.mdx +++ b/pages/reference-sdk-api-kit/getpendingtransactions.mdx @@ -13,14 +13,16 @@ Returns the list of multi-signature transactions that are waiting for the confir ```typescript import { apiKit } from './setup.ts' - const safeAddress = '0x...' - - const currentNonce = 10 - - const pendingTxs = await apiKit.getPendingTransactions( - safeAddress, - currentNonce // Optional - ) + const safeAddress = '0x...' + const options = { + currentNonce: 0, + hasConfirmations: true, + ordering: 'created', + limit: 10, + offset: 10 + } + + const pendingTxs = await apiKit.getPendingTransactions(safeAddress, options) ``` @@ -56,15 +58,32 @@ const pendingTxs = await apiKit.getPendingTransactions( ) ``` -### `currentNonce` (Optional) +### `options.currentNonce` (Optional) - **Type:** `number` The current nonce of the Safe. -```typescript focus=3 -const pendingTxs = await apiKit.getPendingTransactions( - '0x...', - 10 -) -``` +### `options.hasConfirmations` (Optional) + +- **Type:** `boolean` + +Filter transactions with al least one confirmation. + +### `options.ordering` (Optional) + +- **Type:** `string` + +The field used to sort the results. + +### `options.limit` (Optional) + +- **Type:** `number` + +The number of results to return per page. + +### `options.offset` (Optional) + +- **Type:** `number` + +The initial index from which to return the results. diff --git a/pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx b/pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx index 521404ffd..1853591b6 100644 --- a/pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx +++ b/pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx @@ -14,8 +14,8 @@ Returns the list of Safe operations associated to a Safe account. import { GetSafeOperationListProps } from '@safe-global/api-kit' import { apiKit } from './setup.ts' - const config: GetSafeOperationListProps = { - safeAddress: '0x...', + const safeAddress = '0x...' + const options: GetSafeOperationListProps = { executed: false, // Optional, hasConfirmations: true, // Optional, ordering: 'created', // Optional @@ -23,7 +23,7 @@ Returns the list of Safe operations associated to a Safe account. offset: '50' // Optional } - const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(config) + const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(safeAddress, options) ``` @@ -47,7 +47,7 @@ The paginated list of Safe operations. ## Parameters -### `config.safeAddress` +### `safeAddress` - **Type:** `string` @@ -59,7 +59,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress({ }) ``` -### `config.executed` (Optional) +### `options.executed` (Optional) - **Type:** `boolean` @@ -78,7 +78,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress( ) ``` -### `config.hasConfirmations` (Optional) +### `options.hasConfirmations` (Optional) - **Type:** `string` @@ -97,7 +97,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress( ) ``` -### `config.ordering` (Optional) +### `options.ordering` (Optional) - **Type:** `string` - **Default:** `-user_operation__nonce` @@ -115,7 +115,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress( ) ``` -### `config.limit` (Optional) +### `options.limit` (Optional) - **Type:** `number` @@ -130,7 +130,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress( ) ``` -### `config.offset` (Optional) +### `options.offset` (Optional) - **Type:** `number` diff --git a/pages/reference-sdk-api-kit/gettokenlist.mdx b/pages/reference-sdk-api-kit/gettokenlist.mdx index 5ecedb5f7..9e3c9664d 100644 --- a/pages/reference-sdk-api-kit/gettokenlist.mdx +++ b/pages/reference-sdk-api-kit/gettokenlist.mdx @@ -34,3 +34,35 @@ Returns the list of all the ERC-20 tokens handled by the Safe. `Promise` The list of ERC-20 tokens. + +## Parameters + +### `options.search` (Optional) + +- **Type:** `string` + +Filters the results by the token name or symbol. + +### `options.address` (Optional) + +- **Type:** `string` + +Filters the results by the token address. + +### `options.ordering` (Optional) + +- **Type:** `string` + +The field used to sort the results. + +### `options.limit` (Optional) + +- **Type:** `number` + +The number of results to return per page. + +### `options.offset` (Optional) + +- **Type:** `number` + +The initial index from which to return the results. \ No newline at end of file