Skip to content

Commit

Permalink
Tentative fix to support Argent X 3
Browse files Browse the repository at this point in the history
  • Loading branch information
wraitii committed Mar 11, 2022
1 parent 2a7fce2 commit 7dafbad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions src/chain/contracts/Abstraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ export default class ExtendedContract extends Contract
super(abi, address, provider)
}

public async call(method: string, args: Args = {}) {
if (!this.provider.getPubKey)
return await super.call(method, args);
// ensure contract is connected
//assert(this.connectedTo !== null, 'contract isnt connected to an address');

// validate method and args
this.validateMethodAndArgs('CALL', method, args);

// compile calldata
//const entrypointSelector = getSelectorFromName(method);
const calldata = compileCalldata(args);

return this.provider
.callContract({
contractAddress: this.connectedTo,
calldata,
entrypoint: method,
})
.then((x) => this.parseResponse(method, x.result));
}

override private parseResponse(method: string, response: (string | string[])[]): Args {
const methodAbi = this.abi.find((abi) => abi.name === method)!;
let out: Args = {};
Expand Down

0 comments on commit 7dafbad

Please sign in to comment.