-
Notifications
You must be signed in to change notification settings - Fork 566
Open
Description
What are you trying to do?
BaseContractInteraction should be chain/wallet agnostic, send method can take wallet as parameter
Code Reference
export abstract class BaseContractInteraction {
protected log = createLogger('aztecjs:contract_interaction');
constructor(
protected wallet: Wallet,
protected authWitnesses: AuthWitness[] = [],
protected capsules: Capsule[] = [],
) {}
/**
* Returns an execution request that represents this operation.
* Can be used as a building block for constructing batch requests.
* @param options - An optional object containing additional configuration for the transaction.
* @returns An execution request wrapped in promise.
*/
public abstract request(options?: RequestInteractionOptions): Promise<ExecutionPayload>;
// docs:start:send
/**
* Sends a transaction to the contract function with the specified options.
* This function throws an error if called on a utility function.
* It creates and signs the transaction if necessary, and returns a SentTx instance,
* which can be used to track the transaction status, receipt, and events.
* @param options - An object containing 'from' property representing
* the AztecAddress of the sender and optional fee configuration
* @returns A SentTx instance for tracking the transaction status and information.
*/
public send(options: SendInteractionOptions): SentTx {
// docs:end:send
const sendTx = async () => {
const executionPayload = await this.request(options);
const sendOptions = await toSendOptions(options);
return this.wallet.sendTx(executionPayload, sendOptions);
};
return new SentTx(this.wallet, sendTx);
}
}
Aztec Version
v3.0.0-devnet.5
OS
No response
Browser (if relevant)
No response
Node Version
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
No labels