@cowprotocol/cow-sdk
Version:
## 📚 [Docs website](https://docs.cow.fi/)
75 lines (74 loc) • 2.63 kB
TypeScript
import { CoWShedVersion, EvmCall, SignerLike } from '../common';
import { SupportedChainId } from '../chains';
import { CowShedHooks } from './contracts/CoWShedHooks';
import { EcdsaSigningScheme } from '@cowprotocol/contracts';
import { ICoWShedCall, ICoWShedOptions } from './types';
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;
/**
* If value is provided, gas won't be estimated and will use the value
*/
gasLimit?: 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;
readonly version: CoWShedVersion;
protected hooksCache: Map<SupportedChainId, CowShedHooks>;
constructor(options?: CowShedSdkOptions, version?: CoWShedVersion);
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, gasLimit, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
protected getCowShedHooks(chainId: SupportedChainId, customOptions?: ICoWShedOptions): CowShedHooks;
protected static getNonce(): string;
}