mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 19:35:11 +03:00
32 lines
895 B
TypeScript
32 lines
895 B
TypeScript
import { SwapExecutor__factory } from "@orionprotocol/contracts/lib/ethers-v6/index.js"
|
|
import type { BigNumberish } from "ethers"
|
|
import { type CallParams, addCallParams } from "./utils.js"
|
|
import type { AddressLike } from "ethers"
|
|
|
|
export function generateWrapAndTransferCall(
|
|
target: AddressLike,
|
|
callParams?: CallParams
|
|
) {
|
|
|
|
const executorInterface = SwapExecutor__factory.createInterface()
|
|
const calldata = executorInterface.encodeFunctionData('wrapAndTransfer', [
|
|
target,
|
|
])
|
|
|
|
return addCallParams(calldata, callParams)
|
|
}
|
|
|
|
export function generateUnwrapAndTransferCall(
|
|
target: AddressLike,
|
|
amount: BigNumberish,
|
|
callParams?: CallParams
|
|
) {
|
|
|
|
const executorInterface = SwapExecutor__factory.createInterface()
|
|
const calldata = executorInterface.encodeFunctionData('unwrapAndTransfer', [
|
|
target,
|
|
amount
|
|
])
|
|
|
|
return addCallParams(calldata, callParams)
|
|
} |