@funkit/core 2.2.9 → 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.
Files changed (41) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +3302 -6210
  3. package/dist/index.js.map +4 -4
  4. package/dist/src/actions/FirstClassActions.d.ts +1 -20
  5. package/dist/src/actions/index.d.ts +0 -1
  6. package/dist/src/auth/Auth.d.ts +1 -1
  7. package/dist/src/common/constants.d.ts +80 -223
  8. package/dist/src/common/types.d.ts +0 -7
  9. package/dist/src/data/Chain.d.ts +2 -3
  10. package/dist/src/data/Operation.d.ts +1 -4
  11. package/dist/src/data/types.d.ts +0 -58
  12. package/dist/src/sponsors/Sponsor.d.ts +1 -1
  13. package/dist/src/sponsors/TokenSponsor.d.ts +1 -1
  14. package/dist/src/sponsors/types.d.ts +0 -6
  15. package/dist/src/utils/ChainUtils.d.ts +1 -1
  16. package/dist/src/utils/GroupUtils.d.ts +1 -1
  17. package/dist/src/utils/PaymasterUtils.d.ts +1 -1
  18. package/dist/src/utils/TokenUtils.d.ts +1 -0
  19. package/dist/src/utils/UserOpUtils.d.ts +2 -1
  20. package/dist/src/utils/WalletUtils.d.ts +2 -1
  21. package/dist/src/utils/index.d.ts +1 -1
  22. package/dist/src/wallet/FunWallet.d.ts +8 -7
  23. package/dist/src/wallet/types.d.ts +1 -4
  24. package/package.json +12 -25
  25. package/dist/src/actions/Bridge.d.ts +0 -5
  26. package/dist/src/actions/LimitOrder.d.ts +0 -4
  27. package/dist/src/actions/Swap.d.ts +0 -9
  28. package/dist/src/apis/AccessControlApis.d.ts +0 -5
  29. package/dist/src/apis/BridgeApis.d.ts +0 -5
  30. package/dist/src/apis/ContractApis.d.ts +0 -1
  31. package/dist/src/apis/GroupApis.d.ts +0 -4
  32. package/dist/src/apis/InfoApis.d.ts +0 -6
  33. package/dist/src/apis/ListenerApis.d.ts +0 -3
  34. package/dist/src/apis/NFTApis.d.ts +0 -22
  35. package/dist/src/apis/OperationApis.d.ts +0 -15
  36. package/dist/src/apis/PaymasterApis.d.ts +0 -10
  37. package/dist/src/apis/SwapApis.d.ts +0 -4
  38. package/dist/src/apis/UserApis.d.ts +0 -9
  39. package/dist/src/apis/index.d.ts +0 -8
  40. package/dist/src/apis/types.d.ts +0 -49
  41. package/dist/src/utils/SwapUtils.d.ts +0 -33
@@ -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.2.9",
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,30 +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
- "@uniswap/sdk": "^3.0.3",
20
- "@uniswap/sdk-core": "^4.2.0",
21
- "@uniswap/v3-sdk": "^3.11.0",
22
18
  "abitype": "^0.10.2",
23
- "big.js": "^6.2.1",
24
19
  "dotenv": "^16.0.3",
25
20
  "ethers": "5.7.2",
26
21
  "uuid": "^9.0.0",
27
22
  "viem": "2.17.0",
28
- "@funkit/api-base": "1.4.2",
29
- "@funkit/utils": "1.0.3"
23
+ "@funkit/api-base": "1.5.1",
24
+ "@funkit/utils": "1.0.4"
30
25
  },
31
26
  "devDependencies": {
32
- "@types/big.js": "^6.2.2",
33
- "@types/chai": "^4.3.5",
34
- "@types/mocha": "^10.0.1",
35
27
  "@types/uuid": "^9.0.1",
36
- "chai": "^5.1.1",
37
- "husky": "^8.0.3",
38
- "mocha": "^10.2.0",
39
- "ts-mocha": "^10.0.0",
40
28
  "ts-node": "^10.9.1",
41
29
  "typescript": "^5.4.3"
42
30
  },
@@ -66,19 +54,18 @@
66
54
  "typecheck": "tsc --noEmit",
67
55
  "declaration": "tsc --emitDeclarationOnly",
68
56
  "build:watch": "rm -rf dist && node build.js --watch",
69
- "test": "ts-mocha --exit tests/tenderly/*.ts --exit",
70
57
  "test-tenderly": "ts-mocha --exit tests/tenderly/*.ts",
71
58
  "test-aws": "env ts-mocha",
72
59
  "test-goerli": "env ts-mocha --exit tests/goerli/*.ts",
