UNPKG

@robertprp/intents-sdk

Version:

Shogun Network Intent-based cross-chain swaps SDK

59 lines 2.22 kB
import { PERMIT2_ADDRESS } from '../../constants.js'; const TOKEN_PERMISSIONS_TYPE = [ { name: 'token', type: 'address' }, { name: 'amount', type: 'uint256' }, ]; const TRANSFER_DATA_TYPE = [ { name: 'token', type: 'address' }, { name: 'receiver', type: 'address' }, { name: 'amount', type: 'uint256' }, ]; // Cross-chain order types export const CROSS_CHAIN_PERMIT2_TYPES = { TokenPermissions: TOKEN_PERMISSIONS_TYPE, OrderInfo: [ { name: 'user', type: 'address' }, { name: 'tokenIn', type: 'address' }, { name: 'srcChainId', type: 'uint32' }, { name: 'deadline', type: 'uint32' }, { name: 'amountIn', type: 'uint128' }, { name: 'minStablecoinsAmount', type: 'uint128' }, { name: 'executionDetailsHash', type: 'bytes32' }, { name: 'nonce', type: 'uint256' }, ], PermitWitnessTransferFrom: [ { name: 'permitted', type: 'TokenPermissions' }, { name: 'spender', type: 'address' }, { name: 'nonce', type: 'uint256' }, { name: 'deadline', type: 'uint256' }, { name: 'witness', type: 'OrderInfo' }, ], }; // Single-chain limit order types export const SINGLE_CHAIN_LIMIT_PERMIT2_TYPES = { TokenPermissions: TOKEN_PERMISSIONS_TYPE, TransferData: TRANSFER_DATA_TYPE, SingleChainLimitOrder: [ { name: 'user', type: 'address' }, { name: 'tokenIn', type: 'address' }, { name: 'amountIn', type: 'uint256' }, { name: 'requestedOutput', type: 'TransferData' }, { name: 'extraTransfers', type: 'TransferData[]' }, { name: 'encodedExternalCallData', type: 'bytes' }, { name: 'deadline', type: 'uint32' }, { name: 'nonce', type: 'uint256' }, ], PermitWitnessTransferFrom: [ { name: 'permitted', type: 'TokenPermissions' }, { name: 'spender', type: 'address' }, { name: 'nonce', type: 'uint256' }, { name: 'deadline', type: 'uint256' }, { name: 'witness', type: 'SingleChainLimitOrder' }, ], }; export const PERMIT2_DOMAIN = (chainId) => ({ name: 'Permit2', chainId, verifyingContract: PERMIT2_ADDRESS[chainId], }); //# sourceMappingURL=permit2.js.map