Skip to content

Commit

Permalink
Merge pull request #16 from frankcrypto2023/dev
Browse files Browse the repository at this point in the history
update newest addr
  • Loading branch information
dindinw authored Oct 15, 2024
2 parents 368acf9 + 5cd5a41 commit 7c9d340
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
11 changes: 6 additions & 5 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions src/eip4337/address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const EntryPointAddr = `0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789`;
export const QngAccountFactoryAddr = `0xa95a633294a8ce18298B488858d90c4E16FD0AB0`;
export const QngPaymasterAddr = `0x016001559A8685af58C45f0d6408fF88075343c5`;
export const MeerChangeAddr = `0x09654c5D28b462BA219038e534e685f703B2EE5f`;
export const QngAccountFactoryAddr = `0x5c5ac24588658551bdc7C18D266AbF28d47e6039`;
export const QngPaymasterAddr = `0x6A8E1b74a5e06687ce47959575dE51A20004be0F`;
export const MeerChangeAddr = `0x7D698C4E800dBc1E9B7e915BefeDdB59Aa9E8BB6`;
14 changes: 2 additions & 12 deletions src/eip4337/meerchange.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as contracts from "@qng/meerchange-contracts";

import { Provider } from "@ethersproject/providers";
import { ethers } from "ethers";
export class MeerChangeAPI {
meerchangeContract: any;
meerchangeAddr: string;
Expand All @@ -19,19 +18,10 @@ export class MeerChangeAPI {
}
return this.meerchangeContract;
}
async encodeExport4337(
txid: string,
idx: number,
fee: number,
signature: string
) {
if (!txid.startsWith("0x")) {
txid = `0x${txid}`;
}
async encodeExport4337(ops: string, fee: number, signature: string) {
const meerchangeContract = await this._getMeerChangeContract();
return meerchangeContract.interface.encodeFunctionData("export", [
ethers.utils.hexZeroPad(txid, 32),
idx,
ops,
fee,
signature,
]);
Expand Down
4 changes: 2 additions & 2 deletions src/eip4337/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@qng/eip4337-sdk",
"description": "Qng Account Abstraction (EIP 4337) contracts SDK",
"version": "0.6.8",
"version": "0.6.10",
"main": "./dist/index.js",
"files": [
"dist/"
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@qng/eip4337-contracts": "^0.6.0",
"@qng/meerchange-contracts": "^0.0.3",
"@qng/meerchange-contracts": "^0.0.4",
"@account-abstraction/sdk": "^0.6.0",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
Expand Down
16 changes: 16 additions & 0 deletions src/eip4337/test/4-encodeExport4337.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MeerChangeAPI, MeerChangeAddr } from "../";

describe("export4337", () => {
const abi = new MeerChangeAPI({
meerchangeAddr: MeerChangeAddr,
});

it("returns a gas value proportional to sigSize", async () => {
const data = await abi.encodeExport4337(
"d47e847a8ac828abc27109b3f94a053c4dba53ccc6eb37cb7872435e0ee8936a:0",
10000,
"3097947d270698a7f7d6bd5b9f4b725af77c9c866219893f75b63f2207370d5279249ec5cccc4973c343f299d086412c9443bb4f30e283a628f7043c6c0b14be00"
);
console.log(data);
});
});

0 comments on commit 7c9d340

Please sign in to comment.