73
- "local-test-tenderly": "env NODE_ENV=local ts-mocha --exit tests/tenderly/*.ts",
74
- "local-test-goerli": "env NODE_ENV=local ts-mocha --exit tests/goerli/*.ts",
75
- "staging-test-tenderly": "env NODE_ENV=staging ts-mocha --exit tests/tenderly/*.ts",
76
- "staging-test-goerli": "env NODE_ENV=staging ts-mocha --exit tests/goerli/*.ts",
77
- "staging-test-arbitrum": "env NODE_ENV=staging ts-mocha --exit tests/arbitrum/*.ts",
78
- "staging-test-mantle": "env NODE_ENV=staging ts-mocha --exit tests/mantle/*.ts",
79
- "staging-test-optimism": "env NODE_ENV=staging ts-mocha --exit tests/optimism/*.ts",
80
- "staging-test-polygon": "env NODE_ENV=staging ts-mocha --exit tests/polygon/*.ts",
81
- "staging-test-scroll": "env NODE_ENV=staging ts-mocha --exit tests/scroll/factory.ts",
60
+ "local-test-tenderly": "env API_BASE_URL=http://127.0.0.1:3000 ts-mocha --exit tests/tenderly/*.ts",
61
+ "local-test-goerli": "env API_BASE_URL=http://127.0.0.1:3000 ts-mocha --exit tests/goerli/*.ts",
62
+ "staging-test-tenderly": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/tenderly/*.ts",
63
+ "staging-test-goerli": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/goerli/*.ts",
64
+ "staging-test-arbitrum": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/arbitrum/*.ts",
65
+ "staging-test-mantle": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/mantle/*.ts",
66
+ "staging-test-optimism": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/optimism/*.ts",
67
+ "staging-test-polygon": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/polygon/*.ts",
68
+ "staging-test-scroll": "env API_BASE_URL=https://api.fun.xyz/staging/v1 ts-mocha --exit tests/scroll/factory.ts",
82
69
  "load": "node test/loader.js",
83
70
  "lint": "biome check",
84
71
  "lint:fix": "biome check --fix",
@@ -1,5 +0,0 @@
1
- import type { Address } from 'viem';
2
- import { type TransactionParams } from '../common';
3
- import { Chain } from '../data';
4
- import { type BridgeParams } from './types';
5
- export declare const bridgeTransactionParams: (params: BridgeParams, walletAddress: Address, chain: Chain) => Promise<TransactionParams>;
@@ -1,4 +0,0 @@
1
- import { type TransactionParams } from '../common';
2
- import { type Chain } from '../data';
3
- import type { LimitOrderParam } from './types';
4
- export declare const limitSwapOrderTransactionParams: (params: LimitOrderParam, chain: Chain) => Promise<TransactionParams>;
@@ -1,9 +0,0 @@
1
- import { type Address } from 'viem';
2
- import { type TransactionParams } from '../common';
3
- import type { EnvOption } from '../config';
4
- import { type SwapParams } from './types';
5
- export declare const oneInchSupported: number[];
6
- export declare const uniswapV3Supported: number[];
7
- export declare const oneInchTransactionParams: (params: SwapParams, walletAddress: Address, txOptions?: EnvOption) => Promise<TransactionParams>;
8
- export declare const uniswapV3SwapTransactionParams: (params: SwapParams, txOptions?: EnvOption) => Promise<TransactionParams>;
9
- export declare const uniswapV2SwapTransactionParams: (params: SwapParams, txOptions?: EnvOption) => Promise<TransactionParams>;
@@ -1,5 +0,0 @@
1
- import type { Address, Hex } from 'viem';
2
- export declare function initializeWalletAccess(walletAddr: Address, creatorAddr: Address): Promise<void>;
3
- export declare function checkWalletAccessInitialization(walletAddr: Address): Promise<boolean>;
4
- export declare function addAccessToWallet(walletAddr: Address, nonce: number, signature: Hex): Promise<void>;
5
- export declare function addAccessToUser(authId: string, nonce: number, signature: Hex): Promise<void>;
@@ -1,5 +0,0 @@
1
- import type { Address } from 'viem';
2
- export declare function getSocketBridgeQuote(recipient: string, walletAddress: string, fromChain: string, toChain: string, fromToken: string, toToken: string, amount: bigint, sort: string): Promise<any>;
3
- export declare function getSocketBridgeTransaction(route: any): Promise<any>;
4
- export declare function getSocketBridgeAllowance(chainId: string, sender: Address, allowanceTarget: string, token: string): Promise<any>;
5
- export declare function getSocketBridgeApproveTransaction(chainId: string, sender: Address, allowanceTarget: string, token: string, amount: bigint): Promise<any>;
@@ -1 +0,0 @@
1
- export declare function getContractAbi(contractName: string, mode?: string): Promise<any>;
@@ -1,4 +0,0 @@
1
- import type { Address, Hex } from 'viem';
2
- import type { GroupMetadata } from './types';
3
- export declare function getGroups(groupIds: Hex[], chainId: string): Promise<GroupMetadata[]>;
4
- export declare function getGroupsByWallet(walletAddr: Address, chainId: string): Promise<GroupMetadata[]>;
@@ -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,3 +0,0 @@
1
- import type { Address } from 'viem';
2
- export declare function createListener(walletAddresses: Address[], chains: string[], webhookUrl: string): Promise<void>;
3
- export declare function deleteListener(walletAddress: Address, chain: string): Promise<void>;
@@ -1,22 +0,0 @@
1
- /**
2
- * Get the name of an NFT collection
3
- * @param {string} chainId https://chainlist.org/
4
- * @param {string} nftAddress Address of NFT
5
- * @returns JSON
6
- * {
7
- * "success": true,
8
- * "name": "Anatomy Science Ape Club"
9
- * }
10
- */
11
- export declare function getNftName(chainId: string, nftAddress: string): Promise<any>;
12
- /**
13
- * Get the address and chainId of an NFT collection
14
- * @param {string} name Name of NFT
15
- * @returns JSON
16
- * {
17
- * "success": true,
18
- * "address": "0x96fc56721d2b79485692350014875b3b67cb00eb",
19
- * "chain": "1"
20
- * }
21
- */
22
- export declare function getNftAddress(name: 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,10 +0,0 @@
1
- import type { PaymasterType } from '../sponsors/types';
2
- export interface PaymasterTransaction {
3
- action: string;
4
- amount: number;
5
- from: string;
6
- to: string;
7
- token: string;
8
- txid?: string;
9
- }
10
- export declare function addTransaction(chainId: string, timestamp: number, txid: any, transaction: PaymasterTransaction, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
@@ -1,4 +0,0 @@
1
- import type { TransactionParams } from '../common';
2
- export declare function get1InchSwapTx(chainId: string, src: string, dst: string, amount: string, from: string, slippage: string, disableEstimate: string, allowPartialFill: string): Promise<TransactionParams>;
3
- export declare function get1InchAllowance(chainId: string, tokenAddress: string, walletAddress: string): Promise<number>;
4
- export declare function get1InchApproveTx(chainId: string, tokenAddress: string, amount: string): Promise<TransactionParams>;
@@ -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,8 +0,0 @@
1
- export * from './ContractApis';
2
- export * from './GroupApis';
3
- export * from './InfoApis';
4
- export * from './NFTApis';
5
- export * from './OperationApis';
6
- export * from './PaymasterApis';
7
- export * from './types';
8
- export * from './UserApis';
@@ -1,49 +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 GroupMetadata = {
10
- groupId: Hex;
11
- chainId: string;
12
- threshold: number;
13
- walletAddr: Address;
14
- memberIds: Hex[];
15
- };
16
- export type ExecuteOpInput = {
17
- opId: Hex;
18
- chainId: string;
19
- executedBy: string;
20
- entryPointAddress: Address;
21
- signature: Hex;
22
- userOp?: UserOperation;
23
- groupInfo?: GroupInfo;
24
- };
25
- export type ScheduleOpInput = {
26
- opId: Hex;
27
- chainId: string;
28
- scheduledBy: string;
29
- entryPointAddress: Address;
30
- signature: Hex;
31
- userOp?: UserOperation;
32
- groupInfo?: GroupInfo;
33
- };
34
- export type EstimateOpInput = {
35
- opId?: Hex;
36
- chainId: string;
37
- entryPointAddress?: Address;
38
- signature?: Hex;
39
- userOp?: UserOperation;
40
- };
41
- export type EstimatedGas = {
42
- preVerificationGas: bigint;
43
- callGasLimit: bigint;
44
- verificationGasLimit: bigint;
45
- };
46
- export type UserOperationGasPrice = {
47
- maxFeePerGas: bigint;
48
- maxPriorityFeePerGas: bigint;
49
- };
@@ -1,33 +0,0 @@
1
- import { type Address, type PublicClient } from 'viem';
2
- import type { UniswapPoolFeeOptions } from '../actions';
3
- export declare function fromReadableAmount(amount: number, decimals: number): bigint;
4
- type SwapParamsUtils = {
5
- tokenInAddress: Address;
6
- tokenOutAddress: Address;
7
- amountIn: number;
8
- recipient: Address;
9
- percentDecimal: number;
10
- slippage: number;
11
- poolFee: UniswapPoolFeeOptions;
12
- };
13
- export type UniswapV3Addrs = {
14
- univ3quoter: Address;
15
- univ3factory: Address;
16
- univ3router: Address;
17
- };
18
- export type UniswapV2Addrs = {
19
- factory: Address;
20
- router: Address;
21
- };
22
- export declare function swapExec(client: PublicClient, uniswapAddrs: UniswapV3Addrs, swapParams: SwapParamsUtils, chainId: number): Promise<{
23
- amount: string;
24
- data: string;
25
- to: string;
26
- value: string;
27
- }>;
28
- export declare function swapExecV2(client: PublicClient, uniswapAddrs: UniswapV2Addrs, swapParams: SwapParamsUtils, chainId: number): Promise<{
29
- data: `0x${string}` | undefined;
30
- to: `0x${string}`;
31
- amount: string;
32
- }>;
33
- export {};