Skip to content

Commit

Permalink
smoll fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny committed Oct 10, 2024
1 parent b86162e commit 9acc443
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
10 changes: 5 additions & 5 deletions docs/docs/03-sdk/04-methods-reference/bridge/bridgeAndCall.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 2

# `bridgeAndCall`

The `bridgeAndCall` method generates a solution for performing a single-hop cross-chain token transfer, followed by a contract call on the destination chain. The contract call can be either a native contract call or a token transfer with contract call. This method returns the necessary transaction details to execute both the token transfer and the contract interaction.
The `bridgeAndCall` method generates a solution for performing a single-hop cross-chain token transfer, followed by a contract call on the destination chain. The contract call can be either a native contract call or a token transfer with a contract call. This method returns the necessary transaction details to execute both the token transfer and the contract interaction.

## Usage

Expand All @@ -33,6 +33,7 @@ const settings = {
outputTokenAddress: '0xOutputTokenAddressHere', // Where tokens will be sent
approvalAddress: '0xApprovalAddressHere' // Contract that needs approval to transfer tokens
},
recipient: '0xRecipientAddress', // Optional recipient of leftover tokens
sourceChains: [84532] // Optional: List of source chains to be considered
};

Expand All @@ -55,8 +56,8 @@ const settings = {
contractAddress: '0xContractAddressHere',
callData: '0xSomeCallData', // Encoded contract interaction data
gasLimit: 21000, // Standard gas limit for simple ETH transfers
recipient: '0xRecipientAddressHere' // The recipient of the native token transfer
},
recipient: '0xRecipientAddressHere', // The recipient of the native token transfer
sourceChains: [84532] // Optional: List of source chains to be considered
};

Expand Down Expand Up @@ -108,18 +109,17 @@ sprinter.bridgeAndCall(settings, { baseUrl: 'https://custom.api.url' }).then(sol
- `contractAddress`: The contract address on the destination chain.
- `callData`: The data to interact with the contract, in hex format.
- `gasLimit`: The maximum amount of gas to use for the contract call.
- `recipient`: The recipient address for the native asset transfer.
- **Token Contract Call**:
- `contractAddress`: The contract address on the destination chain.
- `callData`: The data to interact with the contract, in hex format.
- `gasLimit`: The maximum amount of gas to use for the contract call.
- `outputTokenAddress?`: *(Optional)* The token address where tokens will be sent after the contract call.
- `approvalAddress?`: *(Optional)* The contract address that requires approval to transfer tokens (e.g., for `transferFrom`).
- `recipient?`: *(Optional)* The address of the recipient of any leftover tokens.
- `sourceChains?`: *(Optional)* An array of source chain IDs to be considered for the bridge. If omitted, Sprinter will use all available chains for the solution.

- `threshold?`: *(Optional)* The minimum amount of tokens required to trigger the bridging solution. If not met, the bridge solution will not proceed.
- `fetchOptions?`: *(Optional)* An object containing `baseUrl` to override the default API endpoint for this request.


import HowToCallData from "../_how-to-calldata.md"

<HowToCallData />
Expand Down
22 changes: 8 additions & 14 deletions docs/docs/03-sdk/04-methods-reference/bridge/bridge_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const settings = {
destinationChain: 11155111, // Sepolia testnet
token: 'USDC',
amount: 1000000, // In smallest denomination (e.g., 1 USDC = 1,000,000 in USDC with 6 decimals)
sourceChains: [84532] // Optional: List of source chains to be considered
};

sprinter.bridge(settings).then(solution => {
Expand All @@ -33,11 +32,13 @@ sprinter.bridge(settings).then(solution => {
## Parameters

- `settings`: *(Required)* An object containing the following fields:
- `account`: The user’s address.
- `destinationChain`: The ID of the destination chain.
- `token`: The symbol of the token to be transferred (e.g., `USDC`, `ETH`).
- `amount`: The amount of the token to be transferred in the smallest denomination (e.g., for USDC with 6 decimals, 1 USDC = 1,000,000).
- `sourceChains?`: *(Optional)* An array of source chain IDs to be considered for the bridge. If omitted, Sprinter will use all available chains for the solution. To limit the solution to a specific chain, provide an array containing only that chain's ID.
- `account`: The user’s address.
- `destinationChain`: The ID of the destination chain.
- `token`: The symbol of the token to be transferred (e.g., `USDC`, `ETH`).
- `amount`: The amount of the token to be transferred in the smallest denomination (e.g., for USDC with 6 decimals, 1 USDC = 1,000,000).
- `recipient?`: *(Optional)* The address of the recipient of any leftover tokens.
- `sourceChains?`: *(Optional)* An array of source chain IDs to be considered for the bridge. If omitted, Sprinter will use all available chains for the solution. To limit the solution to a specific chain, provide an array containing only that chain's ID.
- `threshold?`: *(Optional)* The minimum amount of tokens required to trigger the bridging solution. If not met, the bridge solution will not proceed.

- `fetchOptions?`: *(Optional)* An object containing `baseUrl` to override the default API endpoint for this request.

Expand All @@ -51,16 +52,14 @@ const settings = {
destinationChain: 11155111, // Sepolia testnet
token: 'USDC',
amount: 1000000,
sourceChains: [84532] // Limit to BaseSepolia as the source chain
sourceChains: [84532], // Limit to BaseSepolia as the source chain
};

sprinter.bridge(settings).then(solution => {
console.log(solution);
});
```

In this example, the bridge solution will only consider `BaseSepolia` as the source chain for the transfer, rather than all available chains.

### Example: Using `fetchOptions`

```typescript
Expand Down Expand Up @@ -146,8 +145,3 @@ import GasWarning from "../_gas-warning.md"
]
}
]
```

---

For more details on other methods, check out the [Methods Reference](./methods-reference.md).

0 comments on commit 9acc443

Please sign in to comment.