earn.depositShares
Deposits venue shares into a vault and mints vault shares to a recipient.
Usage
import { client } from './viem.config'
const result = await client.earn.depositSharesSync({
earnShareAmount: 499_000_000n,
slippageBps: 30,
vault: '0x0000000000000000000000000000000000000002',
venueShareAmount: 500_000_000n,
venueShareToken: '0x20c0000000000000000000000000000000000001',
})
{
// caller: '0x...',
// earnShareAmount: 498_750_000n,
// receipt: { ... },
// receivedVenueShareAmount: 500_000_000n,
// recipient: '0x...',
// venueShareAmount: 500_000_000n,
// }import { Account, createClient } from 'viem/tempo'
export const client = createClient({
account: Account.fromSecp256k1('0x...'),
})The action reads the current venue integration, approves it to pull venueShareToken, and deposits
the venue shares in one transaction.
Asynchronous Usage
earn.depositSharesSync waits for inclusion and returns the decoded deposit event. Use
earn.depositShares to return the transaction hash immediately.
import { client } from './viem.config'
const hash = await client.earn.depositShares({
earnShareAmountMin: 497_000_000n,
vault: '0x0000000000000000000000000000000000000002',
venueShareAmount: 500_000_000n,
venueShareToken: '0x20c0000000000000000000000000000000000001',
})
0x1234...abcdReturn Value
type ReturnValue = {
/** Depositing caller. */
caller: Address
/** Vault shares minted. */
earnShareAmount: bigint
/** Transaction receipt. */
receipt: TransactionReceipt
/** Venue shares measured as received by the integration. */
receivedVenueShareAmount: bigint
/** Vault share recipient. */
recipient: Address
/** Venue shares requested for transfer. */
venueShareAmount: bigint
}The asynchronous action returns the transaction hash instead.
Parameters
earnShareAmount (optional)
- Type:
bigint
Quoted vault share output. Provide it with slippageBps, or provide earnShareAmountMin instead.
earnShareAmountMin (optional)
- Type:
bigint
Minimum vault shares to accept. It must be greater than zero and cannot be combined with
earnShareAmount or slippageBps.
recipient (optional)
- Type:
Address - Default:
account.address
Vault share recipient.
slippageBps (optional)
- Type:
number
Slippage tolerance below earnShareAmount, in basis points. For example, 30 means 0.3%.
vault
- Type:
Address
Vault address.
venueShareAmount
- Type:
bigint
Venue shares to deposit, in base units.
venueShareToken
- Type:
Address
Venue share token to deposit.
account (optional)
- Type:
Account | Address
Account that will be used to send the transaction.
feeToken (optional)
- Type:
Address | bigint
Fee token for the transaction.
Can be an unpaused USD-denominated TIP-20 token address or ID. Use client.fee.validateToken({ token }) to validate a token before submitting a transaction or setting it as a fee preference.
feePayer (optional)
- Type:
Account | true
Fee payer for the transaction.
Can be a Viem Account, or true if a Fee Payer Service will be used.
gas (optional)
- Type:
bigint
Gas limit for the transaction.
maxFeePerGas (optional)
- Type:
bigint
Max fee per gas for the transaction.
maxPriorityFeePerGas (optional)
- Type:
bigint
Max priority fee per gas for the transaction.
nonce (optional)
- Type:
number
Nonce for the transaction.
nonceKey (optional)
- Type:
'expiring' | bigint
Nonce key for the transaction. Use 'expiring' to use expiring nonces (TIP-1009), which enables concurrent transaction submission without nonce ordering.
validBefore (optional)
- Type:
number
Unix timestamp before which the transaction must be included.
validAfter (optional)
- Type:
number
Unix timestamp after which the transaction can be included.
throwOnReceiptRevert (optional)
- Type:
boolean - Default:
true
Whether to throw an error if the transaction receipt indicates a revert. Only applicable to *Sync actions.