Skip to content

Commit

Permalink
Updates api-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
yagopv committed Feb 14, 2025
1 parent c64d5e4 commit fac62a2
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 41 deletions.
22 changes: 20 additions & 2 deletions pages/reference-sdk-api-kit/decodeddata.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ Decodes the specified Safe transaction data.

## Returns

`Promise<any>`
`Promise<DataDecoded>`

The transaction data decoded.

```typescript
type DataDecoded = {
readonly method: string
readonly parameters: DecodedParameters[]
}
```
## Parameters
### `data`
Expand All @@ -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...'
)
```
25 changes: 24 additions & 1 deletion pages/reference-sdk-api-kit/getincomingtransactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
</Tabs.Tab>
<Tabs.Tab>
Expand Down Expand Up @@ -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.
27 changes: 24 additions & 3 deletions pages/reference-sdk-api-kit/getmoduletransactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
</Tabs.Tab>
<Tabs.Tab>
Expand Down Expand Up @@ -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.
43 changes: 39 additions & 4 deletions pages/reference-sdk-api-kit/getmultisigtransactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
</Tabs.Tab>
<Tabs.Tab>
Expand Down Expand Up @@ -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.
14 changes: 7 additions & 7 deletions pages/reference-sdk-api-kit/getpendingsafeoperations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetSafeOperationListProps, 'executed'> = {
safeAddress: '0x...',
const safeAddress = '0x...'
const options: Omit<GetSafeOperationListProps, 'executed'> = {
ordering: 'created', // Optional
limit: '10', // Optional
offset: '50' // Optional
}

const safeOperationsResponse = await apiKit.getPendingSafeOperations(config)
const safeOperationsResponse = await apiKit.getPendingSafeOperations(safeAddress, options)
```
</Tabs.Tab>
<Tabs.Tab>
Expand All @@ -45,7 +45,7 @@ The paginated list of Safe operations.

## Parameters

### `config.safeAddress`
### `safeAddress`

- **Type:** `string`

Expand All @@ -57,7 +57,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations({
})
```

### `config.ordering` (Optional)
### `options.ordering` (Optional)

- **Type:** `string`
- **Default:** `-user_operation__nonce`
Expand All @@ -75,7 +75,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations(
)
```

### `config.limit` (Optional)
### `options.limit` (Optional)

- **Type:** `number`

Expand All @@ -90,7 +90,7 @@ const safeOperationsResponse = await apiKit.getPendingSafeOperations(
)
```

### `config.offset` (Optional)
### `options.offset` (Optional)

- **Type:** `number`

Expand Down
49 changes: 34 additions & 15 deletions pages/reference-sdk-api-kit/getpendingtransactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
</Tabs.Tab>
<Tabs.Tab>
Expand Down Expand Up @@ -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.
18 changes: 9 additions & 9 deletions pages/reference-sdk-api-kit/getsafeoperationsbyaddress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ 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
limit: '10', // Optional
offset: '50' // Optional
}

const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(config)
const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(safeAddress, options)
```
</Tabs.Tab>
<Tabs.Tab>
Expand All @@ -47,7 +47,7 @@ The paginated list of Safe operations.

## Parameters

### `config.safeAddress`
### `safeAddress`

- **Type:** `string`

Expand All @@ -59,7 +59,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress({
})
```

### `config.executed` (Optional)
### `options.executed` (Optional)

- **Type:** `boolean`

Expand All @@ -78,7 +78,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(
)
```

### `config.hasConfirmations` (Optional)
### `options.hasConfirmations` (Optional)

- **Type:** `string`

Expand All @@ -97,7 +97,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(
)
```

### `config.ordering` (Optional)
### `options.ordering` (Optional)

- **Type:** `string`
- **Default:** `-user_operation__nonce`
Expand All @@ -115,7 +115,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(
)
```

### `config.limit` (Optional)
### `options.limit` (Optional)

- **Type:** `number`

Expand All @@ -130,7 +130,7 @@ const safeOperationsResponse = await apiKit.getSafeOperationsByAddress(
)
```

### `config.offset` (Optional)
### `options.offset` (Optional)

- **Type:** `number`

Expand Down
Loading

0 comments on commit fac62a2

Please sign in to comment.