@funkit/api-base 1.5.0 → 1.5.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.js +328 -26
- package/dist/index.js.map +4 -4
- package/dist/src/consts/customers.d.ts +4 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/consts/retry.d.ts +2 -2
- package/dist/src/services/assets/endpoints.d.ts +8 -1
- package/dist/src/services/assets/types.d.ts +11 -0
- package/dist/src/services/faucet/endpoints.d.ts +1 -1
- package/dist/src/services/fw-info/endpoints.d.ts +3 -0
- package/dist/src/services/fw-info/index.d.ts +2 -0
- package/dist/src/services/fw-info/types.d.ts +21 -0
- package/dist/src/services/fw-operation/endpoints.d.ts +11 -0
- package/dist/src/services/fw-operation/index.d.ts +2 -0
- package/dist/src/services/fw-operation/types.d.ts +149 -0
- package/dist/src/services/fw-paymaster/types.d.ts +2 -1
- package/dist/src/services/fw-user/endpoints.d.ts +10 -0
- package/dist/src/services/fw-user/index.d.ts +2 -0
- package/dist/src/services/fw-user/types.d.ts +36 -0
- package/dist/src/services/index.d.ts +3 -0
- package/dist/src/services/mesh/endpoints.d.ts +3 -3
- package/dist/src/services/mesh/types.d.ts +1 -1
- package/dist/src/utils/error.d.ts +2 -1
- package/dist/src/utils/request.d.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
export declare enum OperationStatus {
|
|
3
|
+
ALL = "",
|
|
4
|
+
PENDING_APPROVED = "PENDING_APPROVED",
|
|
5
|
+
APPROVED = "APPROVED",
|
|
6
|
+
PENDING = "PENDING",
|
|
7
|
+
OP_SUCCEED = "OP_SUCCEED",
|
|
8
|
+
OP_REVERTED = "OP_REVERTED",
|
|
9
|
+
SCHEDULED = "SCHEDULED"
|
|
10
|
+
}
|
|
11
|
+
export type OperationMetadata = {
|
|
12
|
+
opId?: Hex;
|
|
13
|
+
chainId: string;
|
|
14
|
+
opType: OperationType;
|
|
15
|
+
authType: AuthType;
|
|
16
|
+
groupId?: Hex;
|
|
17
|
+
message?: string;
|
|
18
|
+
walletAddr: Address;
|
|
19
|
+
status?: OperationStatus;
|
|
20
|
+
proposer: string;
|
|
21
|
+
proposedTime?: number;
|
|
22
|
+
executedBy?: string;
|
|
23
|
+
executedTime?: number;
|
|
24
|
+
relatedOpIds?: Hex[];
|
|
25
|
+
signatures?: Signature[];
|
|
26
|
+
txid?: string;
|
|
27
|
+
gasUsed?: string;
|
|
28
|
+
opFeeUSD?: string;
|
|
29
|
+
opFee?: string;
|
|
30
|
+
executedBlockNumber?: number;
|
|
31
|
+
executedBlockTimeStamp?: number;
|
|
32
|
+
};
|
|
33
|
+
export interface OperationData extends OperationMetadata {
|
|
34
|
+
userOp: UserOperation;
|
|
35
|
+
}
|
|
36
|
+
export declare enum AuthType {
|
|
37
|
+
ECDSA = 0,
|
|
38
|
+
MULTI_SIG = 1
|
|
39
|
+
}
|
|
40
|
+
export type Signature = {
|
|
41
|
+
userId: Hex;
|
|
42
|
+
signature: Hex;
|
|
43
|
+
signedTime: number;
|
|
44
|
+
};
|
|
45
|
+
export declare enum OperationType {
|
|
46
|
+
SINGLE_OPERATION = "SINGLE_OPERATION",
|
|
47
|
+
GROUP_OPERATION = "GROUP_OPERATION",
|
|
48
|
+
REJECTION = "REJECTION"
|
|
49
|
+
}
|
|
50
|
+
export type GroupInfo = {
|
|
51
|
+
threshold: number;
|
|
52
|
+
memberIds: Hex[];
|
|
53
|
+
};
|
|
54
|
+
export type UserOperation = {
|
|
55
|
+
sender: string;
|
|
56
|
+
nonce: bigint;
|
|
57
|
+
initCode?: string;
|
|
58
|
+
callData: string;
|
|
59
|
+
callGasLimit: bigint;
|
|
60
|
+
verificationGasLimit: bigint;
|
|
61
|
+
preVerificationGas?: bigint;
|
|
62
|
+
maxFeePerGas: bigint;
|
|
63
|
+
maxPriorityFeePerGas: bigint;
|
|
64
|
+
paymasterAndData?: string;
|
|
65
|
+
signature?: string;
|
|
66
|
+
};
|
|
67
|
+
export interface ExecutionReceipt {
|
|
68
|
+
userOpHash: string;
|
|
69
|
+
txId?: Hex;
|
|
70
|
+
gasUsed?: string;
|
|
71
|
+
opFeeUSD?: string;
|
|
72
|
+
opFee?: string;
|
|
73
|
+
}
|
|
74
|
+
export type EstimatedGas = {
|
|
75
|
+
preVerificationGas: bigint;
|
|
76
|
+
callGasLimit: bigint;
|
|
77
|
+
verificationGasLimit: bigint;
|
|
78
|
+
};
|
|
79
|
+
export interface CreateOpRequest {
|
|
80
|
+
op: OperationData;
|
|
81
|
+
apiKey: string;
|
|
82
|
+
}
|
|
83
|
+
export interface GetOpsOfWalletRequest {
|
|
84
|
+
walletAddr: Address;
|
|
85
|
+
chainId: string;
|
|
86
|
+
apiKey: string;
|
|
87
|
+
status?: OperationStatus;
|
|
88
|
+
}
|
|
89
|
+
export interface GetOpsRequest {
|
|
90
|
+
opIds: Hex[];
|
|
91
|
+
chainId: string;
|
|
92
|
+
apiKey: string;
|
|
93
|
+
}
|
|
94
|
+
export interface DeleteOpRequest {
|
|
95
|
+
opId: Hex;
|
|
96
|
+
chainId: string;
|
|
97
|
+
apiKey: string;
|
|
98
|
+
}
|
|
99
|
+
export interface SignOpRequest {
|
|
100
|
+
opId: Hex;
|
|
101
|
+
chainId: string;
|
|
102
|
+
signature: Hex;
|
|
103
|
+
signedBy: Address;
|
|
104
|
+
apiKey: string;
|
|
105
|
+
threshold?: number;
|
|
106
|
+
}
|
|
107
|
+
export type OpRequest<T> = {
|
|
108
|
+
input: T;
|
|
109
|
+
apiKey: string;
|
|
110
|
+
};
|
|
111
|
+
export type ExecuteOpInput = {
|
|
112
|
+
opId: Hex;
|
|
113
|
+
chainId: string;
|
|
114
|
+
executedBy: string;
|
|
115
|
+
entryPointAddress: Address;
|
|
116
|
+
signature: Hex;
|
|
117
|
+
userOp?: UserOperation;
|
|
118
|
+
groupInfo?: GroupInfo;
|
|
119
|
+
};
|
|
120
|
+
export type EstimateOpInput = {
|
|
121
|
+
opId?: Hex;
|
|
122
|
+
chainId: string;
|
|
123
|
+
entryPointAddress?: Address;
|
|
124
|
+
signature?: Hex;
|
|
125
|
+
userOp?: UserOperation;
|
|
126
|
+
};
|
|
127
|
+
export type ScheduleOpInput = {
|
|
128
|
+
opId: Hex;
|
|
129
|
+
chainId: string;
|
|
130
|
+
scheduledBy: string;
|
|
131
|
+
entryPointAddress: Address;
|
|
132
|
+
signature: Hex;
|
|
133
|
+
userOp?: UserOperation;
|
|
134
|
+
groupInfo?: GroupInfo;
|
|
135
|
+
};
|
|
136
|
+
export interface GetFullReceiptRequest {
|
|
137
|
+
opId: string;
|
|
138
|
+
chainId: string;
|
|
139
|
+
userOpHash: string;
|
|
140
|
+
apiKey: string;
|
|
141
|
+
}
|
|
142
|
+
export interface GetUserOpGasPriceRequest {
|
|
143
|
+
chainId: string;
|
|
144
|
+
apiKey: string;
|
|
145
|
+
}
|
|
146
|
+
export type UserOperationGasPrice = {
|
|
147
|
+
maxFeePerGas: bigint;
|
|
148
|
+
maxPriorityFeePerGas: bigint;
|
|
149
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExecutionReceipt } from '../fw-operation';
|
|
1
2
|
export interface PaymasterTransaction {
|
|
2
3
|
action: string;
|
|
3
4
|
amount: number;
|
|
@@ -9,7 +10,7 @@ export interface PaymasterTransaction {
|
|
|
9
10
|
export interface AddPaymasterTransactionRequest {
|
|
10
11
|
chainId: string;
|
|
11
12
|
timestamp: number;
|
|
12
|
-
txid:
|
|
13
|
+
txid: ExecutionReceipt['txId'] | string;
|
|
13
14
|
transaction: PaymasterTransaction;
|
|
14
15
|
paymasterType: PaymasterType;
|
|
15
16
|
sponsorAddress: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { AddUserToWalletRequest, CreateUserRequest, GetUserUniqueIdRequest, GetUserWalletIdentitiesRequest, GetUserWalletsByAddrRequest, Wallet } from './types';
|
|
3
|
+
export declare function createUser({ authId, addr, method, userUniqueId, apiKey, }: CreateUserRequest): Promise<void>;
|
|
4
|
+
export declare function getUserUniqueId({ authId, apiKey, }: GetUserUniqueIdRequest): Promise<string>;
|
|
5
|
+
export declare function getUserWalletsByAddr({ addr, apiKey, chainId, }: GetUserWalletsByAddrRequest): Promise<Wallet[]>;
|
|
6
|
+
export declare function addUserToWallet({ authId, chainId, walletAddr, userIds, apiKey, walletUniqueId, }: AddUserToWalletRequest): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* @returns userIds of the specified Wallet.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getUserWalletIdentities({ authId, chainId, walletAddr, apiKey, }: GetUserWalletIdentitiesRequest): Promise<Hex[]>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
export type Wallet = {
|
|
3
|
+
walletUniqueId?: string;
|
|
4
|
+
walletAddr: Address;
|
|
5
|
+
userIds: Hex[];
|
|
6
|
+
};
|
|
7
|
+
export interface CreateUserRequest {
|
|
8
|
+
authId: string;
|
|
9
|
+
addr: string;
|
|
10
|
+
method: string;
|
|
11
|
+
userUniqueId: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GetUserUniqueIdRequest {
|
|
15
|
+
authId: string;
|
|
16
|
+
apiKey: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GetUserWalletsByAddrRequest {
|
|
19
|
+
addr: string;
|
|
20
|
+
apiKey: string;
|
|
21
|
+
chainId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AddUserToWalletRequest {
|
|
24
|
+
authId: string;
|
|
25
|
+
chainId: string;
|
|
26
|
+
walletAddr: Address;
|
|
27
|
+
userIds: Hex[];
|
|
28
|
+
apiKey: string;
|
|
29
|
+
walletUniqueId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GetUserWalletIdentitiesRequest {
|
|
32
|
+
authId: string;
|
|
33
|
+
chainId: string;
|
|
34
|
+
walletAddr: Address;
|
|
35
|
+
apiKey: string;
|
|
36
|
+
}
|
|
@@ -3,7 +3,10 @@ export * from './checkout';
|
|
|
3
3
|
export * from './faucet';
|
|
4
4
|
export * from './fw-access';
|
|
5
5
|
export * from './fw-group';
|
|
6
|
+
export * from './fw-info';
|
|
7
|
+
export * from './fw-operation';
|
|
6
8
|
export * from './fw-paymaster';
|
|
9
|
+
export * from './fw-user';
|
|
7
10
|
export * from './mesh';
|
|
8
11
|
export * from './moonpay';
|
|
9
12
|
export * from './stripe';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { GetCryptocurrencyHoldingsRequest, GetCryptocurrencyHoldingsRequestProxy, GetLinkTokenRequest, GetLinkTokenResponse, GetTransferIntegrationsRequest, GetTransferIntegrationsResponse, MeshExecuteTransferRequest, MeshExecuteTransferRequestProxy, MeshExecuteTransferResponse, PreviewTransferRequest, PreviewTransferRequestProxy, PreviewTransferResponse } from './types';
|
|
1
|
+
import type { GetCryptocurrencyHoldingsRequest, GetCryptocurrencyHoldingsRequestProxy, GetCryptocurrencyHoldingsResponse, GetLinkTokenRequest, GetLinkTokenResponse, GetTransferIntegrationsRequest, GetTransferIntegrationsResponse, MeshExecuteTransferRequest, MeshExecuteTransferRequestProxy, MeshExecuteTransferResponse, PreviewTransferRequest, PreviewTransferRequestProxy, PreviewTransferResponse } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* @param authToken The authentication token to send the asset from.
|
|
4
4
|
* @param type The type of the integration to send the asset from.
|
|
5
5
|
* @return https://docs.meshconnect.com/api-reference/portfolio/get-holdings
|
|
6
6
|
*/
|
|
7
|
-
export declare function meshGetCryptocurrencyHoldings({ authToken, type, apiKey, }: GetCryptocurrencyHoldingsRequest): Promise<
|
|
8
|
-
export declare function meshGetCryptocurrencyHoldingsProxy({ apiKey, ...props }: GetCryptocurrencyHoldingsRequestProxy): Promise<
|
|
7
|
+
export declare function meshGetCryptocurrencyHoldings({ authToken, type, apiKey, }: GetCryptocurrencyHoldingsRequest): Promise<GetCryptocurrencyHoldingsResponse>;
|
|
8
|
+
export declare function meshGetCryptocurrencyHoldingsProxy({ apiKey, ...props }: GetCryptocurrencyHoldingsRequestProxy): Promise<GetCryptocurrencyHoldingsResponse>;
|
|
9
9
|
/**
|
|
10
10
|
* @return https://docs.meshconnect.com/api-reference/managed-transfers/get-integrations
|
|
11
11
|
*/
|
|
@@ -31,7 +31,7 @@ export interface GetLinkTokenRequest {
|
|
|
31
31
|
userId: string;
|
|
32
32
|
integrationId?: string | null;
|
|
33
33
|
restrictMultipleAccounts?: boolean;
|
|
34
|
-
transferOptions?:
|
|
34
|
+
transferOptions?: Record<string, unknown> | null;
|
|
35
35
|
apiKey: string;
|
|
36
36
|
}
|
|
37
37
|
export interface GetLinkTokenResponse {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AttemptContext } from '@lifeomic/attempt';
|
|
2
|
+
export declare const errorAbortHandler: (err: Error, context: AttemptContext) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BaseRequest } from '../consts/request';
|
|
2
2
|
import { type BaseResponse } from '../consts/retry';
|
|
3
3
|
import type { DeleteRequest, GetRequest, PostRequest, PutRequest } from './../consts/request';
|
|
4
|
-
export declare
|
|
5
|
-
export declare function sendGetRequest({ uri, apiKey, retryOptions, signal, }: GetRequest): Promise<
|
|
6
|
-
export declare function sendPostRequest({ uri, body, apiKey, retryOptions, signal, }: PostRequest): Promise<
|
|
4
|
+
export declare function sendRequest<T = BaseResponse>({ uri, method, apiKey, body, retryOptions, signal, }: BaseRequest): Promise<T>;
|
|
5
|
+
export declare function sendGetRequest<T = BaseResponse>({ uri, apiKey, retryOptions, signal, }: GetRequest): Promise<T>;
|
|
6
|
+
export declare function sendPostRequest<T = BaseResponse>({ uri, body, apiKey, retryOptions, signal, }: PostRequest): Promise<T>;
|
|
7
7
|
export declare function sendDeleteRequest({ uri, apiKey, retryOptions, signal, }: DeleteRequest): Promise<void>;
|
|
8
8
|
export declare function sendPutRequest({ uri, body, apiKey, retryOptions, signal, }: PutRequest): Promise<BaseResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/api-base",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Base API for Funkit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@lifeomic/attempt": "^3.1.0",
|
|
13
13
|
"big.js": "^6.2.1",
|
|
14
|
-
"@funkit/utils": "1.0.
|
|
14
|
+
"@funkit/utils": "1.0.4"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/big.js": "^6.2.2",
|