@funkit/api-base 1.4.1 → 1.5.0
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 +20 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +242 -1004
- package/dist/index.js.map +4 -4
- package/dist/src/consts/api.d.ts +1 -0
- package/dist/src/services/assets/endpoints.d.ts +12 -5
- package/dist/src/services/assets/types.d.ts +12 -0
- package/dist/src/services/checkout/types.d.ts +4 -3
- package/dist/src/services/fw-access/endpoints.d.ts +3 -0
- package/dist/src/services/fw-access/index.d.ts +2 -0
- package/dist/src/services/fw-access/types.d.ts +10 -0
- package/dist/src/services/fw-group/endpoints.d.ts +2 -0
- package/dist/src/services/fw-group/index.d.ts +2 -0
- package/dist/src/services/fw-group/types.d.ts +13 -0
- package/dist/src/services/fw-paymaster/endpoints.d.ts +2 -0
- package/dist/src/services/fw-paymaster/index.d.ts +2 -0
- package/dist/src/services/fw-paymaster/types.d.ts +23 -0
- package/dist/src/services/index.d.ts +3 -0
- package/dist/src/services/mesh/endpoints.d.ts +34 -1
- package/dist/src/services/mesh/types.d.ts +15 -0
- package/dist/src/services/moonpay/endpoints.d.ts +1 -9
- package/dist/src/services/moonpay/types.d.ts +0 -33
- package/package.json +4 -3
- package/dist/src/errors/BaseError.d.ts +0 -10
- package/dist/src/errors/ClientError.d.ts +0 -19
- package/dist/src/errors/ServerError.d.ts +0 -7
- package/dist/src/errors/index.d.ts +0 -4
- package/dist/src/errors/types.d.ts +0 -60
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
export type GroupMetadata = {
|
|
3
|
+
groupId: Hex;
|
|
4
|
+
chainId: string;
|
|
5
|
+
threshold: number;
|
|
6
|
+
walletAddr: Address;
|
|
7
|
+
memberIds: Hex[];
|
|
8
|
+
};
|
|
9
|
+
export interface GetGroupsRequest {
|
|
10
|
+
groupIds: Hex[];
|
|
11
|
+
chainId: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface PaymasterTransaction {
|
|
2
|
+
action: string;
|
|
3
|
+
amount: number;
|
|
4
|
+
from: string;
|
|
5
|
+
to: string;
|
|
6
|
+
token: string;
|
|
7
|
+
txid?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AddPaymasterTransactionRequest {
|
|
10
|
+
chainId: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
txid: any;
|
|
13
|
+
transaction: PaymasterTransaction;
|
|
14
|
+
paymasterType: PaymasterType;
|
|
15
|
+
sponsorAddress: string;
|
|
16
|
+
apiKey: string;
|
|
17
|
+
}
|
|
18
|
+
export declare enum PaymasterType {
|
|
19
|
+
BaseSponsor = "base",
|
|
20
|
+
GaslessSponsor = "gasless",
|
|
21
|
+
TokenSponsor = "token",
|
|
22
|
+
CheckoutSponsor = "checkout"
|
|
23
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { GetCryptocurrencyHoldingsRequest, GetLinkTokenRequest, GetLinkTokenResponse, GetTransferIntegrationsRequest, GetTransferIntegrationsResponse, MeshExecuteTransferRequest, MeshExecuteTransferResponse, PreviewTransferRequest, PreviewTransferResponse } from './types';
|
|
1
|
+
import type { GetCryptocurrencyHoldingsRequest, GetCryptocurrencyHoldingsRequestProxy, 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
7
|
export declare function meshGetCryptocurrencyHoldings({ authToken, type, apiKey, }: GetCryptocurrencyHoldingsRequest): Promise<any>;
|
|
8
|
+
export declare function meshGetCryptocurrencyHoldingsProxy({ apiKey, ...props }: GetCryptocurrencyHoldingsRequestProxy): Promise<any>;
|
|
8
9
|
/**
|
|
9
10
|
* @return https://docs.meshconnect.com/api-reference/managed-transfers/get-integrations
|
|
10
11
|
*/
|
|
@@ -34,6 +35,7 @@ export declare function meshGetLinkToken({ userId, integrationId, restrictMultip
|
|
|
34
35
|
* @returns https://docs.meshconnect.com/api-reference/managed-transfers/preview-transfer
|
|
35
36
|
*/
|
|
36
37
|
export declare function meshPreviewTransfer({ fromAuthToken, fromType, toAuthToken, toType, networkId, symbol, toAddress, amount, amountInFiat, fiatCurrency, apiKey, }: PreviewTransferRequest): Promise<PreviewTransferResponse>;
|
|
38
|
+
export declare function meshPreviewTransferProxy({ apiKey, ...props }: PreviewTransferRequestProxy): Promise<PreviewTransferResponse>;
|
|
37
39
|
/**
|
|
38
40
|
*
|
|
39
41
|
* @param fromAuthToken The authentication token to send the asset from.
|
|
@@ -43,3 +45,34 @@ export declare function meshPreviewTransfer({ fromAuthToken, fromType, toAuthTok
|
|
|
43
45
|
* @returns https://docs.meshconnect.com/api-reference/managed-transfers/execute-transfer
|
|
44
46
|
*/
|
|
45
47
|
export declare function meshExecuteTransfer({ fromAuthToken, fromType, previewId, mfaCode, apiKey, }: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse>;
|
|
48
|
+
export declare function meshExecuteTransferProxy({ apiKey, ...props }: MeshExecuteTransferRequestProxy): Promise<MeshExecuteTransferResponse>;
|
|
49
|
+
interface SaveTokensToMeshProxyRequestBody {
|
|
50
|
+
deviceId?: string | null;
|
|
51
|
+
brokerType: string;
|
|
52
|
+
accessToken: string;
|
|
53
|
+
refreshToken: string | null;
|
|
54
|
+
accessTokenExpiresIn: number;
|
|
55
|
+
accessTokenExpiresAt: string;
|
|
56
|
+
refreshTokenExpiresAt?: string | null;
|
|
57
|
+
apiKey: string;
|
|
58
|
+
}
|
|
59
|
+
interface SaveTokensToMeshProxyResponseBody {
|
|
60
|
+
id: number;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
deviceId: string;
|
|
64
|
+
integrationId: string;
|
|
65
|
+
accessToken: string;
|
|
66
|
+
accessTokenExpiresAt: Date | null;
|
|
67
|
+
accessTokenExpiresIn: number | null;
|
|
68
|
+
refreshToken: string | null;
|
|
69
|
+
refreshTokenExpiresAt: Date | null;
|
|
70
|
+
}
|
|
71
|
+
export declare function saveTokensToMeshProxy({ apiKey, ...props }: SaveTokensToMeshProxyRequestBody): Promise<SaveTokensToMeshProxyResponseBody>;
|
|
72
|
+
interface RemoveTokensFromMeshProxyRequestBody {
|
|
73
|
+
deviceId: string;
|
|
74
|
+
brokerType: string;
|
|
75
|
+
apiKey: string;
|
|
76
|
+
}
|
|
77
|
+
export declare function removeTokensFromMeshProxy({ apiKey, ...props }: RemoveTokensFromMeshProxyRequestBody): Promise<void>;
|
|
78
|
+
export {};
|
|
@@ -3,6 +3,10 @@ export interface GetCryptocurrencyHoldingsRequest {
|
|
|
3
3
|
type: string;
|
|
4
4
|
apiKey: string;
|
|
5
5
|
}
|
|
6
|
+
export interface GetCryptocurrencyHoldingsRequestProxy extends Omit<GetCryptocurrencyHoldingsRequest, 'authToken' | 'type'> {
|
|
7
|
+
deviceId: string;
|
|
8
|
+
brokerType: string;
|
|
9
|
+
}
|
|
6
10
|
export interface GetTransferIntegrationsRequest {
|
|
7
11
|
apiKey: string;
|
|
8
12
|
}
|
|
@@ -46,6 +50,10 @@ export interface PreviewTransferRequest {
|
|
|
46
50
|
amountInFiat?: string | null;
|
|
47
51
|
fiatCurrency?: string | null;
|
|
48
52
|
}
|
|
53
|
+
export interface PreviewTransferRequestProxy extends Omit<PreviewTransferRequest, 'fromAuthToken' | 'fromType'> {
|
|
54
|
+
deviceId: string;
|
|
55
|
+
brokerType: string;
|
|
56
|
+
}
|
|
49
57
|
export interface MeshExecuteTransferRequest {
|
|
50
58
|
apiKey: string;
|
|
51
59
|
fromAuthToken: string;
|
|
@@ -53,6 +61,10 @@ export interface MeshExecuteTransferRequest {
|
|
|
53
61
|
previewId: string;
|
|
54
62
|
mfaCode?: string | null;
|
|
55
63
|
}
|
|
64
|
+
export interface MeshExecuteTransferRequestProxy extends Omit<MeshExecuteTransferRequest, 'fromAuthToken' | 'fromType'> {
|
|
65
|
+
deviceId: string;
|
|
66
|
+
brokerType: string;
|
|
67
|
+
}
|
|
56
68
|
export declare enum MeshExecuteTransferStatus {
|
|
57
69
|
succeeded = "succeeded",
|
|
58
70
|
failed = "failed",
|
|
@@ -89,6 +101,9 @@ export interface MeshCryptoCurrencyPosition {
|
|
|
89
101
|
export interface GetCryptocurrencyHoldingsResponse {
|
|
90
102
|
cryptocurrencyPositions: MeshCryptoCurrencyPosition[];
|
|
91
103
|
}
|
|
104
|
+
export interface MeshProxyUnauthorizedResponse {
|
|
105
|
+
error: string;
|
|
106
|
+
}
|
|
92
107
|
export interface PreviewTransferResponse {
|
|
93
108
|
/** The status of the operation. */
|
|
94
109
|
status: 'succeeded' | 'failed' | 'requiresFunding';
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import type { GetMoonpayBuyQuoteForCreditCardRequest, GetMoonpayBuyQuoteForCreditCardResponse,
|
|
1
|
+
import type { GetMoonpayBuyQuoteForCreditCardRequest, GetMoonpayBuyQuoteForCreditCardResponse, GetMoonpayUrlSignatureRequest } from './types';
|
|
2
2
|
export declare function getMoonpayUrlSignature({ url, isSandbox, apiKey, }: GetMoonpayUrlSignatureRequest): Promise<string>;
|
|
3
3
|
export declare function getMoonpayBuyQuoteForCreditCard({ currencyCode, baseCurrencyCode, quoteCurrencyAmount, baseCurrencyAmount, extraFeePercentage, areFeesIncluded, apiKey, }: GetMoonpayBuyQuoteForCreditCardRequest): Promise<GetMoonpayBuyQuoteForCreditCardResponse>;
|
|
4
|
-
/**=======================
|
|
5
|
-
* POTENTIAL DEPRECATION
|
|
6
|
-
*=======================*/
|
|
7
|
-
export declare function getMoonpayOnRampUrl({ apiKey, walletAddr, currencyCode, }: GetMoonpayOnRampUrlRequest): Promise<string>;
|
|
8
|
-
export declare function getMoonpayOffRampUrl({ walletAddr, apiKey, }: GetMoonpayOffRampUrlRequest): Promise<string>;
|
|
9
|
-
export declare function getMoonpayOnRampSupportedCurrencies({ apiKey, }: {
|
|
10
|
-
apiKey: string;
|
|
11
|
-
}): Promise<MoonpayCurrency[]>;
|
|
@@ -12,39 +12,6 @@ export interface GetMoonpayBuyQuoteForCreditCardRequest {
|
|
|
12
12
|
extraFeePercentage?: number;
|
|
13
13
|
areFeesIncluded?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export interface GetMoonpayOnRampUrlRequest {
|
|
16
|
-
apiKey: string;
|
|
17
|
-
walletAddr: string;
|
|
18
|
-
currencyCode?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface GetMoonpayOffRampUrlRequest {
|
|
21
|
-
apiKey: string;
|
|
22
|
-
walletAddr: string;
|
|
23
|
-
}
|
|
24
|
-
export interface MoonpayCurrency {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
code: string;
|
|
28
|
-
createdAt?: string;
|
|
29
|
-
updatedAt?: string;
|
|
30
|
-
type?: string;
|
|
31
|
-
precision?: number;
|
|
32
|
-
addressRegex?: string;
|
|
33
|
-
testnetAddressRegex?: string;
|
|
34
|
-
maxAmount?: number;
|
|
35
|
-
maxBuyAmount?: number;
|
|
36
|
-
maxSellAmount?: number;
|
|
37
|
-
minAmount?: number;
|
|
38
|
-
minBuyAmount?: number;
|
|
39
|
-
minSellAmount?: number;
|
|
40
|
-
supportsAddressTag?: boolean;
|
|
41
|
-
addressTagRegex?: string;
|
|
42
|
-
supportsTestMode?: boolean;
|
|
43
|
-
isSuspended?: boolean;
|
|
44
|
-
isSupportedInUS?: boolean;
|
|
45
|
-
isSellSupported?: boolean;
|
|
46
|
-
notAllowedUSStates?: string[];
|
|
47
|
-
}
|
|
48
15
|
export interface GetMoonpayBuyQuoteForCreditCardResponse {
|
|
49
16
|
accountId: string;
|
|
50
17
|
baseCurrencyAmount: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/api-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Base API for Funkit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@lifeomic/attempt": "^3.1.0",
|
|
13
|
-
"big.js": "^6.2.1"
|
|
13
|
+
"big.js": "^6.2.1",
|
|
14
|
+
"@funkit/utils": "1.0.3"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"
|
|
17
|
+
"@types/big.js": "^6.2.2",
|
|
17
18
|
"typescript": "^5.4.3",
|
|
18
19
|
"vitest": "^2.0.5"
|
|
19
20
|
},
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class BaseError extends Error {
|
|
2
|
-
baseType: string;
|
|
3
|
-
type: string;
|
|
4
|
-
code: string;
|
|
5
|
-
rawMessage: string;
|
|
6
|
-
paramsUsed: any;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
constructor(baseType: string, type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string, isInternal?: boolean);
|
|
9
|
-
loadEnd(): void;
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BaseError } from './BaseError';
|
|
2
|
-
export declare class ClientError extends BaseError {
|
|
3
|
-
constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
4
|
-
}
|
|
5
|
-
export declare class InvalidParameterError extends ClientError {
|
|
6
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
7
|
-
}
|
|
8
|
-
export declare class ResourceNotFoundError extends ClientError {
|
|
9
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
10
|
-
}
|
|
11
|
-
export declare class ThrottlingError extends ClientError {
|
|
12
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
13
|
-
}
|
|
14
|
-
export declare class AccessDeniedError extends ClientError {
|
|
15
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
16
|
-
}
|
|
17
|
-
export declare class UserOpFailureError extends ClientError {
|
|
18
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseError } from './BaseError';
|
|
2
|
-
export declare class ServerError extends BaseError {
|
|
3
|
-
constructor(type: string, code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
4
|
-
}
|
|
5
|
-
export declare class InternalFailureError extends ServerError {
|
|
6
|
-
constructor(code: string, msg: string, rawMessage: string, paramsUsed: any, fixSuggestion: string, docLink: string);
|
|
7
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export type ErrorData = {
|
|
2
|
-
location: string;
|
|
3
|
-
error?: {
|
|
4
|
-
txDetails?: ErrorTransactionDetails;
|
|
5
|
-
reasonData?: {
|
|
6
|
-
title: string;
|
|
7
|
-
reasons: string[];
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export type ErrorTransactionDetails = {
|
|
12
|
-
method: string;
|
|
13
|
-
params: any[];
|
|
14
|
-
contractAddress?: string;
|
|
15
|
-
chainId?: number | string;
|
|
16
|
-
};
|
|
17
|
-
export declare enum ErrorBaseType {
|
|
18
|
-
ClientError = "ClientError",
|
|
19
|
-
ServerError = "ServerError"
|
|
20
|
-
}
|
|
21
|
-
export declare enum ErrorType {
|
|
22
|
-
InvalidParameter = "InvalidParameter",
|
|
23
|
-
InternalServerFailure = "InternalServerFailure",
|
|
24
|
-
ResourceNotFound = "ResourceNotFound",
|
|
25
|
-
InvalidAction = "InvalidAction",
|
|
26
|
-
ThrottlingError = "ThrottlingError",
|
|
27
|
-
AccessDeniedError = "AccessDeniedError",
|
|
28
|
-
UserOpFailureError = "UserOpFailureError"
|
|
29
|
-
}
|
|
30
|
-
export declare enum ErrorCode {
|
|
31
|
-
MissingParameter = "MissingParameter",
|
|
32
|
-
InvalidParameter = "InvalidParameter",
|
|
33
|
-
InvalidThreshold = "InvalidThreshold",
|
|
34
|
-
InvalidChainIdentifier = "InvalidChainIdentifier",
|
|
35
|
-
InvalidNFTIdentifier = "InvalidNFTIdentifier",
|
|
36
|
-
InsufficientSignatures = "InsufficientSignatures",
|
|
37
|
-
InvalidParameterCombination = "InvalidParameterCombination",
|
|
38
|
-
CheckPointHintsNotFound = "CheckPointHintsNotFound",
|
|
39
|
-
GroupNotFound = "GroupNotFound",
|
|
40
|
-
TokenNotFound = "TokenNotFound",
|
|
41
|
-
AddressNotFound = "AddressNotFound",
|
|
42
|
-
UserAlreadyExists = "UserAlreadyExists",
|
|
43
|
-
UserNotFound = "UserNotFound",
|
|
44
|
-
ChainNotSupported = "ChainNotSupported",
|
|
45
|
-
ServerMissingData = "ServerMissingData",
|
|
46
|
-
ServerFailure = "ServerFailure",
|
|
47
|
-
ServerTimeout = "ServerTimeout",
|
|
48
|
-
UnknownServerError = "UnknownServerError",
|
|
49
|
-
ServerConnectionError = "ServerConnectionError",
|
|
50
|
-
UserOpFailureError = "UserOpFailureError",
|
|
51
|
-
Unauthorized = "Unauthorized",
|
|
52
|
-
RequestLimitExceeded = "RequestLimitExceeded",
|
|
53
|
-
WalletPrefundError = "PrefundError",
|
|
54
|
-
GasSponsorFundError = "GasSponsorFundError",
|
|
55
|
-
FunWalletErrorCode = "FunWalletErrorCode",
|
|
56
|
-
BridgeRouteNotFound = "BridgeRouteNotFound",
|
|
57
|
-
BridgeAllowanceDataNotFound = "BridgeAllowanceDataNotFound",
|
|
58
|
-
BridgeApproveTxDataNotFound = "BridgeApproveTxDataNotFound",
|
|
59
|
-
CheckoutInitDepositAddrNotFound = "CheckoutInitDepositAddrNotFound"
|
|
60
|
-
}
|