@funkit/api-base 1.0.2-next.0 → 1.0.2-next.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 +6 -0
- package/dist/index.js +1763 -20
- package/dist/index.js.map +7 -1
- package/package.json +7 -4
- package/dist/src/consts/api.js +0 -13
- package/dist/src/consts/api.js.map +0 -1
- package/dist/src/consts/index.js +0 -20
- package/dist/src/consts/index.js.map +0 -1
- package/dist/src/consts/request.js +0 -3
- package/dist/src/consts/request.js.map +0 -1
- package/dist/src/consts/retry.js +0 -19
- package/dist/src/consts/retry.js.map +0 -1
- package/dist/src/errors/BaseError.js +0 -24
- package/dist/src/errors/BaseError.js.map +0 -1
- package/dist/src/errors/ClientError.js +0 -76
- package/dist/src/errors/ClientError.js.map +0 -1
- package/dist/src/errors/ServerError.js +0 -18
- package/dist/src/errors/ServerError.js.map +0 -1
- package/dist/src/errors/errors.json +0 -626
- package/dist/src/errors/index.js +0 -21
- package/dist/src/errors/index.js.map +0 -1
- package/dist/src/errors/types.js +0 -51
- package/dist/src/errors/types.js.map +0 -1
- package/dist/src/services/assets/endpoints.js +0 -94
- package/dist/src/services/assets/endpoints.js.map +0 -1
- package/dist/src/services/assets/index.js +0 -19
- package/dist/src/services/assets/index.js.map +0 -1
- package/dist/src/services/assets/types.js +0 -3
- package/dist/src/services/assets/types.js.map +0 -1
- package/dist/src/services/checkout/endpoints.js +0 -202
- package/dist/src/services/checkout/endpoints.js.map +0 -1
- package/dist/src/services/checkout/index.js +0 -19
- package/dist/src/services/checkout/index.js.map +0 -1
- package/dist/src/services/checkout/types.js +0 -22
- package/dist/src/services/checkout/types.js.map +0 -1
- package/dist/src/services/faucet/endpoints.js +0 -12
- package/dist/src/services/faucet/endpoints.js.map +0 -1
- package/dist/src/services/faucet/index.js +0 -19
- package/dist/src/services/faucet/index.js.map +0 -1
- package/dist/src/services/faucet/types.js +0 -3
- package/dist/src/services/faucet/types.js.map +0 -1
- package/dist/src/services/index.js +0 -25
- package/dist/src/services/index.js.map +0 -1
- package/dist/src/services/mesh/endpoints.js +0 -128
- package/dist/src/services/mesh/endpoints.js.map +0 -1
- package/dist/src/services/mesh/index.js +0 -19
- package/dist/src/services/mesh/index.js.map +0 -1
- package/dist/src/services/mesh/types.js +0 -23
- package/dist/src/services/mesh/types.js.map +0 -1
- package/dist/src/services/moonpay/endpoints.js +0 -82
- package/dist/src/services/moonpay/endpoints.js.map +0 -1
- package/dist/src/services/moonpay/index.js +0 -19
- package/dist/src/services/moonpay/index.js.map +0 -1
- package/dist/src/services/moonpay/types.js +0 -3
- package/dist/src/services/moonpay/types.js.map +0 -1
- package/dist/src/services/stripe/endpoints.js +0 -58
- package/dist/src/services/stripe/endpoints.js.map +0 -1
- package/dist/src/services/stripe/index.js +0 -19
- package/dist/src/services/stripe/index.js.map +0 -1
- package/dist/src/services/stripe/types.js +0 -3
- package/dist/src/services/stripe/types.js.map +0 -1
- package/dist/src/services/support/endpoints.js +0 -20
- package/dist/src/services/support/endpoints.js.map +0 -1
- package/dist/src/services/support/index.js +0 -19
- package/dist/src/services/support/index.js.map +0 -1
- package/dist/src/services/support/types.js +0 -3
- package/dist/src/services/support/types.js.map +0 -1
- package/dist/src/services/turnkey/endpoints.js +0 -26
- package/dist/src/services/turnkey/endpoints.js.map +0 -1
- package/dist/src/services/turnkey/index.js +0 -19
- package/dist/src/services/turnkey/index.js.map +0 -1
- package/dist/src/services/turnkey/types.js +0 -3
- package/dist/src/services/turnkey/types.js.map +0 -1
- package/dist/src/utils/checkout.js +0 -20
- package/dist/src/utils/checkout.js.map +0 -1
- package/dist/src/utils/error.js +0 -13
- package/dist/src/utils/error.js.map +0 -1
- package/dist/src/utils/index.js +0 -20
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/request.js +0 -104
- package/dist/src/utils/request.js.map +0 -1
package/dist/src/errors/types.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorCode = exports.ErrorType = exports.ErrorBaseType = void 0;
|
|
4
|
-
var ErrorBaseType;
|
|
5
|
-
(function (ErrorBaseType) {
|
|
6
|
-
ErrorBaseType["ClientError"] = "ClientError";
|
|
7
|
-
ErrorBaseType["ServerError"] = "ServerError";
|
|
8
|
-
})(ErrorBaseType || (exports.ErrorBaseType = ErrorBaseType = {}));
|
|
9
|
-
var ErrorType;
|
|
10
|
-
(function (ErrorType) {
|
|
11
|
-
ErrorType["InvalidParameter"] = "InvalidParameter";
|
|
12
|
-
ErrorType["InternalServerFailure"] = "InternalServerFailure";
|
|
13
|
-
ErrorType["ResourceNotFound"] = "ResourceNotFound";
|
|
14
|
-
ErrorType["InvalidAction"] = "InvalidAction";
|
|
15
|
-
ErrorType["ThrottlingError"] = "ThrottlingError";
|
|
16
|
-
ErrorType["AccessDeniedError"] = "AccessDeniedError";
|
|
17
|
-
ErrorType["UserOpFailureError"] = "UserOpFailureError";
|
|
18
|
-
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
|
19
|
-
var ErrorCode;
|
|
20
|
-
(function (ErrorCode) {
|
|
21
|
-
ErrorCode["MissingParameter"] = "MissingParameter";
|
|
22
|
-
ErrorCode["InvalidParameter"] = "InvalidParameter";
|
|
23
|
-
ErrorCode["InvalidThreshold"] = "InvalidThreshold";
|
|
24
|
-
ErrorCode["InvalidChainIdentifier"] = "InvalidChainIdentifier";
|
|
25
|
-
ErrorCode["InvalidNFTIdentifier"] = "InvalidNFTIdentifier";
|
|
26
|
-
ErrorCode["InsufficientSignatures"] = "InsufficientSignatures";
|
|
27
|
-
ErrorCode["InvalidParameterCombination"] = "InvalidParameterCombination";
|
|
28
|
-
ErrorCode["CheckPointHintsNotFound"] = "CheckPointHintsNotFound";
|
|
29
|
-
ErrorCode["GroupNotFound"] = "GroupNotFound";
|
|
30
|
-
ErrorCode["TokenNotFound"] = "TokenNotFound";
|
|
31
|
-
ErrorCode["AddressNotFound"] = "AddressNotFound";
|
|
32
|
-
ErrorCode["UserAlreadyExists"] = "UserAlreadyExists";
|
|
33
|
-
ErrorCode["UserNotFound"] = "UserNotFound";
|
|
34
|
-
ErrorCode["ChainNotSupported"] = "ChainNotSupported";
|
|
35
|
-
ErrorCode["ServerMissingData"] = "ServerMissingData";
|
|
36
|
-
ErrorCode["ServerFailure"] = "ServerFailure";
|
|
37
|
-
ErrorCode["ServerTimeout"] = "ServerTimeout";
|
|
38
|
-
ErrorCode["UnknownServerError"] = "UnknownServerError";
|
|
39
|
-
ErrorCode["ServerConnectionError"] = "ServerConnectionError";
|
|
40
|
-
ErrorCode["UserOpFailureError"] = "UserOpFailureError";
|
|
41
|
-
ErrorCode["Unauthorized"] = "Unauthorized";
|
|
42
|
-
ErrorCode["RequestLimitExceeded"] = "RequestLimitExceeded";
|
|
43
|
-
ErrorCode["WalletPrefundError"] = "PrefundError";
|
|
44
|
-
ErrorCode["GasSponsorFundError"] = "GasSponsorFundError";
|
|
45
|
-
ErrorCode["FunWalletErrorCode"] = "FunWalletErrorCode";
|
|
46
|
-
ErrorCode["BridgeRouteNotFound"] = "BridgeRouteNotFound";
|
|
47
|
-
ErrorCode["BridgeAllowanceDataNotFound"] = "BridgeAllowanceDataNotFound";
|
|
48
|
-
ErrorCode["BridgeApproveTxDataNotFound"] = "BridgeApproveTxDataNotFound";
|
|
49
|
-
ErrorCode["CheckoutInitDepositAddrNotFound"] = "CheckoutInitDepositAddrNotFound";
|
|
50
|
-
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
51
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/errors/types.ts"],"names":[],"mappings":";;;AAkBA,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,kDAAqC,CAAA;IACrC,4DAA+C,CAAA;IAC/C,kDAAqC,CAAA;IACrC,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,sDAAyC,CAAA;AAC3C,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,IAAY,SA8BX;AA9BD,WAAY,SAAS;IACnB,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,8DAAiD,CAAA;IACjD,wEAA2D,CAAA;IAC3D,gEAAmD,CAAA;IACnD,4CAA+B,CAAA;IAC/B,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,0CAA6B,CAAA;IAC7B,oDAAuC,CAAA;IACvC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,4CAA+B,CAAA;IAC/B,sDAAyC,CAAA;IACzC,4DAA+C,CAAA;IAC/C,sDAAyC,CAAA;IACzC,0CAA6B,CAAA;IAC7B,0DAA6C,CAAA;IAC7C,gDAAmC,CAAA;IACnC,wDAA2C,CAAA;IAC3C,sDAAyC,CAAA;IACzC,wDAA2C,CAAA;IAC3C,wEAA2D,CAAA;IAC3D,wEAA2D,CAAA;IAC3D,gFAAmE,CAAA;AACrE,CAAC,EA9BW,SAAS,yBAAT,SAAS,QA8BpB"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAssetPriceInfo = getAssetPriceInfo;
|
|
4
|
-
exports.getAllWalletTokens = getAllWalletTokens;
|
|
5
|
-
exports.getAllWalletTokensByChainId = getAllWalletTokensByChainId;
|
|
6
|
-
exports.getAllWalletNFTs = getAllWalletNFTs;
|
|
7
|
-
exports.getAllWalletNFTsByChainId = getAllWalletNFTsByChainId;
|
|
8
|
-
exports.getWalletLidoWithdrawalsByChainId = getWalletLidoWithdrawalsByChainId;
|
|
9
|
-
const consts_1 = require("../../consts");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
/**===========================================================
|
|
12
|
-
* REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts
|
|
13
|
-
* TODO: Remove this comment once migration is complete
|
|
14
|
-
*===========================================================*/
|
|
15
|
-
/**
|
|
16
|
-
* Gets the estimated dollar unit price of a tokenAddress for checkout
|
|
17
|
-
* @param chainId https://chainlist.org/ e.g. "1" for ethereum
|
|
18
|
-
* @param assetTokenAddress tokenAddress of the asset on the given chain
|
|
19
|
-
* @param apiKey
|
|
20
|
-
*/
|
|
21
|
-
async function getAssetPriceInfo({ chainId, assetTokenAddress, apiKey, }) {
|
|
22
|
-
const priceInfo = await (0, utils_1.sendGetRequest)({
|
|
23
|
-
uri: `${consts_1.API_BASE_URL}/asset/erc20/price/${chainId}/${assetTokenAddress}`,
|
|
24
|
-
apiKey,
|
|
25
|
-
retryOptions: { maxAttempts: 2 },
|
|
26
|
-
});
|
|
27
|
-
return priceInfo;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Get all tokens for a given wallet address
|
|
31
|
-
* @param walletAddress
|
|
32
|
-
* @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
|
|
33
|
-
* @param apiKey
|
|
34
|
-
*/
|
|
35
|
-
async function getAllWalletTokens({ walletAddress, onlyVerifiedTokens, apiKey, }) {
|
|
36
|
-
return await (0, utils_1.sendGetRequest)({
|
|
37
|
-
uri: `${consts_1.API_BASE_URL}/assets/erc20s/${walletAddress}?onlyVerifiedTokens=${onlyVerifiedTokens}`,
|
|
38
|
-
apiKey,
|
|
39
|
-
retryOptions: { maxAttempts: 2 },
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get all tokens for a given wallet address on a specific chain
|
|
44
|
-
* @param chainId https://chainlist.org/
|
|
45
|
-
* @param walletAddress
|
|
46
|
-
* @param onlyVerifiedTokens If true, only return alchemy tokens that are verified(filters spam)
|
|
47
|
-
* @param apiKey
|
|
48
|
-
*/
|
|
49
|
-
async function getAllWalletTokensByChainId({ chainId, walletAddress, onlyVerifiedTokens, apiKey, }) {
|
|
50
|
-
return await (0, utils_1.sendGetRequest)({
|
|
51
|
-
uri: `${consts_1.API_BASE_URL}/assets/erc20s/${walletAddress}/${chainId}?onlyVerifiedTokens=${onlyVerifiedTokens}`,
|
|
52
|
-
apiKey,
|
|
53
|
-
retryOptions: { maxAttempts: 2 },
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**=======================
|
|
57
|
-
* POTENTIAL DEPRECATION
|
|
58
|
-
*=======================*/
|
|
59
|
-
/**
|
|
60
|
-
* Get all the NFTs owned by a wallet
|
|
61
|
-
* @param walletAddress
|
|
62
|
-
* @param apiKey
|
|
63
|
-
*/
|
|
64
|
-
async function getAllWalletNFTs({ walletAddress, apiKey, }) {
|
|
65
|
-
return await (0, utils_1.sendGetRequest)({
|
|
66
|
-
uri: `${consts_1.API_BASE_URL}/assets/nfts/${walletAddress}`,
|
|
67
|
-
apiKey,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get all the NFTs owned by a wallet on a specific chain
|
|
72
|
-
* @param chainId From https://chainlist.org/
|
|
73
|
-
* @param walletAddress Address of holder
|
|
74
|
-
* @param apiKey
|
|
75
|
-
*/
|
|
76
|
-
async function getAllWalletNFTsByChainId({ chainId, walletAddress, apiKey, }) {
|
|
77
|
-
return await (0, utils_1.sendGetRequest)({
|
|
78
|
-
uri: `${consts_1.API_BASE_URL}/assets/nfts/${walletAddress}/${chainId}`,
|
|
79
|
-
apiKey,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get all lido withdrawal request ids for a wallet address on a specific chain
|
|
84
|
-
* @param {string} chainId https://chainlist.org/ ie "1" for ethereum
|
|
85
|
-
* @param {string} holderAddr Address of holder
|
|
86
|
-
* @returns [readyToWithdrawRequestIds, notReadyToWithdrawRequestIds]
|
|
87
|
-
*/
|
|
88
|
-
async function getWalletLidoWithdrawalsByChainId({ chainId, walletAddress, apiKey, }) {
|
|
89
|
-
return await (0, utils_1.sendGetRequest)({
|
|
90
|
-
uri: `${consts_1.API_BASE_URL}/assets/lido-withdrawals/${walletAddress}/${chainId}`,
|
|
91
|
-
apiKey,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../../src/services/assets/endpoints.ts"],"names":[],"mappings":";;AA4BA,8CAWC;AAQD,gDAUC;AASD,kEAWC;AAWD,4CAQC;AAQD,8DASC;AAQD,8EASC;AAlID,yCAA2C;AAC3C,uCAA4C;AAgB5C;;;+DAG+D;AAE/D;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAC,EACtC,OAAO,EACP,iBAAiB,EACjB,MAAM,GACmB;IACzB,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAc,EAAC;QACrC,GAAG,EAAE,GAAG,qBAAY,sBAAsB,OAAO,IAAI,iBAAiB,EAAE;QACxE,MAAM;QACN,YAAY,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;KACjC,CAAC,CAAA;IACF,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CAAC,EACvC,aAAa,EACb,kBAAkB,EAClB,MAAM,GACoB;IAC1B,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,qBAAY,kBAAkB,aAAa,uBAAuB,kBAAkB,EAAE;QAC9F,MAAM;QACN,YAAY,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;KACjC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,2BAA2B,CAAC,EAChD,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,MAAM,GAC6B;IACnC,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,qBAAY,kBAAkB,aAAa,IAAI,OAAO,uBAAuB,kBAAkB,EAAE;QACzG,MAAM;QACN,YAAY,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;KACjC,CAAC,CAAA;AACJ,CAAC;AAED;;2BAE2B;AAE3B;;;;GAIG;AACI,KAAK,UAAU,gBAAgB,CAAC,EACrC,aAAa,EACb,MAAM,GACkB;IACxB,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,qBAAY,gBAAgB,aAAa,EAAE;QACnD,MAAM;KACP,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,OAAO,EACP,aAAa,EACb,MAAM,GAC2B;IACjC,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,qBAAY,gBAAgB,aAAa,IAAI,OAAO,EAAE;QAC9D,MAAM;KACP,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iCAAiC,CAAC,EACtD,OAAO,EACP,aAAa,EACb,MAAM,GAC4B;IAClC,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,qBAAY,4BAA4B,aAAa,IAAI,OAAO,EAAE;QAC1E,MAAM;KACP,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./endpoints"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/assets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,0CAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/assets/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCheckoutQuote = getCheckoutQuote;
|
|
7
|
-
exports.initializeCheckout = initializeCheckout;
|
|
8
|
-
exports.deactivateCheckout = deactivateCheckout;
|
|
9
|
-
exports.getCheckoutByDepositAddress = getCheckoutByDepositAddress;
|
|
10
|
-
exports.getCheckoutsByFunWalletAddress = getCheckoutsByFunWalletAddress;
|
|
11
|
-
exports.getCheckoutsByRecipientAddress = getCheckoutsByRecipientAddress;
|
|
12
|
-
exports.getCheckoutsByUserId = getCheckoutsByUserId;
|
|
13
|
-
exports.getPaymasterDataForCheckoutSponsoredTransfer = getPaymasterDataForCheckoutSponsoredTransfer;
|
|
14
|
-
const big_js_1 = __importDefault(require("big.js"));
|
|
15
|
-
const consts_1 = require("../../consts");
|
|
16
|
-
const errors_1 = require("../../errors");
|
|
17
|
-
const utils_1 = require("../../utils");
|
|
18
|
-
const types_1 = require("./types");
|
|
19
|
-
/**
|
|
20
|
-
* Gets a checkout quote (estimation).
|
|
21
|
-
* @param fromChainId The ID of the chain where funds will be provided from.
|
|
22
|
-
* @param fromTokenAddress The asset to fund the checkout. This must be either a chain native token or an ERC-20, on the fromChainId.
|
|
23
|
-
* @param fromTokenDecimals The number of decimals for the fromTokenAddress.
|
|
24
|
-
* @param toChainId The ID of the chain where the checkout operation is to be performed.
|
|
25
|
-
* @param toTokenAddress The wanted asset for the checkout operation. This must be either a chain native token or an ERC-20, on the target chain.
|
|
26
|
-
* @param toTokenAmount The amount of wanted asset for the checkout operation in base units.
|
|
27
|
-
* @param toTokenDecimals The number of decimals for the toTokenAddress.
|
|
28
|
-
* @param expirationTimestampMs The amount of time (duration) from now before the checkout operation expires.
|
|
29
|
-
* @param apiKey A valid fun api key.
|
|
30
|
-
* @return {Promise<CheckoutCoreQuoteResponse>} The formatted quote object
|
|
31
|
-
*/
|
|
32
|
-
async function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, userId, apiKey, }) {
|
|
33
|
-
try {
|
|
34
|
-
const toMultipler = 10 ** toTokenDecimals;
|
|
35
|
-
const toAmountBaseUnitBI = BigInt(Math.floor(toTokenAmount * toMultipler));
|
|
36
|
-
const queryParams = {
|
|
37
|
-
userId,
|
|
38
|
-
fromChainId,
|
|
39
|
-
fromTokenAddress,
|
|
40
|
-
toChainId,
|
|
41
|
-
toTokenAddress,
|
|
42
|
-
toAmountBaseUnit: toAmountBaseUnitBI.toString(),
|
|
43
|
-
// Only pass in recipientAddr if specified
|
|
44
|
-
...(recipientAddr ? { recipientAddr } : {}),
|
|
45
|
-
// Rounding nearest tenth second (instead of seconds) to better support backend quote caching feature
|
|
46
|
-
// Reference: https://vintage-heaven-3cd.notion.site/API-Gateway-Caching-and-Pre-Warming-System-Draft-ee7909d9b85f43c793ce7bd2607bec02?pvs=4
|
|
47
|
-
// Note: Rounding *down* instead of a regular round to safeguard against edge case of timing passing frontend range validation but failing backend range validation
|
|
48
|
-
checkoutExpirationTimestampSeconds: (0, utils_1.roundToNearestBottomTenth)(Math.round((Date.now() + expirationTimestampMs) / 1000)).toString(),
|
|
49
|
-
sponsorInitialTransferGasLimit,
|
|
50
|
-
// @deprecated Not in use
|
|
51
|
-
refuel: needsRefuel.toString(),
|
|
52
|
-
};
|
|
53
|
-
const searchParams = new URLSearchParams(queryParams);
|
|
54
|
-
const quoteRes = (await (0, utils_1.sendGetRequest)({
|
|
55
|
-
uri: `${consts_1.API_BASE_URL}/checkout/quote?${searchParams}`,
|
|
56
|
-
apiKey,
|
|
57
|
-
}));
|
|
58
|
-
const fromMultipler = 10 ** fromTokenDecimals;
|
|
59
|
-
// Format the response for frontend usage
|
|
60
|
-
return {
|
|
61
|
-
quoteId: quoteRes.quoteId,
|
|
62
|
-
fromTokenAddress: quoteRes.fromTokenAddress,
|
|
63
|
-
estFeesUsd: quoteRes.estFeesUsd,
|
|
64
|
-
estSubtotalUsd: quoteRes.estSubtotalUsd,
|
|
65
|
-
estTotalUsd: quoteRes.estTotalUsd,
|
|
66
|
-
estCheckoutTimeMs: quoteRes.estCheckoutTimeMs,
|
|
67
|
-
estTotalFromAmountBaseUnit: quoteRes.estTotalFromAmountBaseUnit,
|
|
68
|
-
estSubtotalFromAmountBaseUnit: quoteRes.estSubtotalFromAmountBaseUnit,
|
|
69
|
-
estFeesFromAmountBaseUnit: quoteRes.estFeesFromAmountBaseUnit,
|
|
70
|
-
// Added fields
|
|
71
|
-
estFeesFromAmount: new big_js_1.default(quoteRes.estFeesFromAmountBaseUnit)
|
|
72
|
-
.div(fromMultipler)
|
|
73
|
-
.toString(),
|
|
74
|
-
estSubtotalFromAmount: new big_js_1.default(quoteRes.estSubtotalFromAmountBaseUnit)
|
|
75
|
-
.div(fromMultipler)
|
|
76
|
-
.toString(),
|
|
77
|
-
estTotalFromAmount: new big_js_1.default(quoteRes.estTotalFromAmountBaseUnit)
|
|
78
|
-
.div(fromMultipler)
|
|
79
|
-
.toString(),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
throw new Error(`An error occured trying to generate a checkout quote: ${err.message}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Initializes a checkout
|
|
88
|
-
* @param userOp The checkout UserOp, signed.
|
|
89
|
-
* @param quoteId The quoteId specific to the checkout.
|
|
90
|
-
* @param apiKey A valid fun api key.
|
|
91
|
-
* @return {Address} The generated deposit address
|
|
92
|
-
*/
|
|
93
|
-
async function initializeCheckout({ userOp, quoteId, sourceOfFund, apiKey, clientMetadata, }) {
|
|
94
|
-
const body = {
|
|
95
|
-
...(userOp ? { userOp } : {}),
|
|
96
|
-
quoteId,
|
|
97
|
-
sourceOfFund,
|
|
98
|
-
salt: (0, utils_1.generateRandomCheckoutSalt)(),
|
|
99
|
-
clientMetadata,
|
|
100
|
-
};
|
|
101
|
-
const res = await (0, utils_1.sendPostRequest)({
|
|
102
|
-
uri: `${consts_1.API_BASE_URL}/checkout`,
|
|
103
|
-
body,
|
|
104
|
-
apiKey,
|
|
105
|
-
});
|
|
106
|
-
if (!res?.depositAddr) {
|
|
107
|
-
throw new errors_1.ResourceNotFoundError(errors_1.ErrorCode.CheckoutInitDepositAddrNotFound, 'Unable to initialize checkout', body, '', 'https://docs.fun.xyz');
|
|
108
|
-
}
|
|
109
|
-
return res.depositAddr;
|
|
110
|
-
}
|
|
111
|
-
async function deactivateCheckout({ depositAddress, apiKey, }) {
|
|
112
|
-
try {
|
|
113
|
-
await (0, utils_1.sendPostRequest)({
|
|
114
|
-
uri: `${consts_1.API_BASE_URL}/checkout/update/${depositAddress}`,
|
|
115
|
-
body: {
|
|
116
|
-
// Fixed state to cancel the checkout
|
|
117
|
-
state: types_1.CheckoutState.CANCELLED,
|
|
118
|
-
},
|
|
119
|
-
apiKey,
|
|
120
|
-
});
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
throw new Error('Unable to deactivate checkout');
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Gets a checkout given a depositAddress
|
|
129
|
-
* @param depositAddress A unique deposit address associated with a backend checkout item.
|
|
130
|
-
* @param apiKey A valid fun api key.
|
|
131
|
-
* @returns The checkout object if exists. Otherwise, null.
|
|
132
|
-
*/
|
|
133
|
-
async function getCheckoutByDepositAddress({ depositAddress, apiKey, }) {
|
|
134
|
-
try {
|
|
135
|
-
return await (0, utils_1.sendGetRequest)({
|
|
136
|
-
uri: `${consts_1.API_BASE_URL}/checkout/${depositAddress}`,
|
|
137
|
-
apiKey,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
catch (err) {
|
|
141
|
-
if (err instanceof errors_1.ResourceNotFoundError) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
throw err;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Gets all checkouts associated with a funWallet
|
|
149
|
-
* @param funWalletAddress A funWallet address.
|
|
150
|
-
* @param apiKey A valid fun api key.
|
|
151
|
-
* @returns A list of checkout objects if exists. Otherwise, an empty array.
|
|
152
|
-
*/
|
|
153
|
-
async function getCheckoutsByFunWalletAddress({ funWalletAddress, apiKey, }) {
|
|
154
|
-
const res = await (0, utils_1.sendGetRequest)({
|
|
155
|
-
uri: `${consts_1.API_BASE_URL}/checkout/fun-wallet/${funWalletAddress}`,
|
|
156
|
-
apiKey,
|
|
157
|
-
});
|
|
158
|
-
return res || [];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Gets all checkouts associated with a recipient address
|
|
162
|
-
* @param recipientAddress A wallet address.
|
|
163
|
-
* @param apiKey A valid fun api key.
|
|
164
|
-
* @returns A list of checkout objects if exists. Otherwise, an empty array.
|
|
165
|
-
*/
|
|
166
|
-
async function getCheckoutsByRecipientAddress({ recipientAddress, apiKey, }) {
|
|
167
|
-
const res = await (0, utils_1.sendGetRequest)({
|
|
168
|
-
uri: `${consts_1.API_BASE_URL}/checkout/recipient/${recipientAddress}`,
|
|
169
|
-
apiKey,
|
|
170
|
-
});
|
|
171
|
-
return res || [];
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Gets all checkouts associated with a funkit userId string
|
|
175
|
-
* @param userId A userId string.
|
|
176
|
-
* @param apiKey A valid fun api key.
|
|
177
|
-
* @returns A list of checkout objects if exists. Otherwise, an empty array.
|
|
178
|
-
*/
|
|
179
|
-
async function getCheckoutsByUserId({ userId, apiKey, }) {
|
|
180
|
-
const res = await (0, utils_1.sendGetRequest)({
|
|
181
|
-
uri: `${consts_1.API_BASE_URL}/checkout/userId/${userId}`,
|
|
182
|
-
apiKey,
|
|
183
|
-
});
|
|
184
|
-
return res || [];
|
|
185
|
-
}
|
|
186
|
-
async function getPaymasterDataForCheckoutSponsoredTransfer({ depositAddress, transferUserOp, apiKey, }) {
|
|
187
|
-
const body = {
|
|
188
|
-
depositAddress,
|
|
189
|
-
userOp: transferUserOp,
|
|
190
|
-
};
|
|
191
|
-
const res = await (0, utils_1.sendPostRequest)({
|
|
192
|
-
uri: `${consts_1.API_BASE_URL}/checkout/sponsor-transfer`,
|
|
193
|
-
body,
|
|
194
|
-
apiKey,
|
|
195
|
-
});
|
|
196
|
-
if (!res) {
|
|
197
|
-
// TODO: Better error handling
|
|
198
|
-
throw new Error('Unable to get sponsorship information');
|
|
199
|
-
}
|
|
200
|
-
return res;
|
|
201
|
-
}
|
|
202
|
-
//# sourceMappingURL=endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../../src/services/checkout/endpoints.ts"],"names":[],"mappings":";;;;;AAwCA,4CAwEC;AASD,gDA6BC;AAED,gDAiBC;AAQD,kEAkBC;AAQD,wEAYC;AAQD,wEAYC;AAQD,oDAYC;AAED,oGAmBC;AApRD,oDAAwB;AAGxB,yCAA2C;AAC3C,yCAA+D;AAC/D,uCAKoB;AACpB,mCAcgB;AAEhB;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,gBAAgB,CAAC,EACrC,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,8BAA8B,EAC9B,aAAa,EACb,WAAW,EACX,MAAM,EACN,MAAM,GACc;IACpB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,EAAE,IAAI,eAAe,CAAA;QACzC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,WAAW,CAAC,CAAC,CAAA;QAC1E,MAAM,WAAW,GAAG;YAClB,MAAM;YACN,WAAW;YACX,gBAAgB;YAChB,SAAS;YACT,cAAc;YACd,gBAAgB,EAAE,kBAAkB,CAAC,QAAQ,EAAE;YAC/C,0CAA0C;YAC1C,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,qGAAqG;YACrG,4IAA4I;YAC5I,mKAAmK;YACnK,kCAAkC,EAAE,IAAA,iCAAyB,EAC3D,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,qBAAqB,CAAC,GAAG,IAAI,CAAC,CACxD,CAAC,QAAQ,EAAE;YACZ,8BAA8B;YAC9B,yBAAyB;YACzB,MAAM,EAAE,WAAW,CAAC,QAA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G,EAAE,CAAC;QACT,8BAA8B;QAC9B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,GAA0C,CAAA;AACnD,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./endpoints"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/checkout/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,0CAAuB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckoutState = void 0;
|
|
4
|
-
// Reference from api server: https://github.com/fun-xyz/fun-api-server/blob/main/src/tables/FunWalletCheckout.ts#L11C1-L21C2
|
|
5
|
-
var CheckoutState;
|
|
6
|
-
(function (CheckoutState) {
|
|
7
|
-
// In-progress States
|
|
8
|
-
CheckoutState["FROM_UNFUNDED"] = "FROM_UNFUNDED";
|
|
9
|
-
CheckoutState["FROM_FUNDED"] = "FROM_FUNDED";
|
|
10
|
-
CheckoutState["FROM_POOLED"] = "FROM_POOLED";
|
|
11
|
-
CheckoutState["TO_UNFUNDED"] = "TO_UNFUNDED";
|
|
12
|
-
CheckoutState["TO_FUNDED"] = "TO_FUNDED";
|
|
13
|
-
CheckoutState["TO_POOLED"] = "TO_POOLED";
|
|
14
|
-
CheckoutState["TO_READY"] = "TO_READY";
|
|
15
|
-
CheckoutState["PENDING_RECEIVAL"] = "PENDING_RECEIVAL";
|
|
16
|
-
// Terminal States
|
|
17
|
-
CheckoutState["COMPLETED"] = "COMPLETED";
|
|
18
|
-
CheckoutState["CHECKOUT_ERROR"] = "CHECKOUT_ERROR";
|
|
19
|
-
CheckoutState["EXPIRED"] = "EXPIRED";
|
|
20
|
-
CheckoutState["CANCELLED"] = "CANCELLED";
|
|
21
|
-
})(CheckoutState || (exports.CheckoutState = CheckoutState = {}));
|
|
22
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/checkout/types.ts"],"names":[],"mappings":";;;AAiFA,6HAA6H;AAC7H,IAAY,aAeX;AAfD,WAAY,aAAa;IACvB,qBAAqB;IACrB,gDAA+B,CAAA;IAC/B,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,sDAAqC,CAAA;IACrC,kBAAkB;IAClB,wCAAuB,CAAA;IACvB,kDAAiC,CAAA;IACjC,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;AACzB,CAAC,EAfW,aAAa,6BAAb,aAAa,QAexB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAssetFromFaucet = getAssetFromFaucet;
|
|
4
|
-
const consts_1 = require("../../consts");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
async function getAssetFromFaucet({ token, chain, walletAddress, apiKey, }) {
|
|
7
|
-
return await (0, utils_1.sendGetRequest)({
|
|
8
|
-
uri: `${consts_1.FUN_FAUCET_URL}/get-faucet?token=${token}&testnet=${chain}&addr=${walletAddress}`,
|
|
9
|
-
apiKey,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../../src/services/faucet/endpoints.ts"],"names":[],"mappings":";;AAIA,gDAUC;AAdD,yCAA6C;AAC7C,uCAA4C;AAGrC,KAAK,UAAU,kBAAkB,CAAC,EACvC,KAAK,EACL,KAAK,EACL,aAAa,EACb,MAAM,GACoB;IAC1B,OAAO,MAAM,IAAA,sBAAc,EAAC;QAC1B,GAAG,EAAE,GAAG,uBAAc,qBAAqB,KAAK,YAAY,KAAK,SAAS,aAAa,EAAE;QACzF,MAAM;KACP,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./endpoints"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/faucet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,0CAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/faucet/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./assets"), exports);
|
|
18
|
-
__exportStar(require("./checkout"), exports);
|
|
19
|
-
__exportStar(require("./faucet"), exports);
|
|
20
|
-
__exportStar(require("./mesh"), exports);
|
|
21
|
-
__exportStar(require("./moonpay"), exports);
|
|
22
|
-
__exportStar(require("./stripe"), exports);
|
|
23
|
-
__exportStar(require("./support"), exports);
|
|
24
|
-
__exportStar(require("./turnkey"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,6CAA0B;AAC1B,2CAAwB;AACxB,yCAAsB;AACtB,4CAAyB;AACzB,2CAAwB;AACxB,4CAAyB;AACzB,4CAAyB"}
|