Socket
Socket
Sign inDemoInstall

space-bico-account-abstraction

Package Overview
Dependencies
54
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

dist/src/IAccount.json

1

dist/src/BaseAccountAPI.d.ts

@@ -70,3 +70,2 @@ import { BigNumber, BigNumberish } from 'ethers';

* check if the contract is already deployed.
* TODO: check
*/

@@ -73,0 +72,0 @@ checkAccountPhantom(): Promise<boolean>;

@@ -44,5 +44,5 @@ "use strict";

}
// TODO: check if right wrong biconmy
/**
* check if the contract is already deployed.
* TODO: check
*/

@@ -49,0 +49,0 @@ async checkAccountPhantom() {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymasterAPI = void 0;
// TODO: check
/**

@@ -14,3 +15,2 @@ * an API to external a UserOperation with paymaster info

*/
// TODO: check
async getPaymasterAndData(userOp) {

@@ -17,0 +17,0 @@ return '0x';

@@ -1,3 +0,3 @@

import { BigNumber, BigNumberish } from 'ethers';
import { SimpleAccount, SimpleAccountFactory } from '@account-abstraction/contracts';
import { BigNumberish } from 'ethers';
import { SimpleAccountFactory } from '@account-abstraction/contracts';
import { Signer } from '@ethersproject/abstract-signer';

@@ -31,6 +31,6 @@ import { BaseApiParams, BaseAccountAPI } from './BaseAccountAPI';

*/
accountContract?: SimpleAccount;
accountContract?: any;
factory?: SimpleAccountFactory;
constructor(params: SimpleAccountApiParams);
_getAccountContract(): Promise<SimpleAccount>;
_getAccountContract(): Promise<any>;
/**

@@ -41,3 +41,3 @@ * return the value to put into the "initCode" field, if the account is not yet deployed.

getAccountInitCode(): Promise<string>;
getNonce(): Promise<BigNumber>;
getNonce(): Promise<any>;
/**

@@ -44,0 +44,0 @@ * encode a method call from entryPoint to our contract

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -8,2 +11,3 @@ exports.SimpleAccountAPI = void 0;

const BaseAccountAPI_1 = require("./BaseAccountAPI");
const IAccount_json_1 = __importDefault(require("./IAccount.json"));
/**

@@ -27,3 +31,3 @@ * An implementation of the BaseAccountAPI using the SimpleAccount contract.

if (this.accountContract == null) {
this.accountContract = contracts_1.SimpleAccount__factory.connect(await this.getAccountAddress(), this.provider);
this.accountContract = new ethers_1.ethers.Contract(this.accountAddress || '0x0000000000000000000000000000000000000000', IAccount_json_1.default, this.provider);
}

@@ -55,4 +59,3 @@ return this.accountContract;

}
const accountContract = await this._getAccountContract();
return await accountContract.getNonce();
return await this.provider.getTransactionCount(this.accountAddress || '0x0000000000000000000000000000000000000000');
}

@@ -67,3 +70,4 @@ /**

const accountContract = await this._getAccountContract();
return accountContract.interface.encodeFunctionData('executeCall', [
return accountContract.interface.encodeFunctionData('executeCall', // TODO: execute => executeCALL
[
target,

@@ -70,0 +74,0 @@ value,

{
"name": "space-bico-account-abstraction",
"version": "1.1.0",
"version": "1.2.0",
"main": "./dist/src/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -56,3 +56,3 @@ import { ethers, BigNumber, BigNumberish } from 'ethers'

*/
protected constructor (params: BaseApiParams) {
protected constructor(params: BaseApiParams) {
this.provider = params.provider

@@ -68,3 +68,3 @@ this.overheads = params.overheads

async init (): Promise<this> {
async init(): Promise<this> {
if (await this.provider.getCode(this.entryPointAddress) === '0x') {

@@ -82,3 +82,3 @@ throw new Error(`entryPoint not deployed at ${this.entryPointAddress}`)

*/
abstract getAccountInitCode (): Promise<string>
abstract getAccountInitCode(): Promise<string>

@@ -88,3 +88,3 @@ /**

*/
abstract getNonce (): Promise<BigNumber>
abstract getNonce(): Promise<BigNumber>

@@ -97,3 +97,3 @@ /**

*/
abstract encodeExecute (target: string, value: BigNumberish, data: string): Promise<string>
abstract encodeExecute(target: string, value: BigNumberish, data: string): Promise<string>

@@ -104,9 +104,9 @@ /**

*/
abstract signUserOpHash (userOpHash: string): Promise<string>
abstract signUserOpHash(userOpHash: string): Promise<string>
// TODO: check if right wrong biconmy
/**
* check if the contract is already deployed.
* TODO: check
*/
async checkAccountPhantom (): Promise<boolean> {
async checkAccountPhantom(): Promise<boolean> {
if (!this.isPhantom) {

@@ -129,3 +129,3 @@ // already deployed. no need to check anymore.

*/
async getCounterFactualAddress (): Promise<string> {
async getCounterFactualAddress(): Promise<string> {
const initCode = this.getAccountInitCode()

@@ -149,3 +149,3 @@ // use entryPoint to query account address (factory can provide a helper method to do the same, but

*/
async getInitCode (): Promise<string> {
async getInitCode(): Promise<string> {
if (await this.checkAccountPhantom()) {

@@ -161,3 +161,3 @@ return await this.getAccountInitCode()

*/
async getVerificationGasLimit (): Promise<BigNumberish> {
async getVerificationGasLimit(): Promise<BigNumberish> {
return 100000

@@ -170,3 +170,3 @@ }

*/
async getPreVerificationGas (userOp: Partial<UserOperationStruct>): Promise<number> {
async getPreVerificationGas(userOp: Partial<UserOperationStruct>): Promise<number> {
const p = await resolveProperties(userOp)

@@ -179,8 +179,8 @@ return calcPreVerificationGas(p, this.overheads)

*/
packUserOp (userOp: NotPromise<UserOperationStruct>): string {
packUserOp(userOp: NotPromise<UserOperationStruct>): string {
return packUserOp(userOp, false)
}
async encodeUserOpCallDataAndGasLimit (detailsForUserOp: TransactionDetailsForUserOp): Promise<{ callData: string, callGasLimit: BigNumber }> {
function parseNumber (a: any): BigNumber | null {
async encodeUserOpCallDataAndGasLimit(detailsForUserOp: TransactionDetailsForUserOp): Promise<{ callData: string, callGasLimit: BigNumber }> {
function parseNumber(a: any): BigNumber | null {
if (a == null || a === '') return null

@@ -210,3 +210,3 @@ return BigNumber.from(a.toString())

*/
async getUserOpHash (userOp: UserOperationStruct): Promise<string> {
async getUserOpHash(userOp: UserOperationStruct): Promise<string> {
const op = await resolveProperties(userOp)

@@ -221,3 +221,3 @@ const chainId = await this.provider.getNetwork().then(net => net.chainId)

*/
async getAccountAddress (): Promise<string> {
async getAccountAddress(): Promise<string> {
if (this.senderAddress == null) {

@@ -233,3 +233,3 @@ if (this.accountAddress != null) {

async estimateCreationGas (initCode?: string): Promise<BigNumberish> {
async estimateCreationGas(initCode?: string): Promise<BigNumberish> {
if (initCode == null || initCode === '0x') return 0

@@ -247,3 +247,3 @@ const deployerAddress = initCode.substring(0, 42)

*/
async createUnsignedUserOp (info: TransactionDetailsForUserOp): Promise<UserOperationStruct> {
async createUnsignedUserOp(info: TransactionDetailsForUserOp): Promise<UserOperationStruct> {
const {

@@ -306,3 +306,3 @@ callData,

*/
async signUserOp (userOp: UserOperationStruct): Promise<UserOperationStruct> {
async signUserOp(userOp: UserOperationStruct): Promise<UserOperationStruct> {
const userOpHash = await this.getUserOpHash(userOp)

@@ -320,3 +320,3 @@ const signature = this.signUserOpHash(userOpHash)

*/
async createSignedUserOp (info: TransactionDetailsForUserOp): Promise<UserOperationStruct> {
async createSignedUserOp(info: TransactionDetailsForUserOp): Promise<UserOperationStruct> {
return await this.signUserOp(await this.createUnsignedUserOp(info))

@@ -332,3 +332,3 @@ }

*/
async getUserOpReceipt (userOpHash: string, timeout = 30000, interval = 5000): Promise<string | null> {
async getUserOpReceipt(userOpHash: string, timeout = 30000, interval = 5000): Promise<string | null> {
const endtime = Date.now() + timeout

@@ -335,0 +335,0 @@ while (Date.now() < endtime) {

import { UserOperationStruct } from '@account-abstraction/contracts'
// TODO: check
/**

@@ -13,6 +13,5 @@ * an API to external a UserOperation with paymaster info

*/
// TODO: check
async getPaymasterAndData (userOp: Partial<UserOperationStruct>): Promise<string | undefined> {
async getPaymasterAndData(userOp: Partial<UserOperationStruct>): Promise<string | undefined> {
return '0x'
}
}

@@ -1,2 +0,2 @@

import { BigNumber, BigNumberish } from 'ethers'
import { BigNumber, BigNumberish, ethers } from 'ethers'
import {

@@ -11,2 +11,3 @@ SimpleAccount,

import { BaseApiParams, BaseAccountAPI } from './BaseAccountAPI'
import ACCOUNT_ABI from './IAccount.json'

@@ -42,7 +43,7 @@ /**

*/
accountContract?: SimpleAccount
accountContract?: any
factory?: SimpleAccountFactory
constructor (params: SimpleAccountApiParams) {
constructor(params: SimpleAccountApiParams) {
super(params)

@@ -53,7 +54,6 @@ this.factoryAddress = params.factoryAddress

}
// TODO: check
async _getAccountContract (): Promise<SimpleAccount> {
async _getAccountContract(): Promise<any> {
if (this.accountContract == null) {
this.accountContract = SimpleAccount__factory.connect(await this.getAccountAddress(), this.provider)
this.accountContract = new ethers.Contract(this.accountAddress || '0x0000000000000000000000000000000000000000', ACCOUNT_ABI, this.provider)
}

@@ -67,3 +67,3 @@ return this.accountContract

*/
async getAccountInitCode (): Promise<string> {
async getAccountInitCode(): Promise<string> {
if (this.factory == null) {

@@ -83,8 +83,7 @@ if (this.factoryAddress != null && this.factoryAddress !== '') {

// TODO: getNonce in smart account
async getNonce (): Promise<BigNumber> {
async getNonce(): Promise<any> {
if (await this.checkAccountPhantom()) {
return BigNumber.from(0)
}
const accountContract = await this._getAccountContract()
return await accountContract.getNonce()
return await this.provider.getTransactionCount(this.accountAddress || '0x0000000000000000000000000000000000000000');
}

@@ -98,6 +97,6 @@

*/
async encodeExecute (target: string, value: BigNumberish, data: string): Promise<string> {
async encodeExecute(target: string, value: BigNumberish, data: string): Promise<string> {
const accountContract: any = await this._getAccountContract()
return accountContract.interface.encodeFunctionData(
'executeCall',
'executeCall', // TODO: execute => executeCALL
[

@@ -110,5 +109,5 @@ target,

async signUserOpHash (userOpHash: string): Promise<string> {
async signUserOpHash(userOpHash: string): Promise<string> {
return await this.owner.signMessage(arrayify(userOpHash))
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc