@funkit/core 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { type Address, type Hex, type JsonRpcAccount, type PrivateKeyAccount, type TransactionReceipt, type WalletClient } from 'viem';
2
- import type { Wallet } from '../apis/types';
2
+ import { type Wallet } from '@funkit/api-base';
3
3
  import { type TransactionData, type TransactionParams } from '../common';
4
4
  import type { EnvOption } from '../config';
5
5
  import { Chain, type Operation } from '../data';
@@ -1,8 +1,5 @@
1
1
  import { type Hex } from 'viem';
2
2
  import { ContractInterface } from '../viem/ContractInterface';
3
- export declare const LOCAL_API_URL = "http://127.0.0.1:3000";
4
- declare const API_URL: string;
5
- export { API_URL };
6
3
  export declare const BASE_WRAP_TOKEN_ADDR: {
7
4
  '1': {
8
5
  weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
@@ -15,6 +12,7 @@ export declare const BASE_WRAP_TOKEN_ADDR: {
15
12
  };
16
13
  '137': {
17
14
  wmatic: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
15
+ wpol: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
18
16
  };
19
17
  '5000': {
20
18
  weth: "0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111";
@@ -16,13 +16,6 @@ export interface TransactionDataWithFee extends TransactionData {
16
16
  recipient?: Address;
17
17
  oracle?: Address;
18
18
  }
19
- export interface ExecutionReceipt {
20
- userOpHash: string;
21
- txId?: Hex;
22
- gasUsed?: string;
23
- opFeeUSD?: string;
24
- opFee?: string;
25
- }
26
19
  export type EstimateGasResult = {
27
20
  verificationGas?: bigint;
28
21
  preVerificationGas: bigint;
@@ -1,7 +1,7 @@
1
1
  import { type Address, type Hex, type PublicClient } from 'viem';
2
- import { type UserOperationGasPrice } from '../apis';
2
+ import { type UserOperation, type UserOperationGasPrice } from '@funkit/api-base';
3
3
  import { type EstimateGasResult } from '../common';
4
- import type { ChainInput, UserOperation } from './types';
4
+ import type { ChainInput } from './types';
5
5
  export declare class Chain {
6
6
  private initialized;
7
7
  private id?;
@@ -20,7 +20,6 @@ export declare class Chain {
20
20
  getChainName(): Promise<string>;
21
21
  getRpcUrl(): Promise<string>;
22
22
  getAddress(name: string): Promise<Address>;
23
- getModuleAddresses(name: string): Promise<string[]>;
24
23
  getCurrency(): Promise<string>;
25
24
  getClient(): Promise<PublicClient>;
26
25
  getFeeData(): Promise<UserOperationGasPrice>;
@@ -1,11 +1,8 @@
1
+ import type { AuthType, OperationData, OperationMetadata, OperationStatus, OperationType, Signature, UserOperation } from '@funkit/api-base';
1
2
  import type { Address, Hex } from 'viem';
2
3
  import type { Auth } from '../auth';
3
4
  import type { EnvOption } from '../config';
4
5
  import { Chain } from './Chain';
5
- import type { AuthType, OperationMetadata, OperationStatus, OperationType, Signature, UserOperation } from './types';
6
- export interface OperationData extends OperationMetadata {
7
- userOp: UserOperation;
8
- }
9
6
  export declare class Operation implements OperationData {
10
7
  opId?: Hex;
11
8
  chainId: string;
@@ -52,61 +52,3 @@ export type ExtraDataType = {
52
52
  feeRecipientPath?: Hex[];
53
53
  tokenPath?: Hex[];
54
54
  };
55
- export type UserOperation = {
56
- sender: string;
57
- nonce: bigint;
58
- initCode?: string;
59
- callData: string;
60
- callGasLimit: bigint;
61
- verificationGasLimit: bigint;
62
- preVerificationGas?: bigint;
63
- maxFeePerGas: bigint;
64
- maxPriorityFeePerGas: bigint;
65
- paymasterAndData?: string;
66
- signature?: string;
67
- };
68
- export declare enum AuthType {
69
- ECDSA = 0,
70
- MULTI_SIG = 1
71
- }
72
- export type Signature = {
73
- userId: Hex;
74
- signature: Hex;
75
- signedTime: number;
76
- };
77
- export declare enum OperationType {
78
- SINGLE_OPERATION = "SINGLE_OPERATION",
79
- GROUP_OPERATION = "GROUP_OPERATION",
80
- REJECTION = "REJECTION"
81
- }
82
- export declare enum OperationStatus {
83
- ALL = "",
84
- PENDING_APPROVED = "PENDING_APPROVED",
85
- APPROVED = "APPROVED",
86
- PENDING = "PENDING",
87
- OP_SUCCEED = "OP_SUCCEED",
88
- OP_REVERTED = "OP_REVERTED",
89
- SCHEDULED = "SCHEDULED"
90
- }
91
- export type OperationMetadata = {
92
- opId?: Hex;
93
- chainId: string;
94
- opType: OperationType;
95
- authType: AuthType;
96
- groupId?: Hex;
97
- message?: string;
98
- walletAddr: Address;
99
- status?: OperationStatus;
100
- proposer: string;
101
- proposedTime?: number;
102
- executedBy?: string;
103
- executedTime?: number;
104
- relatedOpIds?: Hex[];
105
- signatures?: Signature[];
106
- txid?: string;
107
- gasUsed?: string;
108
- opFeeUSD?: string;
109
- opFee?: string;
110
- executedBlockNumber?: number;
111
- executedBlockTimeStamp?: number;
112
- };
@@ -15,4 +15,4 @@ export declare const getGasStation: (gasStationUrl: string) => Promise<{
15
15
  maxFee: number;
16
16
  };
17
17
  }>;
18
- export declare const useFaucet: (chainIdentifier: Chain | number | string, wallet: FunWallet) => Promise<any[]>;
18
+ export declare const useFaucet: (chainIdentifier: Chain | number | string, wallet: FunWallet) => Promise<unknown[]>;
@@ -1,4 +1,4 @@
1
1
  import { type Address, type Hex } from 'viem';
2
+ import type { GroupInfo } from '@funkit/api-base';
2
3
  import type { Chain } from '../data';
3
- import type { GroupInfo } from '../wallet';
4
4
  export declare function getOnChainGroupData(groupId: Hex, chain: Chain, walletAddr: Address): Promise<GroupInfo>;
@@ -0,0 +1 @@
1
+ export declare function getTokenAddressBySymbolAndChainId(inputSymbol: any, inputChainId: any): Promise<any>;
@@ -1,5 +1,6 @@
1
1
  import { type Hex } from 'viem';
2
- import type { Chain, UserOperation } from '../data';
2
+ import type { UserOperation } from '@funkit/api-base';
3
+ import type { Chain } from '../data';
3
4
  export declare const calcPreVerificationGas: (userOp: UserOperation) => bigint;
4
5
  export declare const getPromiseFromOp: (op: UserOperation) => Promise<any>;
5
6
  export declare function gasCalculation(txid: string, chain: Chain): Promise<{
@@ -1,5 +1,6 @@
1
1
  import { type Address, type Hex } from 'viem';
2
- import { type Chain, type Operation, type Signature, type UserOperation } from '../data';
2
+ import { type Signature, type UserOperation } from '@funkit/api-base';
3
+ import { type Chain, type Operation } from '../data';
3
4
  export declare const generateRandomBytes32: () => Hex;
4
5
  export declare const generateRandomWalletUniqueId: () => Hex;
5
6
  export declare const generateRandomGroupId: () => Hex;
@@ -4,4 +4,5 @@ export * from './ChainUtils';
4
4
  export * from './CheckoutUtils';
5
5
  export * from './PaymasterUtils';
6
6
  export * from './UserOpUtils';
7
+ export * from './TokenUtils';
7
8
  export * from './WalletUtils';
@@ -1,9 +1,10 @@
1
+ import { type ExecutionReceipt, type OperationData, OperationStatus } from '@funkit/api-base';
1
2
  import { type Address, type Hex } from 'viem';
2
3
  import { FirstClassActions } from '../actions/FirstClassActions';
3
4
  import type { Auth } from '../auth';
4
- import { type ExecutionReceipt, type TransactionParams } from '../common';
5
+ import { type TransactionParams } from '../common';
5
6
  import { type EnvOption } from '../config';
6
- import { Operation, type OperationData, OperationStatus } from '../data';
7
+ import { Operation } from '../data';
7
8
  import type { FunWalletParams, User } from './types';
8
9
  export declare class FunWallet extends FirstClassActions {
9
10
  walletUniqueId?: Hex;
@@ -71,16 +72,16 @@ export declare class FunWallet extends FirstClassActions {
71
72
  * Retrieves a list of operations associated with the wallet.
72
73
  * @param {OperationStatus} status - The status of operations to retrieve (default: OperationStatus.ALL).
73
74
  * @param {EnvOption} txOptions - Transaction environment options (default: global environment options).
74
- * @returns {Promise<Operation[]>} A list of operations.
75
+ * @returns {Promise<OperationData[]>} A list of operations.
75
76
  */
76
- getOperations(status?: OperationStatus, txOptions?: EnvOption): Promise<Operation[]>;
77
+ getOperations(status?: OperationStatus, txOptions?: EnvOption): Promise<OperationData[]>;
77
78
  /**
78
79
  * Retrieves a specific operation by its ID.
79
80
  * @param {Hex} opId - The ID of the operation to retrieve.
80
81
  * @param {EnvOption} txOptions - Transaction environment options (default: global environment options).
81
- * @returns {Promise<Operation>} The requested operation.
82
+ * @returns {Promise<OperationData>} The requested operation.
82
83
  */
83
- getOperation(opId: Hex, txOptions?: EnvOption): Promise<Operation>;
84
+ getOperation(opId: Hex, txOptions?: EnvOption): Promise<OperationData>;
84
85
  /**
85
86
  * Retrieves a list of users associated with the wallet and their potential corresponding group information.
86
87
  * @param {Auth} auth - The authentication instance for retrieving user information.
@@ -159,7 +160,7 @@ export declare class FunWallet extends FirstClassActions {
159
160
  * @param {EnvOption} txOptions - Transaction environment options (default: global environment options).
160
161
  * @returns {Promise<Operation>} The prepared rejection operation.
161
162
  */
162
- createRejectOperation(auth: Auth, groupId: string, operation: Operation, rejectionMessage?: string, txOptions?: EnvOption): Promise<Operation>;
163
+ createRejectOperation(auth: Auth, groupId: string, operation: OperationData, rejectionMessage?: string, txOptions?: EnvOption): Promise<Operation>;
163
164
  /**
164
165
  * Estimates the gas cost for executing an operation and returns the updated operation with gas estimation details.
165
166
  * @param {Auth} auth - The authentication instance for the user.
@@ -1,8 +1,5 @@
1
+ import type { GroupInfo } from '@funkit/api-base';
1
2
  import type { Hex } from 'viem';
2
- export type GroupInfo = {
3
- threshold: number;
4
- memberIds: Hex[];
5
- };
6
3
  export type User = {
7
4
  userId: Hex;
8
5
  groupInfo?: GroupInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/core",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Funkit core SDK provides feature-rich and extensible smart wallets built on account abstraction",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,27 +13,18 @@
13
13
  "dependencies": {
14
14
  "@aws-sdk/client-secrets-manager": "^3.315.0",
15
15
  "@ethersproject/abi": "^5.7.0",
16
- "@ethersproject/contracts": "^5.7.0",
17
16
  "@ethersproject/providers": "^5.7.2",
18
17
  "@lifeomic/attempt": "^3.0.3",
19
18
  "abitype": "^0.10.2",
20
- "big.js": "^6.2.1",
21
19
  "dotenv": "^16.0.3",
22
20
  "ethers": "5.7.2",
23
21
  "uuid": "^9.0.0",
24
22
  "viem": "2.17.0",
25
- "@funkit/utils": "1.0.3",
26
- "@funkit/api-base": "1.5.0"
23
+ "@funkit/api-base": "1.5.1",
24
+ "@funkit/utils": "1.0.4"
27
25
  },
28
26
  "devDependencies": {
29
- "@types/big.js": "^6.2.2",
30
- "@types/chai": "^5.0.1",
31
- "@types/mocha": "^10.0.1",
32
27
  "@types/uuid": "^9.0.1",
33
- "chai": "^5.1.1",
34
- "husky": "^8.0.3",
35
- "mocha": "^10.2.0",
36
- "ts-mocha": "^10.0.0",
37
28
  "ts-node": "^10.9.1",
38
29
  "typescript": "^5.4.3"
39
30
  },
@@ -63,7 +54,6 @@
63
54
  "typecheck": "tsc --noEmit",
64
55
  "declaration": "tsc --emitDeclarationOnly",
65
56
  "build:watch": "rm -rf dist && node build.js --watch",
66
- "test": "ts-mocha --exit tests/tenderly/*.ts --exit",
67
57
  "test-tenderly": "ts-mocha --exit tests/tenderly/*.ts",
68
58
  "test-aws": "env ts-mocha",
69
59
  "test-goerli": "env ts-mocha --exit tests/goerli/*.ts",
@@ -1,6 +0,0 @@
1
- import type { Address } from 'viem';
2
- export declare function getTokenInfo(symbol: string, chainId: string): Promise<Address>;
3
- export declare function getChainFromId(chainId: string): Promise<any>;
4
- export declare function getChainFromName(name: string): Promise<any>;
5
- export declare function getModuleInfo(moduleName: string, chainId: string): Promise<any>;
6
- export declare function getPaymasterAddress(chainId: string): Promise<any>;
@@ -1,15 +0,0 @@
1
- import type { Address, Hex } from 'viem';
2
- import type { ExecutionReceipt } from '../common/types';
3
- import { type Operation, OperationStatus } from '../data';
4
- import type { EstimateOpInput, EstimatedGas, ExecuteOpInput, ScheduleOpInput, UserOperationGasPrice } from './types';
5
- export declare function createOp(op: Operation): Promise<string>;
6
- export declare function getOpsOfGroup(groupId: Hex, chainId: string, status: OperationStatus): Promise<Operation[]>;
7
- export declare function getOpsOfWallet(walletAddr: Address, chainId: string, status?: OperationStatus): Promise<Operation[]>;
8
- export declare function getOps(opIds: Hex[], chainId: string): Promise<Operation[]>;
9
- export declare function deleteOp(opId: Hex, chainId: string): Promise<void>;
10
- export declare function signOp(opId: Hex, chainId: string, signature: Hex, signedBy: Address, threshold?: number): Promise<void>;
11
- export declare function executeOp(executeOpInput: ExecuteOpInput): Promise<ExecutionReceipt>;
12
- export declare function estimateOp(estimateOpInput: EstimateOpInput): Promise<EstimatedGas>;
13
- export declare function scheduleOp(scheduleOpInput: ScheduleOpInput): Promise<void>;
14
- export declare const getFullReceipt: (opId: any, chainId: any, userOpHash: any) => Promise<ExecutionReceipt>;
15
- export declare const getGasPrice: (chainId: string) => Promise<UserOperationGasPrice>;
@@ -1,9 +0,0 @@
1
- import { type Address, type Hex } from 'viem';
2
- import type { Wallet } from './types';
3
- export declare function createUser(authId: string, addr: string, method: string, userUniqueId: string): Promise<void>;
4
- export declare function getUserUniqueId(authId: string): Promise<string>;
5
- export declare function getUserAddr(authId: string): Promise<string>;
6
- export declare function getUserWalletsByAddr(addr: string, chainId?: string): Promise<Wallet[]>;
7
- export declare function getUserAuthIdByAddr(addr: string): Promise<string>;
8
- export declare function addUserToWallet(authId: string, chainId: string, walletAddr: Address, userIds: Hex[], walletUniqueId?: string): Promise<void>;
9
- export declare function getUserWalletIdentities(authId: string, chainId: string, walletAddr: Address): Promise<Hex[]>;
@@ -1,4 +0,0 @@
1
- export * from './InfoApis';
2
- export * from './OperationApis';
3
- export * from './types';
4
- export * from './UserApis';
@@ -1,42 +0,0 @@
1
- import type { Address, Hex } from 'viem';
2
- import type { UserOperation } from '../data';
3
- import type { GroupInfo } from '../wallet';
4
- export type Wallet = {
5
- walletUniqueId?: string;
6
- walletAddr: Address;
7
- userIds: Hex[];
8
- };
9
- export type ExecuteOpInput = {
10
- opId: Hex;
11
- chainId: string;
12
- executedBy: string;
13
- entryPointAddress: Address;
14
- signature: Hex;
15
- userOp?: UserOperation;
16
- groupInfo?: GroupInfo;
17
- };
18
- export type ScheduleOpInput = {
19
- opId: Hex;
20
- chainId: string;
21
- scheduledBy: string;
22
- entryPointAddress: Address;
23
- signature: Hex;
24
- userOp?: UserOperation;
25
- groupInfo?: GroupInfo;
26
- };
27
- export type EstimateOpInput = {
28
- opId?: Hex;
29
- chainId: string;
30
- entryPointAddress?: Address;
31
- signature?: Hex;
32
- userOp?: UserOperation;
33
- };
34
- export type EstimatedGas = {
35
- preVerificationGas: bigint;
36
- callGasLimit: bigint;
37
- verificationGasLimit: bigint;
38
- };
39
- export type UserOperationGasPrice = {
40
- maxFeePerGas: bigint;
41
- maxPriorityFeePerGas: bigint;
42
- };