Skip to content

Commit

Permalink
add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
milonite committed Mar 11, 2024
1 parent d4ad3f9 commit 0748d88
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pages/bundler-api/actions/_meta.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"route": "Route",
"deposit": "Deposit",
"approve": "Approve",
"transfer": "Transfer",
"transferFrom": "TransferFrom",
"permitTransferFrom": "Permit TransferFrom",
"harvest": "Harvest",
"borrow": "Borrow",
"repay": "Repay",
"redeem": "Redeem",
"swap": "Swap",
"transfer": "Transfer",
"withdraw": "Withdraw",
"approve": "Approve",
"permitTransferFrom": "Permit TransferFrom"
"withdraw": "Withdraw"
}
47 changes: 46 additions & 1 deletion pages/bundler-api/actions/approve.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# Approve

Available in endpoint. Docs coming soon...
Approve an address to spend tokens

Arguments:
| name | Description | Example |
| ------- | --------------- | -------------------------- |
| `token` | Address of the token to approve | token=0x6b175474e8909... |
| `spender` | Address of the spender | spender=0x6b175474e8909... |
| `amount` | Raw amount to approve | amount=100000000000 |

## Example

Body:

```json
[
{
"action": "approve",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"spender": "0x80eba3855878739f4710233a8a19d89bdd2ffb8e",
"amount": "1000000000000000000000000"
}
}
]
```

Curl:

```bash copy
curl -X 'POST' \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '[
{
"protocol": "enso",
"action": "approve",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"spender": "0x80eba3855878739f4710233a8a19d89bdd2ffb8e",
"amount": "1000000000000000000000000"
}
}
]'
```

32 changes: 31 additions & 1 deletion pages/bundler-api/actions/permitTransferFrom.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# Permit TransferFrom

Available in endpoint. Docs coming soon...
Approve and transfer a token that supports permit to a specific address.
A permit signature needs to be generated offchain and passed to the API.

Arguments:
| name | Description | Example |
| ------- | --------------- | -------------------------- |
| `token` | Address of the token to approve | token=0x6b175474e8909... |
| `nonce` | The nonce to prevent signature replays | nonce=1 |
| `deadline` | The deadline on the permit signature | deadline=1710150268|
| `signature` | The permit signature| |
| `amount` | Raw amount to transfer | amount=100000000000 |

## Example

Body:

```json
[
{
"action": "transfer",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"nonce": "1",
"deadline": "1710150268",
"signature": "0x..",
"amount": "1000000000000000000000000"
}
}
]
```

48 changes: 47 additions & 1 deletion pages/bundler-api/actions/transfer.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# Transfer

Available in endpoint. Docs coming soon...
Transfer one or more tokens to a specific address.

Arguments:
| name | Description | Example |
| ------- | --------------- | -------------------------- |
| `token` | Address of the token | token=0x6b175474e8909... |
| `recipient` | Address of the recipient | spender=0x6b175474e8909... |
| `amount` | Raw amount to transfer | amount=100000000000 |


## Example

Body:

```json
[
{
"action": "transfer",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"recipient": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"amount": "1000000000000000000000000"
}
}
]
```

Curl:

```bash copy
curl -X 'POST' \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '[
{
"protocol": "enso",
"action": "transfer",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"recipient": "0x80eba3855878739f4710233a8a19d89bdd2ffb8e",
"amount": "1000000000000000000000000"
}
}
]'
```

52 changes: 52 additions & 0 deletions pages/bundler-api/actions/transferFrom.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Transfer From

TransferFrom one or more tokens to a specific address.

Arguments:
| name | Description | Example |
| ------- | --------------- | -------------------------- |
| `token` | Address of the token | token=0x6b175474e8909... |
| `spender` | Address of the spender | token=0x6b175474e8909... |
| `recipient` | Address of the recipient | spender=0x6b175474e8909... |
| `amount` | Raw amount to transfer | amount=100000000000 |

Note: Spender must have approved the amount to be transferred.
## Example

Body:

```json
[
{
"action": "transfer",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"recipient": "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"amount": "1000000000000000000000000"
}
}
]
```

Curl:

```bash copy
curl -X 'POST' \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '[
{
"protocol": "enso",
"action": "transfer",
"args": {
"token": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
"recipient": "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"amount": "1000000000000000000000000"
}
}
]'
```

0 comments on commit 0748d88

Please sign in to comment.