@funkit/api-base
Advanced tools
Comparing version 0.0.4 to 0.0.5
# @funkit/api-base | ||
## 0.0.5 | ||
### Patch Changes | ||
- 5f70055: refactor: update checkout/quote and checkout/update endpoints | ||
- 5f70055: feat: add new endpoint getCheckoutsByUserId | ||
## 0.0.4 | ||
@@ -4,0 +11,0 @@ |
@@ -16,3 +16,3 @@ import { Address } from 'viem'; | ||
*/ | ||
export declare function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, apiKey, }: CheckoutQuoteParams): Promise<CheckoutQuoteResponse>; | ||
export declare function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, userId, apiKey, }: CheckoutQuoteParams): Promise<CheckoutQuoteResponse>; | ||
/** | ||
@@ -57,2 +57,12 @@ * Initializes a checkout | ||
}): Promise<CheckoutHistoryItem[]>; | ||
/** | ||
* Gets all checkouts associated with a funkit userId string | ||
* @param userId A userId string. | ||
* @param apiKey A valid fun api key. | ||
* @returns A list of checkout objects if exists. Otherwise, an empty array. | ||
*/ | ||
export declare function getCheckoutsByUserId({ userId, apiKey, }: { | ||
userId: string; | ||
apiKey: string; | ||
}): Promise<CheckoutHistoryItem[]>; | ||
export declare function getPaymasterDataForCheckoutSponsoredTransfer({ depositAddress, transferUserOp, apiKey, }: CheckoutTransferSponsorshipParams): Promise<CheckoutTransferSponsorshipResponse>; |
@@ -12,2 +12,3 @@ "use strict"; | ||
exports.getCheckoutsByRecipientAddress = getCheckoutsByRecipientAddress; | ||
exports.getCheckoutsByUserId = getCheckoutsByUserId; | ||
exports.getPaymasterDataForCheckoutSponsoredTransfer = getPaymasterDataForCheckoutSponsoredTransfer; | ||
@@ -32,3 +33,3 @@ const big_js_1 = __importDefault(require("big.js")); | ||
*/ | ||
async function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, apiKey, }) { | ||
async function getCheckoutQuote({ fromChainId, fromTokenAddress, fromTokenDecimals, toChainId, toTokenAddress, toTokenDecimals, toTokenAmount, expirationTimestampMs, sponsorInitialTransferGasLimit, recipientAddr, needsRefuel, userId, apiKey, }) { | ||
try { | ||
@@ -38,2 +39,3 @@ const toMultipler = 10 ** toTokenDecimals; | ||
const queryParams = { | ||
userId, | ||
fromChainId, | ||
@@ -115,3 +117,3 @@ fromTokenAddress, | ||
await (0, utils_1.sendPostRequest)({ | ||
uri: `${consts_1.API_BASE_URL}/checkout/${depositAddress}`, | ||
uri: `${consts_1.API_BASE_URL}/checkout/update/${depositAddress}`, | ||
body: { | ||
@@ -175,2 +177,15 @@ // Fixed state to cancel the checkout | ||
} | ||
/** | ||
* Gets all checkouts associated with a funkit userId string | ||
* @param userId A userId string. | ||
* @param apiKey A valid fun api key. | ||
* @returns A list of checkout objects if exists. Otherwise, an empty array. | ||
*/ | ||
async function getCheckoutsByUserId({ userId, apiKey, }) { | ||
const res = await (0, utils_1.sendGetRequest)({ | ||
uri: `${consts_1.API_BASE_URL}/checkout/userId/${userId}`, | ||
apiKey, | ||
}); | ||
return res || []; | ||
} | ||
async function getPaymasterDataForCheckoutSponsoredTransfer({ depositAddress, transferUserOp, apiKey, }) { | ||
@@ -177,0 +192,0 @@ const body = { |
@@ -15,2 +15,3 @@ /**===============* | ||
refuel: string; | ||
userId: string; | ||
recipientAddr?: Address; | ||
@@ -17,0 +18,0 @@ }; |
{ | ||
"name": "@funkit/api-base", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Base API for Funkit", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147904
2501