@hyperbridge/sdk 1.3.3 → 1.3.4
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/dist/browser/index.d.ts
CHANGED
|
@@ -1202,7 +1202,7 @@ interface FillerConfig {
|
|
|
1202
1202
|
* Policy for determining confirmation requirements
|
|
1203
1203
|
*/
|
|
1204
1204
|
confirmationPolicy: {
|
|
1205
|
-
getConfirmationBlocks: (chainId: number,
|
|
1205
|
+
getConfirmationBlocks: (chainId: number, amountUsd: number) => number;
|
|
1206
1206
|
};
|
|
1207
1207
|
/**
|
|
1208
1208
|
* Maximum number of orders to process concurrently
|
|
@@ -1852,7 +1852,7 @@ declare function estimateGasForPost(params: {
|
|
|
1852
1852
|
* to match the format expected by the IntentGateway contract.
|
|
1853
1853
|
*/
|
|
1854
1854
|
declare function constructRedeemEscrowRequestBody(order: Order, beneficiary: HexString): HexString;
|
|
1855
|
-
declare function fetchPrice(identifier: string, chainId?: number): Promise<number>;
|
|
1855
|
+
declare function fetchPrice(identifier: string, chainId?: number, apiKey?: string): Promise<number>;
|
|
1856
1856
|
/**
|
|
1857
1857
|
* ERC20 method signatures used for storage slot detection
|
|
1858
1858
|
*/
|
package/dist/browser/index.js
CHANGED
|
@@ -4469,10 +4469,10 @@ function mapTestnetToMainnet(identifier) {
|
|
|
4469
4469
|
return identifier;
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
|
-
async function fetchPrice(identifier, chainId = 1) {
|
|
4472
|
+
async function fetchPrice(identifier, chainId = 1, apiKey) {
|
|
4473
4473
|
const mappedIdentifier = mapTestnetToMainnet(identifier);
|
|
4474
4474
|
const network = new ChainConfigService().getCoingeckoId(`EVM-${chainId}`) || "ethereum";
|
|
4475
|
-
|
|
4475
|
+
apiKey = apiKey || (typeof process !== "undefined" ? process?.env?.COINGECKO : void 0);
|
|
4476
4476
|
const baseUrl = apiKey ? "https://pro-api.coingecko.com/api/v3" : "https://api.coingecko.com/api/v3";
|
|
4477
4477
|
const url = mappedIdentifier.startsWith("0x") ? `${baseUrl}/simple/token_price/${network}?contract_addresses=${mappedIdentifier}&vs_currencies=usd` : `${baseUrl}/simple/price?ids=${mappedIdentifier}&vs_currencies=usd`;
|
|
4478
4478
|
const headers = apiKey ? { "x-cg-pro-api-key": apiKey } : void 0;
|
|
@@ -11459,8 +11459,7 @@ var IntentGateway = class {
|
|
|
11459
11459
|
this.source.client,
|
|
11460
11460
|
sourceChainFeeTokenDecimals
|
|
11461
11461
|
);
|
|
11462
|
-
const
|
|
11463
|
-
const relayerFeeInSourceFeeToken = postGasEstimateInSourceFeeToken + postGasEstimateInSourceFeeToken * RELAYER_FEE_BPS / 10000n;
|
|
11462
|
+
const relayerFeeInSourceFeeToken = postGasEstimateInSourceFeeToken + 25n * 10n ** BigInt(sourceChainFeeTokenDecimals - 2);
|
|
11464
11463
|
const relayerFeeInDestFeeToken = adjustFeeDecimals(
|
|
11465
11464
|
relayerFeeInSourceFeeToken,
|
|
11466
11465
|
sourceChainFeeTokenDecimals,
|
|
@@ -11515,7 +11514,8 @@ var IntentGateway = class {
|
|
|
11515
11514
|
];
|
|
11516
11515
|
let destChainFillGas = 0n;
|
|
11517
11516
|
try {
|
|
11518
|
-
|
|
11517
|
+
let protocolFeeInNativeToken = await this.quoteNative(postRequest, relayerFeeInDestFeeToken);
|
|
11518
|
+
protocolFeeInNativeToken = protocolFeeInNativeToken + protocolFeeInNativeToken * 50n / 10000n;
|
|
11519
11519
|
destChainFillGas = await this.dest.client.estimateContractGas({
|
|
11520
11520
|
abi: IntentGateway_default.ABI,
|
|
11521
11521
|
address: intentGatewayAddress,
|
|
@@ -11571,7 +11571,7 @@ var IntentGateway = class {
|
|
|
11571
11571
|
sourceChainFeeTokenDecimals
|
|
11572
11572
|
);
|
|
11573
11573
|
const totalEstimate = fillGasInSourceFeeToken + protocolFeeInSourceFeeToken + relayerFeeInSourceFeeToken;
|
|
11574
|
-
const SWAP_OPERATIONS_BPS =
|
|
11574
|
+
const SWAP_OPERATIONS_BPS = 3500n;
|
|
11575
11575
|
const swapOperationsInFeeToken = totalEstimate * SWAP_OPERATIONS_BPS / 10000n;
|
|
11576
11576
|
const totalFeeTokenAmount = totalEstimate + swapOperationsInFeeToken;
|
|
11577
11577
|
const totalNativeTokenAmount = await this.convertFeeTokenToNative(
|