@aarc-dev/core
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse, DepositOnRampParams, CheckoutOnrampParams, CheckoutDto, DepositRouteDto, DepositCalldataResponse, CheckoutRouteDto, MoonpayOnRampParams } from "./utils/CoreTypes"; | ||
import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse, DepositOnRampParams, CheckoutOnrampParams, MoonpayOnRampParams } from "./utils/CoreTypes"; | ||
export declare class AarcCore { | ||
@@ -17,5 +17,2 @@ apiKey: string; | ||
performDeposit(depositDto: DepositDto): Promise<RelayedTxListResponse[]>; | ||
performCheckout(depositDto: CheckoutDto): Promise<RelayedTxListResponse[]>; | ||
getDepositRoute(depositRouteDto: DepositRouteDto): Promise<DepositCalldataResponse>; | ||
getCheckoutRoute(checkoutRouteDto: CheckoutRouteDto): Promise<import("./utils").CheckoutCalldataResponse>; | ||
executeMigrationForward(executeMigrationForwardDto: ExecuteMigrationForwardDto): Promise<RelayedTxListResponse[]>; | ||
@@ -26,4 +23,4 @@ executeMigrationGasless(executeMigrationGaslessDto: ExecuteMigrationGaslessDto): Promise<RelayedTxListResponse[]>; | ||
generateCheckoutOnrampUrl(onrampData: CheckoutOnrampParams): Promise<string | Error>; | ||
generateMoonpayOnrampUrl(onRamData: MoonpayOnRampParams): Promise<string | Error>; | ||
generateMoonpayOnrampUrl(onrampData: MoonpayOnRampParams): Promise<string | Error>; | ||
} | ||
export default AarcCore; |
@@ -163,5 +163,5 @@ "use strict"; | ||
} | ||
const depositResponse = await (0, Helper_1.generateDepositCallData)(depositCallDataDto, this.apiKey); | ||
const approvalTxs = depositResponse.data.approvalTxs; | ||
const executionTxs = depositResponse.data.executionTxs; | ||
const depositResonse = await (0, Helper_1.generateDepositCallData)(depositCallDataDto, this.apiKey); | ||
const approvalTxs = depositResonse.data.approvalTxs; | ||
const executionTxs = depositResonse.data.executionTxs; | ||
for (let index = 0; index < approvalTxs.length; index++) { | ||
@@ -235,105 +235,2 @@ const element = approvalTxs[index]; | ||
} | ||
async performCheckout(depositDto) { | ||
var _a, _b, _c; | ||
let callDataResultSet = []; | ||
const { senderSigner } = depositDto; | ||
let networkId = null; | ||
if (senderSigner.provider) { | ||
const network = await senderSigner.provider.getNetwork(); | ||
if (network) { | ||
networkId = Number(network.chainId); | ||
} | ||
} | ||
if (networkId && networkId !== depositDto.fromChainId) { | ||
throw new Error('Invalid signer, conflicting chainId'); | ||
} | ||
const checkoutResponse = await (0, Helper_1.generateCheckoutCallData)(depositDto, this.apiKey); | ||
const approvalTxs = checkoutResponse.data.approvalTxs; | ||
const executionTxs = checkoutResponse.data.executionTxs; | ||
for (let index = 0; index < approvalTxs.length; index++) { | ||
const element = approvalTxs[index]; | ||
let trx = undefined; | ||
try { | ||
trx = await senderSigner.sendTransaction({ | ||
to: element.approvalTokenAddress, | ||
data: element.callData, | ||
value: "0x00", | ||
gasLimit: (_a = element.gasLimit) !== null && _a !== void 0 ? _a : undefined, | ||
}); | ||
callDataResultSet.push({ | ||
tokenInfo: [ | ||
{ | ||
tokenAddress: element.approvalTokenAddress, | ||
amount: element.minimumApprovalAmount, | ||
}, | ||
], | ||
type: CoreTypes_1.PERMIT_TX_TYPES.ERC20_APPROVAL, | ||
taskId: "", | ||
status: "Tx Sent", | ||
txHash: trx.hash, | ||
}); | ||
} | ||
catch (error) { | ||
throw new Error(error); | ||
} | ||
} | ||
for (let index = 0; index < executionTxs.length; index++) { | ||
const element = executionTxs[index]; | ||
let trx = undefined; | ||
try { | ||
trx = await senderSigner.sendTransaction({ | ||
to: element.txTarget, | ||
data: (_b = element.txData) !== null && _b !== void 0 ? _b : "0x", | ||
value: element.value, | ||
gasLimit: (_c = element.gasLimit) !== null && _c !== void 0 ? _c : undefined, | ||
}); | ||
callDataResultSet.push({ | ||
tokenInfo: [ | ||
{ | ||
tokenAddress: depositDto.fromTokenAddress, | ||
amount: depositDto.toAmount || '0', | ||
}, | ||
], | ||
type: CoreTypes_1.PERMIT_TX_TYPES.CHECKOUT, | ||
taskId: "", | ||
status: "Tx Sent", | ||
txHash: trx ? (typeof trx.hash === "string" ? trx.hash : "") : "", | ||
}); | ||
} | ||
catch (error) { | ||
Logger_1.Logger.error("Error:", error); | ||
callDataResultSet.push({ | ||
tokenInfo: [ | ||
{ | ||
tokenAddress: depositDto.fromTokenAddress, | ||
amount: depositDto.toAmount || '0', | ||
}, | ||
], | ||
type: CoreTypes_1.PERMIT_TX_TYPES.CHECKOUT, | ||
taskId: "", | ||
status: error.toString(), | ||
txHash: "", | ||
}); | ||
} | ||
} | ||
return callDataResultSet; | ||
} | ||
async getDepositRoute(depositRouteDto) { | ||
try { | ||
const routes = await (0, Helper_1.generateDepositCallData)(depositRouteDto, this.apiKey); | ||
return routes; | ||
} | ||
catch (error) { | ||
throw new Error(error); | ||
} | ||
} | ||
async getCheckoutRoute(checkoutRouteDto) { | ||
try { | ||
const route = await (0, Helper_1.generateCheckoutCallData)(checkoutRouteDto, this.apiKey); | ||
return route; | ||
} | ||
catch (error) { | ||
throw new Error(error); | ||
} | ||
} | ||
async executeMigrationForward(executeMigrationForwardDto) { | ||
@@ -427,4 +324,3 @@ const response = []; | ||
Logger_1.Logger.log(JSON.stringify(gaslessResponse)); | ||
// @ts-ignore | ||
const resultSet = gaslessResponse.data.executionTxs; | ||
const resultSet = gaslessResponse.data; | ||
for (let index = 0; index < resultSet.length; index++) { | ||
@@ -486,5 +382,3 @@ const element = resultSet[index]; | ||
} | ||
// @ts-ignore | ||
const finalResultSet = resultSet.filter((list) => list.code === 200); | ||
// @ts-ignore | ||
const errorResultSet = resultSet.filter((list) => list.code === 400); | ||
@@ -524,3 +418,3 @@ for (let index = 0; index < errorResultSet.length; index++) { | ||
if (onrampData.chainId in utils_1.OnrampDepositChains) { | ||
const url = `${Constants_1.ONRAMP_BASE_URL}?env=${CoreTypes_1.OnRampEnv.PRODUCTION}&mode=${CoreTypes_1.OnRampMode.DEPOSIT}&network=${utils_1.OnrampDepositChains[onrampData.chainId]}&walletAddress=${onrampData.walletAddress}&exchangeScreenTitle=${onrampData.exchangeScreenTitle}&aarcApiKey=${this.apiKey}&customerId=${onrampData.customerId}&cryptoCurrencyList=${onrampData.cryptoCurrencyList}&networks=${onrampData.networks}&defaultNetwork=${onrampData.defaultNetwork}&cryptoTokenData=${JSON.stringify(onrampData.cryptoTokenData)}`; | ||
const url = `${Constants_1.ONRAMP_BASE_URL}?env=${CoreTypes_1.OnRampEnv.PRODUCTION}&mode=${CoreTypes_1.OnRampMode.DEPOSIT}&network=${utils_1.OnrampDepositChains[onrampData.chainId]}&walletAddress=${onrampData.walletAddress}&exchangeScreenTitle=${onrampData.exchangeScreenTitle}&aarcApiKey=${this.apiKey}&customerId=${onrampData.customerId}&cryptoCurrencyList=${onrampData.cryptoCurrencyList}&networks=${onrampData.networks}&defaultNetwork=${onrampData.defaultNetwork}&cryptoTokenData=${JSON.stringify(onrampData.cryptoTokenData)}&fiatAmount=${onrampData.fiatAmount}&fiatCurrencyCode=${onrampData.fiatCurrencyCode}&countryCode=${onrampData.countryCode}`; | ||
return url; | ||
@@ -562,5 +456,5 @@ } | ||
} | ||
async generateMoonpayOnrampUrl(onRamData) { | ||
async generateMoonpayOnrampUrl(onrampData) { | ||
try { | ||
const url = `${Constants_1.ONRAMP_BASE_URL}?aarcApiKey=${this.apiKey}&walletAddress=${onRamData.walletAddress}&fiatCurrencyCode=${onRamData.fiatCurrencyCode}&fiatAmount=${onRamData.fiatAmount}&defaultCryptoCurrencyCode=${onRamData.defaultCryptoCurrencyCode}&platform=moonpay`; | ||
const url = `${Constants_1.ONRAMP_BASE_URL}?aarcApiKey=${this.apiKey}&walletAddress=${onrampData.walletAddress}&fiatCurrencyCode=${onrampData.fiatCurrencyCode}&fiatAmount=${onrampData.fiatAmount}&defaultCryptoCurrencyCode=${onrampData.defaultCryptoCurrencyCode}&cryptoTokenData=${JSON.stringify(onrampData.cryptoTokenData || {})}&platform=moonpay`; | ||
return url; | ||
@@ -567,0 +461,0 @@ } |
@@ -1,17 +0,16 @@ | ||
export declare const MIGRATE_BASE_URL = "https://migrator.staging.aarc.xyz"; | ||
export declare const BRIDGE_SWAP_BASE_URL = "https://bridge-swap.staging.aarc.xyz"; | ||
export declare const BALANCES_ENDPOINT = "https://migrator.staging.aarc.xyz/migrator/balances"; | ||
export declare const GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.staging.aarc.xyz/migrate/non-gasless-calldata"; | ||
export declare const GENERATE_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.staging.aarc.xyz/migrate/gasless-deposit-calldata"; | ||
export declare const EXECUTE_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.staging.aarc.xyz/migrate/gasless-calldata-trx"; | ||
export declare const GENERATE_FORWARD_CALL_DATA_ENDPOINT = "https://migrator.staging.aarc.xyz/migrate/forward-calldata"; | ||
export declare const EXECUTE_FORWARD_CALL_DATA_ENDPOINT = "https://migrator.staging.aarc.xyz/migrate/forward-calldata-trx"; | ||
export declare const TRX_STATUS_ENDPOINT = "https://migrator.staging.aarc.xyz/migrator/tx/status"; | ||
export declare const GENERATE_DEPOSIT_CALL_DATA_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/deposit-calldata"; | ||
export declare const GENERATE_CHECKOUT_CALL_DATA_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/checkout-contract-calldata"; | ||
export declare const MULTI_CHAIN_BALANCES_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/balances"; | ||
export declare const IS_TOKEN_SUPPORTED_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/token-supported"; | ||
export declare const TOKENS_SUPPORTED_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/supported-tokens"; | ||
export declare const CHAINS_SUPPORTED_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/supported-chains"; | ||
export declare const MIGRATE_BASE_URL = "https://migrator.aarc.xyz"; | ||
export declare const BRIDGE_SWAP_BASE_URL = "https://bridge-swap.aarc.xyz"; | ||
export declare const BALANCES_ENDPOINT = "https://migrator.aarc.xyz/migrator/balances"; | ||
export declare const GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.aarc.xyz/migrate/non-gasless-calldata"; | ||
export declare const GENERATE_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.aarc.xyz/migrate/gasless-calldata"; | ||
export declare const EXECUTE_GASLESS_CALL_DATA_ENDPOINT = "https://migrator.aarc.xyz/migrate/gasless-calldata-trx"; | ||
export declare const GENERATE_FORWARD_CALL_DATA_ENDPOINT = "https://migrator.aarc.xyz/migrate/forward-calldata"; | ||
export declare const EXECUTE_FORWARD_CALL_DATA_ENDPOINT = "https://migrator.aarc.xyz/migrate/forward-calldata-trx"; | ||
export declare const TRX_STATUS_ENDPOINT = "https://migrator.aarc.xyz/migrator/tx/status"; | ||
export declare const GENERATE_DEPOSIT_CALL_DATA_ENDPOINT = "https://bridge-swap.aarc.xyz/deposit-calldata"; | ||
export declare const MULTI_CHAIN_BALANCES_ENDPOINT = "https://bridge-swap.aarc.xyz/bridge-swap/balances"; | ||
export declare const IS_TOKEN_SUPPORTED_ENDPOINT = "https://bridge-swap.aarc.xyz/bridge-swap/token-supported"; | ||
export declare const TOKENS_SUPPORTED_ENDPOINT = "https://bridge-swap.aarc.xyz/bridge-swap/supported-tokens"; | ||
export declare const CHAINS_SUPPORTED_ENDPOINT = "https://bridge-swap.aarc.xyz/bridge-swap/supported-chains"; | ||
export declare const PERMIT2_CONTRACT_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; | ||
export declare const ONRAMP_BASE_URL = "https://onramp.aarc.xyz"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ONRAMP_BASE_URL = exports.PERMIT2_CONTRACT_ADDRESS = exports.CHAINS_SUPPORTED_ENDPOINT = exports.TOKENS_SUPPORTED_ENDPOINT = exports.IS_TOKEN_SUPPORTED_ENDPOINT = exports.MULTI_CHAIN_BALANCES_ENDPOINT = exports.GENERATE_CHECKOUT_CALL_DATA_ENDPOINT = exports.GENERATE_DEPOSIT_CALL_DATA_ENDPOINT = exports.TRX_STATUS_ENDPOINT = exports.EXECUTE_FORWARD_CALL_DATA_ENDPOINT = exports.GENERATE_FORWARD_CALL_DATA_ENDPOINT = exports.EXECUTE_GASLESS_CALL_DATA_ENDPOINT = exports.GENERATE_GASLESS_CALL_DATA_ENDPOINT = exports.GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = exports.BALANCES_ENDPOINT = exports.BRIDGE_SWAP_BASE_URL = exports.MIGRATE_BASE_URL = void 0; | ||
exports.MIGRATE_BASE_URL = "https://migrator.staging.aarc.xyz"; | ||
exports.BRIDGE_SWAP_BASE_URL = "https://bridge-swap.staging.aarc.xyz"; | ||
exports.ONRAMP_BASE_URL = exports.PERMIT2_CONTRACT_ADDRESS = exports.CHAINS_SUPPORTED_ENDPOINT = exports.TOKENS_SUPPORTED_ENDPOINT = exports.IS_TOKEN_SUPPORTED_ENDPOINT = exports.MULTI_CHAIN_BALANCES_ENDPOINT = exports.GENERATE_DEPOSIT_CALL_DATA_ENDPOINT = exports.TRX_STATUS_ENDPOINT = exports.EXECUTE_FORWARD_CALL_DATA_ENDPOINT = exports.GENERATE_FORWARD_CALL_DATA_ENDPOINT = exports.EXECUTE_GASLESS_CALL_DATA_ENDPOINT = exports.GENERATE_GASLESS_CALL_DATA_ENDPOINT = exports.GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = exports.BALANCES_ENDPOINT = exports.BRIDGE_SWAP_BASE_URL = exports.MIGRATE_BASE_URL = void 0; | ||
exports.MIGRATE_BASE_URL = "https://migrator.aarc.xyz"; | ||
exports.BRIDGE_SWAP_BASE_URL = "https://bridge-swap.aarc.xyz"; | ||
exports.BALANCES_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrator/balances`; | ||
exports.GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/non-gasless-calldata`; | ||
exports.GENERATE_GASLESS_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/gasless-deposit-calldata`; | ||
exports.GENERATE_GASLESS_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/gasless-calldata`; | ||
exports.EXECUTE_GASLESS_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/gasless-calldata-trx`; | ||
@@ -14,3 +14,2 @@ exports.GENERATE_FORWARD_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/forward-calldata`; | ||
exports.GENERATE_DEPOSIT_CALL_DATA_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/deposit-calldata`; | ||
exports.GENERATE_CHECKOUT_CALL_DATA_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/checkout-contract-calldata`; | ||
exports.MULTI_CHAIN_BALANCES_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/bridge-swap/balances`; | ||
@@ -17,0 +16,0 @@ exports.IS_TOKEN_SUPPORTED_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/bridge-swap/token-supported`; |
@@ -152,12 +152,2 @@ import { BigNumberish, Signer } from "ethers"; | ||
}; | ||
export type CheckoutCalldataResponse = { | ||
success: boolean; | ||
data: { | ||
approvalTxs: ApprovalTransaction[]; | ||
executionTxs: ExecutionTransaction[]; | ||
source: string; | ||
gasFee: number; | ||
executionTime: number; | ||
}; | ||
}; | ||
export type TransferTokenDetails = { | ||
@@ -180,3 +170,4 @@ tokenAddress: string; | ||
}; | ||
export type DepositRouteDto = { | ||
export type DepositDto = { | ||
senderSigner: Signer; | ||
fromChainId: number; | ||
@@ -189,32 +180,10 @@ fromTokenAddress: string; | ||
recipient: string; | ||
destinationPayload?: string; | ||
destinationGasLimit?: number; | ||
routeType?: string; | ||
estimateGas?: boolean; | ||
}; | ||
export type DepositDto = DepositRouteDto & { | ||
senderSigner: Signer; | ||
}; | ||
export type OutputTokenPreferences = { | ||
receipient?: string; | ||
outputTokenAddress?: string; | ||
}; | ||
export type CheckoutRouteDto = { | ||
fromChainId: number; | ||
fromTokenAddress: string; | ||
toChainId: number; | ||
toTokenAddress: string; | ||
toAmount: string; | ||
targetContractAddress: string; | ||
checkoutToAmount?: string; | ||
checkoutIndex?: number; | ||
fromAddress: string; | ||
destinationPayload: string; | ||
destinationGasLimit: number; | ||
outputTokenPreferences?: OutputTokenPreferences; | ||
routeType?: string; | ||
estimateGas?: boolean; | ||
}; | ||
export type CheckoutDto = CheckoutRouteDto & { | ||
senderSigner: Signer; | ||
}; | ||
export type DepositCallDataDto = Omit<DepositDto, "senderSigner">; | ||
export type CheckoutCallDataDto = Omit<CheckoutDto, "senderSigner">; | ||
export type ExecuteMigrationForwardDto = { | ||
@@ -240,3 +209,2 @@ chainId: number; | ||
DEPOSIT = "DEPOSIT", | ||
CHECKOUT = "CHECKOUT", | ||
PERMIT = "PERMIT", | ||
@@ -420,4 +388,4 @@ PERMIT2_SINGLE = "PERMIT2_SINGLE", | ||
export interface cryptoTokenData { | ||
cryptoTokenCode: string; | ||
cryptoTokenAmount: number; | ||
tokenCode: string; | ||
tokenAmount: number | string; | ||
} | ||
@@ -442,2 +410,5 @@ export declare enum OnRampMode { | ||
cryptoTokenData?: cryptoTokenData; | ||
fiatAmount?: string; | ||
fiatCurrencyCode?: string; | ||
countryCode?: string; | ||
} | ||
@@ -461,6 +432,7 @@ export interface CheckoutOnrampParams { | ||
walletAddress: string; | ||
fiatCurrencyCode: string; | ||
fiatAmount: string; | ||
defaultCryptoCurrencyCode: string; | ||
fiatCurrencyCode?: string; | ||
fiatAmount?: string; | ||
defaultCryptoCurrencyCode?: string; | ||
cryptoTokenData?: cryptoTokenData; | ||
} | ||
export {}; |
@@ -12,3 +12,2 @@ "use strict"; | ||
PERMIT_TX_TYPES["DEPOSIT"] = "DEPOSIT"; | ||
PERMIT_TX_TYPES["CHECKOUT"] = "CHECKOUT"; | ||
PERMIT_TX_TYPES["PERMIT"] = "PERMIT"; | ||
@@ -15,0 +14,0 @@ PERMIT_TX_TYPES["PERMIT2_SINGLE"] = "PERMIT2_SINGLE"; |
@@ -1,2 +0,2 @@ | ||
import { BalancesData, BalancesResponse, CheckoutCallDataDto, CheckoutCalldataResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes"; | ||
import { BalancesData, BalancesResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes"; | ||
export declare const generateGaslessCallData: (forwardCallDataDto: ForwardCallDataDto, dappApiKey: string) => Promise<GaslessCalldataResponse>; | ||
@@ -6,3 +6,2 @@ export declare const generateNonGaslessCallData: (forwardCallDataDto: ForwardCallDataDto, dappApiKey: string) => Promise<GaslessCalldataResponse>; | ||
export declare const generateDepositCallData: (depositCallDataDto: DepositCallDataDto, dappApiKey: string) => Promise<DepositCalldataResponse>; | ||
export declare const generateCheckoutCallData: (depositCallDataDto: CheckoutCallDataDto, dappApiKey: string) => Promise<CheckoutCalldataResponse>; | ||
export declare const generateForwardCallData: (forwardCallDataDto: ForwardCallDataDto, dappApiKey: string) => Promise<ForwardCalldataRes>; | ||
@@ -9,0 +8,0 @@ export declare const executeForwardCallData: (chainId: string, forwardCalldataSet: ForwardCalldataRes, dappApiKey: string) => Promise<RelayedTxListResponse[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetTransactionStatus = exports.GetSupportedChains = exports.GetSupportedTokens = exports.IsTokenSupported = exports.getMultiChainBalances = exports.fetchBalances = exports.executeForwardCallData = exports.generateForwardCallData = exports.generateCheckoutCallData = exports.generateDepositCallData = exports.executeGaslessCallData = exports.generateNonGaslessCallData = exports.generateGaslessCallData = void 0; | ||
exports.GetTransactionStatus = exports.GetSupportedChains = exports.GetSupportedTokens = exports.IsTokenSupported = exports.getMultiChainBalances = exports.fetchBalances = exports.executeForwardCallData = exports.generateForwardCallData = exports.generateDepositCallData = exports.executeGaslessCallData = exports.generateNonGaslessCallData = exports.generateGaslessCallData = void 0; | ||
const Constants_1 = require("./Constants"); | ||
@@ -90,31 +90,2 @@ const HttpRequest_1 = require("./HttpRequest"); | ||
exports.generateDepositCallData = generateDepositCallData; | ||
const generateCheckoutCallData = async (depositCallDataDto, dappApiKey) => { | ||
try { | ||
// Destructure checkoutPreferences and other properties from depositDto | ||
const { outputTokenPreferences, ...rest } = depositCallDataDto; | ||
const callDataDto = { | ||
...rest, | ||
...outputTokenPreferences | ||
}; | ||
// Convert depositCallDataDto to a query string | ||
const queryString = (0, querystring_1.stringify)(callDataDto); | ||
// Append query string to the endpoint URL | ||
const url = `${Constants_1.GENERATE_CHECKOUT_CALL_DATA_ENDPOINT}?${queryString}`; | ||
const txResponse = await (0, HttpRequest_1.sendRequest)({ | ||
url, | ||
method: HttpRequest_1.HttpMethod.GET, | ||
headers: { | ||
"x-api-key": dappApiKey, | ||
}, | ||
}); | ||
Logger_1.Logger.log("body ", JSON.stringify(depositCallDataDto)); | ||
Logger_1.Logger.log("txResponse from server ", JSON.stringify(txResponse.data)); | ||
return txResponse; | ||
} | ||
catch (error) { | ||
Logger_1.Logger.error("error while consuming checkout call data endpoint", error); | ||
throw error; | ||
} | ||
}; | ||
exports.generateCheckoutCallData = generateCheckoutCallData; | ||
const generateForwardCallData = async (forwardCallDataDto, dappApiKey) => { | ||
@@ -121,0 +92,0 @@ try { |
{ | ||
"name": "@aarc-dev/core", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
156646
1712