Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aarc-dev/core

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aarc-dev/core - npm Package Compare versions

Comparing version 0.0.7 to 0.0.9

7

dist/src/AarcCore.d.ts

@@ -1,5 +0,5 @@

import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse } from "./utils/CoreTypes";
import { ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, RelayedTxListResponse, BalancesResponse, DepositDto, BalancesData, IsTokenSupportedResponse, SupportedTokensResponse, SupportedChainInfo, TrxStatusResponse, OnrampViaHttps } from "./utils/CoreTypes";
export declare class AarcCore {
apiKey: string;
constructor(apiKey: string);
constructor(apiKey: string, isDebug?: boolean);
/**

@@ -11,3 +11,3 @@ * @description this function will return balances of ERC-20, ERC-721 and native tokens

fetchBalances(eoaAddress: string, chainId: number, fetchBalancesOnly?: boolean, tokenAddresses?: string[]): Promise<BalancesResponse>;
fetchMultiChainBalances(eoaAddress: string): Promise<BalancesData>;
fetchMultiChainBalances(eoaAddress: string, extendedBalances?: boolean): Promise<BalancesData>;
isTokenSupported(chainId: number, tokenAddress: string): Promise<IsTokenSupportedResponse>;

@@ -21,3 +21,4 @@ getSupportedTokens(chainId: number): Promise<SupportedTokensResponse>;

getTransactionStatus(taskId: string): Promise<TrxStatusResponse>;
generateOnrampUrl(onrampData: OnrampViaHttps): Promise<string | Error>;
}
export default AarcCore;

@@ -10,5 +10,7 @@ "use strict";

const Permit2BatchTransfer_abi_1 = require("./utils/abis/Permit2BatchTransfer.abi");
const utils_1 = require("utils");
class AarcCore {
constructor(apiKey) {
constructor(apiKey, isDebug = false) {
this.apiKey = apiKey;
Logger_1.Logger.isDebug = isDebug;
}

@@ -23,4 +25,4 @@ /**

}
async fetchMultiChainBalances(eoaAddress) {
return await (0, Helper_1.getMultiChainBalances)(this.apiKey, eoaAddress);
async fetchMultiChainBalances(eoaAddress, extendedBalances = false) {
return await (0, Helper_1.getMultiChainBalances)(this.apiKey, eoaAddress, extendedBalances);
}

@@ -409,2 +411,58 @@ async isTokenSupported(chainId, tokenAddress) {

}
async generateOnrampUrl(onrampData) {
if (onrampData.mode == CoreTypes_1.OnRampMode.DEPOSIT) {
const requiredParams = ['exchangeScreenTitle'];
let missingParams = [];
for (const [key, value] of Object.entries(onrampData)) {
if (key in requiredParams) {
if (!value)
missingParams.push(key);
}
}
if (missingParams.length > 0) {
throw new Error(`Missing ${missingParams} Params for mode ${onrampData.mode}`);
}
const url = `${Constants_1.ONRAMP_BASE_URL}?
env=${onrampData.env}
&mode=${onrampData.mode}
&network=${utils_1.OnrampDepositChains[onrampData.chainId]}
&walletAddress=${onrampData.walletAddress}
&exchangeScreenTitle=${onrampData.exchangeScreenTitle}
&aarc_api_key=${this.apiKey}
&customerId=${onrampData.customerId}
&cryptoCurrencyList=${onrampData.cryptoCurrencyList}
`;
return url;
}
else if (onrampData.mode == CoreTypes_1.OnRampMode.CHECKOUT) {
const requiredParams = ['callData', 'estimatedGasLimit', 'smartContractAddress', 'sourceTokenData'];
let missingParams = [];
for (const [key, value] of Object.entries(onrampData)) {
if (key in requiredParams) {
if (!value)
missingParams.push(key);
}
}
if (missingParams.length > 0) {
throw new Error(`Missing ${missingParams} Params for mode ${onrampData.mode}`);
}
const url = `${Constants_1.ONRAMP_BASE_URL}?
env=${onrampData.env}
&mode=${onrampData.mode}
&network=${utils_1.OnrampCheckoutChains[onrampData.chainId]}
&walletAddress=${onrampData.walletAddress}
&estimatedGasLimit=${onrampData.estimatedGasLimit}
&smartContractAddress=${onrampData.smartContractAddress}
&sourceTokenData=${JSON.stringify(onrampData.sourceTokenData)}
&calldata=${onrampData.callData}
&cryptoCurrencyData=${JSON.stringify(onrampData.cryptoCurrencyData)}
&aarc_api_key=${this.apiKey}
&customerId=${onrampData.customerId}
`;
return url;
}
else {
return new Error('Invalid mode params');
}
}
}

@@ -411,0 +469,0 @@ exports.AarcCore = AarcCore;

@@ -27,1 +27,50 @@ export declare enum ChainNames {

}
export declare enum OnrampDepositChains {
ethereum = 1,
arbitrum = 42161,
optimism = 10,
polygonzkevm = 1101,
zksync = 324,
linea = 59144,
base = 8453,
immutablezkevm = 13371,
polygon = 137,
algorand = 8,
bsc = 56,
mantle = 5000,
opBNB = 204,
solana = 101,
hedera = 295,
fuse = 122,
skale = 1482601649,
palm = 11297108109,
cronos = 25,
flow = 747,
sei = 1329,
xinfin = 51,
celo = 42220,
chiliz = 88888,
fantom = 250,
flare = 14,
velasevm = 106,
iotx = 4689,
oasis = 42262,
astar = 592,
evmos = 9001,
aurora = 1313161554,
ronin = 2020,
thundercore = 108,
wanchain = 888,
near = 397,
moonriver = 1285,
oasys = 248,
lukso = 42
}
export declare enum OnrampCheckoutChains {
ethereum = 1,
arbitrum = 42161,
bsc = 56,
immutablezkevm = 13371,
polygon = 137,
optimism = 10
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChainId = exports.ChainNames = void 0;
exports.OnrampCheckoutChains = exports.OnrampDepositChains = exports.ChainId = exports.ChainNames = void 0;
var ChainNames;

@@ -32,2 +32,53 @@ (function (ChainNames) {

})(ChainId || (exports.ChainId = ChainId = {}));
var OnrampDepositChains;
(function (OnrampDepositChains) {
OnrampDepositChains[OnrampDepositChains["ethereum"] = 1] = "ethereum";
OnrampDepositChains[OnrampDepositChains["arbitrum"] = 42161] = "arbitrum";
OnrampDepositChains[OnrampDepositChains["optimism"] = 10] = "optimism";
OnrampDepositChains[OnrampDepositChains["polygonzkevm"] = 1101] = "polygonzkevm";
OnrampDepositChains[OnrampDepositChains["zksync"] = 324] = "zksync";
OnrampDepositChains[OnrampDepositChains["linea"] = 59144] = "linea";
OnrampDepositChains[OnrampDepositChains["base"] = 8453] = "base";
OnrampDepositChains[OnrampDepositChains["immutablezkevm"] = 13371] = "immutablezkevm";
OnrampDepositChains[OnrampDepositChains["polygon"] = 137] = "polygon";
OnrampDepositChains[OnrampDepositChains["algorand"] = 8] = "algorand";
OnrampDepositChains[OnrampDepositChains["bsc"] = 56] = "bsc";
OnrampDepositChains[OnrampDepositChains["mantle"] = 5000] = "mantle";
OnrampDepositChains[OnrampDepositChains["opBNB"] = 204] = "opBNB";
OnrampDepositChains[OnrampDepositChains["solana"] = 101] = "solana";
OnrampDepositChains[OnrampDepositChains["hedera"] = 295] = "hedera";
OnrampDepositChains[OnrampDepositChains["fuse"] = 122] = "fuse";
OnrampDepositChains[OnrampDepositChains["skale"] = 1482601649] = "skale";
OnrampDepositChains[OnrampDepositChains["palm"] = 11297108109] = "palm";
OnrampDepositChains[OnrampDepositChains["cronos"] = 25] = "cronos";
OnrampDepositChains[OnrampDepositChains["flow"] = 747] = "flow";
OnrampDepositChains[OnrampDepositChains["sei"] = 1329] = "sei";
OnrampDepositChains[OnrampDepositChains["xinfin"] = 51] = "xinfin";
OnrampDepositChains[OnrampDepositChains["celo"] = 42220] = "celo";
OnrampDepositChains[OnrampDepositChains["chiliz"] = 88888] = "chiliz";
OnrampDepositChains[OnrampDepositChains["fantom"] = 250] = "fantom";
OnrampDepositChains[OnrampDepositChains["flare"] = 14] = "flare";
OnrampDepositChains[OnrampDepositChains["velasevm"] = 106] = "velasevm";
OnrampDepositChains[OnrampDepositChains["iotx"] = 4689] = "iotx";
OnrampDepositChains[OnrampDepositChains["oasis"] = 42262] = "oasis";
OnrampDepositChains[OnrampDepositChains["astar"] = 592] = "astar";
OnrampDepositChains[OnrampDepositChains["evmos"] = 9001] = "evmos";
OnrampDepositChains[OnrampDepositChains["aurora"] = 1313161554] = "aurora";
OnrampDepositChains[OnrampDepositChains["ronin"] = 2020] = "ronin";
OnrampDepositChains[OnrampDepositChains["thundercore"] = 108] = "thundercore";
OnrampDepositChains[OnrampDepositChains["wanchain"] = 888] = "wanchain";
OnrampDepositChains[OnrampDepositChains["near"] = 397] = "near";
OnrampDepositChains[OnrampDepositChains["moonriver"] = 1285] = "moonriver";
OnrampDepositChains[OnrampDepositChains["oasys"] = 248] = "oasys";
OnrampDepositChains[OnrampDepositChains["lukso"] = 42] = "lukso";
})(OnrampDepositChains || (exports.OnrampDepositChains = OnrampDepositChains = {}));
var OnrampCheckoutChains;
(function (OnrampCheckoutChains) {
OnrampCheckoutChains[OnrampCheckoutChains["ethereum"] = 1] = "ethereum";
OnrampCheckoutChains[OnrampCheckoutChains["arbitrum"] = 42161] = "arbitrum";
OnrampCheckoutChains[OnrampCheckoutChains["bsc"] = 56] = "bsc";
OnrampCheckoutChains[OnrampCheckoutChains["immutablezkevm"] = 13371] = "immutablezkevm";
OnrampCheckoutChains[OnrampCheckoutChains["polygon"] = 137] = "polygon";
OnrampCheckoutChains[OnrampCheckoutChains["optimism"] = 10] = "optimism";
})(OnrampCheckoutChains || (exports.OnrampCheckoutChains = OnrampCheckoutChains = {}));
//# sourceMappingURL=ChainTypes.js.map

@@ -1,15 +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-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 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.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.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`;

@@ -19,2 +19,3 @@ exports.GENERATE_NON_GASLESS_CALL_DATA_ENDPOINT = `${exports.MIGRATE_BASE_URL}/migrate/non-gasless-calldata`;

exports.PERMIT2_CONTRACT_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
exports.ONRAMP_BASE_URL = 'https://onramp.aarc.xyz';
//# sourceMappingURL=Constants.js.map

@@ -377,2 +377,29 @@ import { BigNumberish, Signer } from "ethers";

};
export interface SourceTokenData {
sourceTokenCode: string;
sourceTokenAmount: number;
}
export declare enum OnRampMode {
'CHECKOUT' = "checkout",
'DEPOSIT' = "deposit"
}
export interface CryptoCurrencyData {
cryptoCurrencyCode: string;
cryptoCurrencyName: string;
cryptoCurrencyImageURL: string;
}
export interface OnrampViaHttps {
env: string;
mode: string;
walletAddress: string;
chainId: number;
customerId?: string;
exchangeScreenTitle?: string;
estimatedGasLimit?: number;
smartContractAddress?: string;
sourceTokenData?: SourceTokenData;
cryptoCurrencyList?: string[];
cryptoCurrencyData?: CryptoCurrencyData;
callData?: string;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GAS_TOKEN_ADDRESSES = exports.PERMIT_TX_TYPES = void 0;
exports.OnRampMode = exports.GAS_TOKEN_ADDRESSES = exports.PERMIT_TX_TYPES = void 0;
const ChainTypes_1 = require("./ChainTypes");

@@ -36,2 +36,7 @@ var PERMIT_TX_TYPES;

};
var OnRampMode;
(function (OnRampMode) {
OnRampMode["CHECKOUT"] = "checkout";
OnRampMode["DEPOSIT"] = "deposit";
})(OnRampMode || (exports.OnRampMode = OnRampMode = {}));
//# sourceMappingURL=CoreTypes.js.map

@@ -14,3 +14,3 @@ import { BalancesData, BalancesResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes";

export declare const fetchBalances: (apiKey: string, chainId: number, eoaAddress: string, fetchBalancesOnly?: boolean, tokenAddresses?: string[]) => Promise<BalancesResponse>;
export declare const getMultiChainBalances: (apiKey: string, walletAddress: 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>;

@@ -17,0 +17,0 @@ export declare const GetSupportedTokens: (apiKey: string, chainId: number, isShortList?: boolean) => Promise<SupportedTokensResponse>;

@@ -163,4 +163,4 @@ "use strict";

exports.fetchBalances = fetchBalances;
const getMultiChainBalances = async (apiKey, walletAddress) => {
const response = await fetch(`${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}`, {
const getMultiChainBalances = async (apiKey, walletAddress, extendedBalances = false) => {
const response = await fetch(`${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}/${extendedBalances}`, {
method: "GET",

@@ -167,0 +167,0 @@ headers: {

@@ -49,7 +49,2 @@ "use strict";

exports.Logger = Logger;
Logger.isDebug = process.env.SDK_DEBUG === "true"
? true
: process.env.REACT_APP_SDK_DEBUG === "true"
? true
: false;
//# sourceMappingURL=Logger.js.map
{
"name": "@aarc-dev/core",
"version": "0.0.7",
"version": "0.0.9",
"description": "",

@@ -38,4 +38,3 @@ "main": "./dist/src/index.js",

"@ethersproject/abstract-signer": "^5.7.0",
"ethers": "6.9.0",
"dotenv": "^16.4.3"
"ethers": "6.9.2"
},

@@ -42,0 +41,0 @@ "devDependencies": {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc