@funkit/core 2.3.3 → 2.3.4
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.
- package/dist/index.js +74 -109
- package/dist/index.js.map +2 -2
- package/dist/src/actions/Stake.d.ts +2 -2
- package/dist/src/data/NFT.d.ts +8 -3
- package/dist/src/errors/clientErrors.d.ts +1 -1
- package/dist/src/sponsors/GaslessSponsor.d.ts +0 -1
- package/dist/src/sponsors/TokenSponsor.d.ts +3 -4
- package/dist/src/utils/ApiUtils.d.ts +4 -17
- package/dist/src/utils/ChainUtils.d.ts +1 -1
- package/dist/src/utils/MerkleUtils.d.ts +1 -1
- package/dist/src/utils/UserOpUtils.d.ts +1 -3
- package/dist/src/utils/ViemUtils.d.ts +3 -1
- package/dist/src/viem/ContractInterface.d.ts +11 -10
- package/dist/src/wallet/FunWallet.d.ts +1 -1
- package/package.json +7 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type TransactionParams } from '../common';
|
|
2
2
|
import type { EnvOption } from '../config';
|
|
3
3
|
import type { FinishUnstakeParams, RequestUnstakeParams, StakeParams } from './types';
|
|
4
|
-
export declare const isRequestUnstakeParams: (input:
|
|
5
|
-
export declare const isFinishUnstakeParams: (input:
|
|
4
|
+
export declare const isRequestUnstakeParams: (input: RequestUnstakeParams | FinishUnstakeParams) => boolean;
|
|
5
|
+
export declare const isFinishUnstakeParams: (input: RequestUnstakeParams | FinishUnstakeParams) => boolean;
|
|
6
6
|
export declare const stakeTransactionParams: (params: StakeParams, txOptions?: EnvOption) => Promise<TransactionParams>;
|
|
7
7
|
export declare const requestUnstakeTransactionParams: (params: RequestUnstakeParams, txOptions?: EnvOption) => Promise<TransactionParams>;
|
|
8
8
|
export declare const finishUnstakeTransactionParams: (params: FinishUnstakeParams, txOptions?: EnvOption) => Promise<TransactionParams>;
|
package/dist/src/data/NFT.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { type Address } from 'viem';
|
|
2
|
-
import { type TransactionData } from '../common';
|
|
2
|
+
import { type TransactionData, type TransactionParams } from '../common';
|
|
3
3
|
import type { EnvOption } from '../config';
|
|
4
|
+
import { Chain } from './Chain';
|
|
4
5
|
export declare class NFT {
|
|
5
6
|
address?: Address;
|
|
6
7
|
name: string;
|
|
7
8
|
constructor(input: string);
|
|
8
9
|
approve(spender: string, tokenId: number, options?: EnvOption): Promise<TransactionData>;
|
|
9
10
|
ownerOf(tokenId: number, options?: EnvOption): Promise<Address>;
|
|
10
|
-
approveForAll(spender: string, options?: EnvOption): Promise<
|
|
11
|
+
approveForAll(spender: string, options?: EnvOption): Promise<TransactionParams & {
|
|
12
|
+
chain: Chain;
|
|
13
|
+
}>;
|
|
11
14
|
getAddress(): Promise<Address>;
|
|
12
15
|
getName(options?: EnvOption): Promise<string>;
|
|
13
16
|
getBalance(address: Address, options?: EnvOption): Promise<bigint>;
|
|
14
17
|
getApproved(tokenId: string, options?: EnvOption): Promise<Address>;
|
|
15
18
|
revokeForAll(spender: string, options?: EnvOption): Promise<TransactionData>;
|
|
16
|
-
transfer(sender: string, spender: string, tokenId: number, options?: EnvOption): Promise<
|
|
19
|
+
transfer(sender: string, spender: string, tokenId: number, options?: EnvOption): Promise<TransactionParams & {
|
|
20
|
+
chain: Chain;
|
|
21
|
+
}>;
|
|
17
22
|
static approve(data: string, spender: string, tokenId: number, options?: EnvOption): Promise<TransactionData>;
|
|
18
23
|
static approveForAll(data: string, spender: string, options?: EnvOption): Promise<TransactionData>;
|
|
19
24
|
static getAddress(data: string): Promise<Address>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ClientError } from '@funkit/utils';
|
|
2
2
|
export declare class InvalidActionError extends ClientError {
|
|
3
|
-
constructor(code: string, msg: string, paramsUsed:
|
|
3
|
+
constructor(code: string, msg: string, paramsUsed: unknown, fixSuggestion: string, docLink: string);
|
|
4
4
|
}
|
|
@@ -15,5 +15,4 @@ export declare class GaslessSponsor extends Sponsor {
|
|
|
15
15
|
unlockDepositAfter(blocksToWait: number): Promise<TransactionParams>;
|
|
16
16
|
getSpenderBlacklistMode(spender: Address, sponsor: Address, options?: EnvOption): Promise<boolean>;
|
|
17
17
|
getSpenderWhitelistMode(spender: Address, sponsor: Address, options?: EnvOption): Promise<boolean>;
|
|
18
|
-
static getPaymasterAddress(options?: EnvOption): Promise<Address>;
|
|
19
18
|
}
|
|
@@ -15,10 +15,10 @@ export declare class TokenSponsor extends Sponsor {
|
|
|
15
15
|
unstake(receiver: Address, amount: number, options?: EnvOption): Promise<TransactionParams>;
|
|
16
16
|
getUnlockBlock(sponsor: Address, token: string, options?: EnvOption): Promise<bigint>;
|
|
17
17
|
getLockState(sponsor: Address, token: string, options?: EnvOption): Promise<boolean>;
|
|
18
|
-
getTokenInfo(token: string, options?: EnvOption): Promise<
|
|
18
|
+
getTokenInfo(token: string, options?: EnvOption): Promise<unknown>;
|
|
19
19
|
getAllTokenData(spender: Address, token: string, options?: EnvOption): Promise<AllTokenData>;
|
|
20
20
|
getTokenBalance(spender: Address, token: string, options?: EnvOption): Promise<bigint>;
|
|
21
|
-
getAllTokens(options?: EnvOption): Promise<
|
|
21
|
+
getAllTokens(options?: EnvOption): Promise<unknown>;
|
|
22
22
|
addUsableToken(oracle: string, token: string, aggregator: string, options?: EnvOption): Promise<TransactionParams>;
|
|
23
23
|
depositToken(token: string, spender: Address, amount: number, options?: EnvOption): Promise<TransactionParams>;
|
|
24
24
|
withdrawToken(token: string, receiver: Address, amount: number, options?: EnvOption): Promise<TransactionParams>;
|
|
@@ -32,9 +32,8 @@ export declare class TokenSponsor extends Sponsor {
|
|
|
32
32
|
getTokenWhitelisted(sponsor: Address, token: string, options?: EnvOption): Promise<boolean>;
|
|
33
33
|
setTokenToWhitelistMode(): Promise<TransactionParams>;
|
|
34
34
|
batchWhitelistTokens(tokens: string[], modes: boolean[], options?: EnvOption): Promise<TransactionParams>;
|
|
35
|
-
getTokenListMode(sponsor: Address, options?: EnvOption): Promise<
|
|
35
|
+
getTokenListMode(sponsor: Address, options?: EnvOption): Promise<unknown>;
|
|
36
36
|
getTokenBlacklisted(sponsor: Address, token: string, options?: EnvOption): Promise<boolean>;
|
|
37
37
|
setTokenToBlacklistMode(): Promise<TransactionParams>;
|
|
38
38
|
batchBlacklistTokens(tokens: string[], modes: boolean[], options?: EnvOption): Promise<TransactionParams>;
|
|
39
|
-
static getPaymasterAddress(options?: EnvOption): Promise<Address>;
|
|
40
39
|
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { type PartialAttemptOptions } from '@lifeomic/attempt';
|
|
2
|
-
export declare const DEFAULT_RETRY_OPTIONS:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
factor: number;
|
|
7
|
-
maxAttempts: number;
|
|
8
|
-
timeout: number;
|
|
9
|
-
jitter: boolean;
|
|
10
|
-
minDelay: number;
|
|
11
|
-
handleError: (err: any, context: any) => void;
|
|
12
|
-
handleTimeout: null;
|
|
13
|
-
beforeAttempt: null;
|
|
14
|
-
calculateDelay: null;
|
|
15
|
-
};
|
|
16
|
-
export declare const sendRequest: (uri: string, method: string, apiKey: string, body?: object, retryOptions?: PartialAttemptOptions<any>) => Promise<any>;
|
|
17
|
-
export declare function sendGetRequest(uri: string, endpoint: string, apiKey?: string, retryOptions?: PartialAttemptOptions<any>): Promise<any>;
|
|
18
|
-
export declare function sendPostRequest(uri: string, endpoint: string, body: object, apiKey?: string, retryOptions?: PartialAttemptOptions<any>): Promise<any>;
|
|
2
|
+
export declare const DEFAULT_RETRY_OPTIONS: PartialAttemptOptions<any>;
|
|
3
|
+
export declare const sendRequest: <Response>(uri: string, method: string, apiKey: string, body?: object, retryOptions?: PartialAttemptOptions<Response>) => Promise<Response>;
|
|
4
|
+
export declare function sendGetRequest<Response>(uri: string, endpoint: string, apiKey?: string, retryOptions?: PartialAttemptOptions<Response>): Promise<Response>;
|
|
5
|
+
export declare function sendPostRequest<Response>(uri: string, endpoint: string, body: object, apiKey?: string, retryOptions?: PartialAttemptOptions<Response>): Promise<Response>;
|
|
19
6
|
export declare function sendDeleteRequest(uri: string, endpoint: string, apiKey?: string): Promise<void>;
|
|
20
7
|
export declare function sendPutRequest(uri: string, endpoint: string, body: object, apiKey?: string): Promise<void>;
|
|
@@ -7,7 +7,7 @@ export declare const isAddress: (address: string) => boolean;
|
|
|
7
7
|
export declare const fundWallet: (auth: Auth, wallet: FunWallet, value: number, txOptions?: EnvOption) => Promise<import("viem").TransactionReceipt>;
|
|
8
8
|
export declare const isContract: (address: Address, client: PublicClient) => Promise<boolean>;
|
|
9
9
|
export declare const randomBytes: (length: number) => `0x${string}`;
|
|
10
|
-
export declare const getWalletPermitNonce: (walletAddr: Address, chain: Chain, nonceKey?: number) => Promise<
|
|
10
|
+
export declare const getWalletPermitNonce: (walletAddr: Address, chain: Chain, nonceKey?: number) => Promise<bigint>;
|
|
11
11
|
export declare const getPermitHash: (token: Address, to: Address, amount: bigint, nonce: bigint, walletAddr: Address, chainId: bigint) => `0x${string}`;
|
|
12
12
|
export declare const getGasStation: (gasStationUrl: string) => Promise<{
|
|
13
13
|
standard: {
|
|
@@ -6,7 +6,7 @@ export declare const getParent: (index: number) => number;
|
|
|
6
6
|
export declare const getSibling: (index: number) => number;
|
|
7
7
|
export declare const getHash: (list: Hex[], i: number) => Hex;
|
|
8
8
|
export declare const getHashPair: (left: Hex, right: Hex) => Hex;
|
|
9
|
-
export declare const arrayCopy: (arr:
|
|
9
|
+
export declare const arrayCopy: <T>(arr: T[], copy: T[], start: number) => void;
|
|
10
10
|
export declare const getPathForItem: (list: Hex[], item: Hex) => `0x${string}`[];
|
|
11
11
|
export declare const verifyPath: (root: Hex, item: Hex, path: Hex[]) => boolean;
|
|
12
12
|
export declare class MerkleTree {
|
|
@@ -2,12 +2,10 @@ import { type Hex } from 'viem';
|
|
|
2
2
|
import type { UserOperation } from '@funkit/api-base';
|
|
3
3
|
import type { Chain } from '../data';
|
|
4
4
|
export declare const calcPreVerificationGas: (userOp: UserOperation) => bigint;
|
|
5
|
-
export declare const getPromiseFromOp: (op: UserOperation) => Promise<any>;
|
|
6
5
|
export declare function gasCalculation(txid: string, chain: Chain): Promise<{
|
|
7
6
|
gasUsed: string;
|
|
8
7
|
opFee: string;
|
|
9
8
|
opFeeUSD: string;
|
|
10
9
|
}>;
|
|
11
|
-
export declare const stringify: (object:
|
|
12
|
-
export declare const objectify: (op: any) => any;
|
|
10
|
+
export declare const stringify: (object: unknown) => string;
|
|
13
11
|
export declare function getOpHash(chain: Chain, userOp: UserOperation): Promise<Hex>;
|
|
@@ -6,4 +6,6 @@ export declare function formatAbiItem(abiItem: AbiItem, { includeName }?: {
|
|
|
6
6
|
export declare function formatAbiParams(params: readonly AbiParameter[] | undefined, { includeName }?: {
|
|
7
7
|
includeName?: boolean;
|
|
8
8
|
}): string;
|
|
9
|
-
export declare const getSigHash: (abi:
|
|
9
|
+
export declare const getSigHash: (abi: ReadonlyArray<{
|
|
10
|
+
name?: string;
|
|
11
|
+
}>, functionName: string) => `0x${string}`;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AbiError } from 'abitype';
|
|
2
|
+
import { type AbiEvent, type AbiFunction, type Address, type Hex, type Log, type PublicClient } from 'viem';
|
|
2
3
|
import type { TransactionParams } from '../common';
|
|
3
4
|
import { Chain } from '../data';
|
|
4
5
|
type ChainReadCall = {
|
|
5
6
|
functionName: string;
|
|
6
|
-
args?:
|
|
7
|
+
args?: unknown[];
|
|
7
8
|
};
|
|
8
9
|
export declare class ContractInterface {
|
|
9
|
-
abi:
|
|
10
|
-
constructor(abi: any);
|
|
11
|
-
readFromChain(address: Address, functionName: string, args:
|
|
12
|
-
batchReadFromChain(address: Address, chainOrClient: Chain | PublicClient, calls: ChainReadCall[]): Promise<
|
|
13
|
-
encodeTransactionParams(address: Address, functionName: string, args:
|
|
14
|
-
encodeData(functionName: string, args:
|
|
15
|
-
createFilter(address: Address, eventName:
|
|
16
|
-
getLog(address: Address, name: string, args:
|
|
10
|
+
abi: ReadonlyArray<AbiError | AbiEvent | AbiFunction>;
|
|
11
|
+
constructor(abi: ReadonlyArray<any>);
|
|
12
|
+
readFromChain<T>(address: Address, functionName: string, args: unknown[], chainOrClient: Chain | PublicClient): Promise<T>;
|
|
13
|
+
batchReadFromChain<T extends unknown[]>(address: Address, chainOrClient: Chain | PublicClient, calls: ChainReadCall[]): Promise<T>;
|
|
14
|
+
encodeTransactionParams(address: Address, functionName: string, args: unknown[], value?: bigint): TransactionParams;
|
|
15
|
+
encodeData(functionName: string, args: unknown[]): Hex;
|
|
16
|
+
createFilter(address: Address, eventName: string, args: unknown[], chainOrClient: PublicClient | Chain, fromBlock: bigint): Promise<import("viem").CreateContractEventFilterReturnType<readonly (AbiEvent | AbiFunction | AbiError)[], string, unknown[], undefined, bigint, undefined>>;
|
|
17
|
+
getLog(address: Address, name: string, args: ReadonlyArray<unknown> | Record<string, unknown> | undefined, chainOrClient: PublicClient | Chain, fromBlock: bigint): Promise<Log[]>;
|
|
17
18
|
}
|
|
18
19
|
export declare const parseClient: (chainOrClient: PublicClient | Chain) => Promise<PublicClient>;
|
|
19
20
|
export {};
|
|
@@ -36,7 +36,7 @@ export declare class FunWallet extends FirstClassActions {
|
|
|
36
36
|
* @param {Address} factoryAddress - The address of the factory contract.
|
|
37
37
|
* @returns {Promise<Address>} The wallet address.
|
|
38
38
|
*/
|
|
39
|
-
static getAddressOffline(uniqueId: string, rpcUrl: string, factoryAddress: Address): Promise<
|
|
39
|
+
static getAddressOffline(uniqueId: string, rpcUrl: string, factoryAddress: Address): Promise<unknown>;
|
|
40
40
|
/**
|
|
41
41
|
* Get all tokens for a specific chain
|
|
42
42
|
* @param {string} chainId string version of the chainId or ALL. If empty, then default to the one in globalEnvOption
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
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",
|
|
@@ -19,10 +19,12 @@
|
|
|
19
19
|
"dotenv": "^16.0.3",
|
|
20
20
|
"ethers": "5.7.2",
|
|
21
21
|
"uuid": "^9.0.0",
|
|
22
|
-
"
|
|
23
|
-
"@funkit/
|
|
24
|
-
"@funkit/chains": "0.1.
|
|
25
|
-
|
|
22
|
+
"@funkit/api-base": "1.5.3",
|
|
23
|
+
"@funkit/utils": "1.0.5",
|
|
24
|
+
"@funkit/chains": "0.1.2"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"viem": "2.x"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@types/uuid": "^9.0.1",
|