@aarc-dev/core
Advanced tools
Comparing version 0.0.19 to 0.1.4
@@ -1,2 +0,2 @@ | ||
import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse, DepositOnRampParams, CheckoutOnrampParams, CheckoutDto, DepositRouteDto, DepositCalldataResponse, CheckoutRouteDto, PriceData } from "./utils/CoreTypes"; | ||
import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse, DepositOnRampParams, CheckoutOnrampParams, CheckoutDto, DepositRouteDto, DepositCalldataResponse, CheckoutRouteDto, MoonpayOnRampParams } from "./utils/CoreTypes"; | ||
export declare class AarcCore { | ||
@@ -11,4 +11,3 @@ apiKey: string; | ||
fetchBalances(eoaAddress: string, chainId: number, fetchBalancesOnly?: boolean, tokenAddresses?: string[]): Promise<BalancesResponse>; | ||
fetchMultiChainBalances(eoaAddress: string, extendedBalances?: boolean, destinationTokenAmount?: string, destinationTokenSymbol?: string): Promise<BalancesData>; | ||
fetchTokenPrice(tokenSymbol: string): Promise<PriceData>; | ||
fetchMultiChainBalances(eoaAddress: string, extendedBalances?: boolean): Promise<BalancesData>; | ||
isTokenSupported(chainId: number, tokenAddress: string): Promise<IsTokenSupportedResponse>; | ||
@@ -27,3 +26,4 @@ getSupportedTokens(chainId: number): Promise<SupportedTokensResponse>; | ||
generateCheckoutOnrampUrl(onrampData: CheckoutOnrampParams): Promise<string | Error>; | ||
generateMoonpayOnrampUrl(onRamData: MoonpayOnRampParams): Promise<string | Error>; | ||
} | ||
export default AarcCore; |
@@ -24,8 +24,5 @@ "use strict"; | ||
} | ||
async fetchMultiChainBalances(eoaAddress, extendedBalances = false, destinationTokenAmount, destinationTokenSymbol) { | ||
async fetchMultiChainBalances(eoaAddress, extendedBalances = false) { | ||
return await (0, Helper_1.getMultiChainBalances)(this.apiKey, eoaAddress, extendedBalances); | ||
} | ||
async fetchTokenPrice(tokenSymbol) { | ||
return await (0, Helper_1.getTokenPrice)(this.apiKey, tokenSymbol); | ||
} | ||
async isTokenSupported(chainId, tokenAddress) { | ||
@@ -524,3 +521,3 @@ return await (0, Helper_1.IsTokenSupported)(this.apiKey, chainId, tokenAddress); | ||
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}`; | ||
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)}`; | ||
return url; | ||
@@ -562,2 +559,12 @@ } | ||
} | ||
async generateMoonpayOnrampUrl(onRamData) { | ||
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`; | ||
return url; | ||
} | ||
catch (error) { | ||
Logger_1.Logger.error("Generate onramp url error: ", error); | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -564,0 +571,0 @@ exports.AarcCore = AarcCore; |
@@ -13,3 +13,2 @@ export declare const MIGRATE_BASE_URL = "https://migrator.staging.aarc.xyz"; | ||
export declare const MULTI_CHAIN_BALANCES_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/balances"; | ||
export declare const TOKEN_PRICE_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/token-price"; | ||
export declare const IS_TOKEN_SUPPORTED_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/token-supported"; | ||
@@ -16,0 +15,0 @@ export declare const TOKENS_SUPPORTED_ENDPOINT = "https://bridge-swap.staging.aarc.xyz/bridge-swap/supported-tokens"; |
"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.TOKEN_PRICE_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.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"; | ||
@@ -16,3 +16,2 @@ exports.BRIDGE_SWAP_BASE_URL = "https://bridge-swap.staging.aarc.xyz"; | ||
exports.MULTI_CHAIN_BALANCES_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/bridge-swap/balances`; | ||
exports.TOKEN_PRICE_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/token-price`; | ||
exports.IS_TOKEN_SUPPORTED_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/bridge-swap/token-supported`; | ||
@@ -19,0 +18,0 @@ exports.TOKENS_SUPPORTED_ENDPOINT = `${exports.BRIDGE_SWAP_BASE_URL}/bridge-swap/supported-tokens`; |
@@ -350,5 +350,2 @@ import { BigNumberish, Signer } from "ethers"; | ||
}; | ||
export type PriceData = { | ||
"tokenPrice": string; | ||
}; | ||
export type IsTokenSupportedResponse = { | ||
@@ -419,2 +416,6 @@ success: boolean; | ||
} | ||
export interface cryptoTokenData { | ||
cryptoTokenCode: string; | ||
cryptoTokenAmount: number; | ||
} | ||
export declare enum OnRampMode { | ||
@@ -435,2 +436,5 @@ CHECKOUT = "checkout", | ||
cryptoCurrencyList?: string[]; | ||
networks?: string[]; | ||
defaultNetwork?: string; | ||
cryptoTokenData?: cryptoTokenData; | ||
} | ||
@@ -452,2 +456,8 @@ export interface CheckoutOnrampParams { | ||
} | ||
export interface MoonpayOnRampParams { | ||
walletAddress: string; | ||
fiatCurrencyCode: string; | ||
fiatAmount: string; | ||
defaultCryptoCurrencyCode: string; | ||
} | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { BalancesData, BalancesResponse, CheckoutCallDataDto, CheckoutCalldataResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, PriceData, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes"; | ||
import { BalancesData, BalancesResponse, CheckoutCallDataDto, CheckoutCalldataResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes"; | ||
export declare const generateGaslessCallData: (forwardCallDataDto: ForwardCallDataDto, dappApiKey: string) => Promise<GaslessCalldataResponse>; | ||
@@ -15,4 +15,3 @@ export declare const generateNonGaslessCallData: (forwardCallDataDto: ForwardCallDataDto, dappApiKey: string) => Promise<GaslessCalldataResponse>; | ||
export declare const fetchBalances: (apiKey: string, chainId: number, eoaAddress: string, fetchBalancesOnly?: boolean, tokenAddresses?: string[]) => Promise<BalancesResponse>; | ||
export declare const getTokenPrice: (apiKey: string, tokenSymbol: string) => Promise<PriceData>; | ||
export declare const getMultiChainBalances: (apiKey: string, walletAddress: string, extendedBalances?: boolean, destinationTokenAmount?: string, destinationTokenSymbol?: string) => Promise<BalancesData>; | ||
export declare const getMultiChainBalances: (apiKey: string, walletAddress: string, extendedBalances?: boolean) => Promise<BalancesData>; | ||
export declare const IsTokenSupported: (apiKey: string, chainId: number, address: string) => Promise<IsTokenSupportedResponse>; | ||
@@ -19,0 +18,0 @@ export declare const GetSupportedTokens: (apiKey: string, chainId: number, isShortList?: boolean) => Promise<SupportedTokensResponse>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetTransactionStatus = exports.GetSupportedChains = exports.GetSupportedTokens = exports.IsTokenSupported = exports.getMultiChainBalances = exports.getTokenPrice = 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.generateCheckoutCallData = exports.generateDepositCallData = exports.executeGaslessCallData = exports.generateNonGaslessCallData = exports.generateGaslessCallData = void 0; | ||
const Constants_1 = require("./Constants"); | ||
@@ -192,4 +192,4 @@ const HttpRequest_1 = require("./HttpRequest"); | ||
exports.fetchBalances = fetchBalances; | ||
const getTokenPrice = async (apiKey, tokenSymbol) => { | ||
const response = await fetch(`${Constants_1.TOKEN_PRICE_ENDPOINT}/${tokenSymbol}`, { | ||
const getMultiChainBalances = async (apiKey, walletAddress, extendedBalances = false) => { | ||
const response = await fetch(`${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}/${extendedBalances}`, { | ||
method: "GET", | ||
@@ -205,19 +205,2 @@ headers: { | ||
}; | ||
exports.getTokenPrice = getTokenPrice; | ||
const getMultiChainBalances = async (apiKey, walletAddress, extendedBalances = false, destinationTokenAmount, destinationTokenSymbol) => { | ||
var requestURL = `${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}/${extendedBalances}`; | ||
if (destinationTokenAmount && destinationTokenSymbol) { | ||
requestURL += `?tokenAmount=${destinationTokenAmount}&tokenSymbol=${destinationTokenSymbol}`; | ||
} | ||
const response = await fetch(requestURL, { | ||
method: "GET", | ||
headers: { | ||
"x-api-key": apiKey, | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
const json = await response.json(); | ||
return json; | ||
}; | ||
exports.getMultiChainBalances = getMultiChainBalances; | ||
@@ -224,0 +207,0 @@ // Makes a GET request to Aarc APIs for supported token by address and chainId |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendRequest = exports.HttpMethod = void 0; | ||
exports.HttpMethod = void 0; | ||
exports.sendRequest = sendRequest; | ||
const Logger_1 = require("./Logger"); | ||
@@ -79,3 +80,2 @@ var HttpMethod; | ||
} | ||
exports.sendRequest = sendRequest; | ||
//# sourceMappingURL=HttpRequest.js.map |
{ | ||
"name": "@aarc-dev/core", | ||
"version": "0.0.19", | ||
"version": "0.1.4", | ||
"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
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
167545
1882