@f5i23q999d/cow-sdk
Version:
<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>
70 lines (69 loc) • 2.45 kB
TypeScript
import { EvmCall, SignerLike } from '../common/index.js';
import { SupportedChainId } from '../chains/index.js';
import { CowShedHooks } from './contracts/CoWShedHooks.js';
import { EcdsaSigningScheme } from '@cowprotocol/contracts';
import { ICoWShedCall, ICoWShedOptions } from './types.js';
export interface SignAndEncodeTxArgs {
/**
* Calls to pre-authorize on the cow-shed account
*/
calls: ICoWShedCall[];
/**
* Signer for the cow-shed's owner account.
*
* The signer will be used to pre-authorise the calls.
* The cow-shed account will be derived from this signer.
*/
signer?: SignerLike;
/**
* Chain ID to use for the transaction.
*/
chainId: SupportedChainId;
/**
* Nonce to use for the transaction. If not provided, the current timestamp will be used.
*/
nonce?: string;
/**
* Deadline to use for the transaction. If not provided, the maximum uint256 will be used.
*/
deadline?: bigint;
/**
* Default gas limit to use for the transaction. If not provided, it will throw an error if the gas limit cannot be estimated.
*/
defaultGasLimit?: bigint;
/**
* Signing scheme to use for the transaction.
*/
signingScheme?: EcdsaSigningScheme;
}
export interface CowShedCall {
cowShedAccount: string;
signedMulticall: EvmCall;
gasLimit: bigint;
}
export interface CowShedSdkOptions {
/**
* Signer for the cow-shed's owner account.
*/
signer?: SignerLike;
/**
* Custom options for the cow-shed hooks.
*/
factoryOptions?: ICoWShedOptions;
}
export declare class CowShedSdk {
private options;
protected hooksCache: Map<SupportedChainId, CowShedHooks>;
constructor(options?: CowShedSdkOptions);
getCowShedAccount(chainId: SupportedChainId, ownerAddress: string): string;
/**
* Encodes multiple calls into a single pre-authorized call to the cow-shed factory.
*
* This single call will create the cow-shed account if it doesn't exist yet, then will execute the calls.
*
* @returns pre-authorized multicall details
*/
signCalls({ calls, signer: signerParam, chainId, nonce, deadline, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
protected getCowShedHooks(chainId: SupportedChainId, customOptions?: ICoWShedOptions): CowShedHooks;
protected static getNonce(): string;
}