@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/node/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/node/index.js
CHANGED
|
@@ -4420,10 +4420,10 @@ function mapTestnetToMainnet(identifier) {
|
|
|
4420
4420
|
return identifier;
|
|
4421
4421
|
}
|
|
4422
4422
|
}
|
|
4423
|
-
async function fetchPrice(identifier, chainId = 1) {
|
|
4423
|
+
async function fetchPrice(identifier, chainId = 1, apiKey) {
|
|
4424
4424
|
const mappedIdentifier = mapTestnetToMainnet(identifier);
|
|
4425
4425
|
const network = new ChainConfigService().getCoingeckoId(`EVM-${chainId}`) || "ethereum";
|
|
4426
|
-
|
|
4426
|
+
apiKey = apiKey || (typeof process !== "undefined" ? process?.env?.COINGECKO : void 0);
|
|
4427
4427
|
const baseUrl = apiKey ? "https://pro-api.coingecko.com/api/v3" : "https://api.coingecko.com/api/v3";
|
|
4428
4428
|
const url = mappedIdentifier.startsWith("0x") ? `${baseUrl}/simple/token_price/${network}?contract_addresses=${mappedIdentifier}&vs_currencies=usd` : `${baseUrl}/simple/price?ids=${mappedIdentifier}&vs_currencies=usd`;
|
|
4429
4429
|
const headers = apiKey ? { "x-cg-pro-api-key": apiKey } : void 0;
|
|
@@ -11410,8 +11410,7 @@ var IntentGateway = class {
|
|
|
11410
11410
|
this.source.client,
|
|
11411
11411
|
sourceChainFeeTokenDecimals
|
|
11412
11412
|
);
|
|
11413
|
-
const
|
|
11414
|
-
const relayerFeeInSourceFeeToken = postGasEstimateInSourceFeeToken + postGasEstimateInSourceFeeToken * RELAYER_FEE_BPS / 10000n;
|
|
11413
|
+
const relayerFeeInSourceFeeToken = postGasEstimateInSourceFeeToken + 25n * 10n ** BigInt(sourceChainFeeTokenDecimals - 2);
|
|
11415
11414
|
const relayerFeeInDestFeeToken = adjustFeeDecimals(
|
|
11416
11415
|
relayerFeeInSourceFeeToken,
|
|
11417
11416
|
sourceChainFeeTokenDecimals,
|
|
@@ -11466,7 +11465,8 @@ var IntentGateway = class {
|
|
|
11466
11465
|
];
|
|
11467
11466
|
let destChainFillGas = 0n;
|
|
11468
11467
|
try {
|
|
11469
|
-
|
|
11468
|
+
let protocolFeeInNativeToken = await this.quoteNative(postRequest, relayerFeeInDestFeeToken);
|
|
11469
|
+
protocolFeeInNativeToken = protocolFeeInNativeToken + protocolFeeInNativeToken * 50n / 10000n;
|
|
11470
11470
|
destChainFillGas = await this.dest.client.estimateContractGas({
|
|
11471
11471
|
abi: IntentGateway_default.ABI,
|
|
11472
11472
|
address: intentGatewayAddress,
|
|
@@ -11522,7 +11522,7 @@ var IntentGateway = class {
|
|
|
11522
11522
|
sourceChainFeeTokenDecimals
|
|
11523
11523
|
);
|
|
11524
11524
|
const totalEstimate = fillGasInSourceFeeToken + protocolFeeInSourceFeeToken + relayerFeeInSourceFeeToken;
|
|
11525
|
-
const SWAP_OPERATIONS_BPS =
|
|
11525
|
+
const SWAP_OPERATIONS_BPS = 3500n;
|
|
11526
11526
|
const swapOperationsInFeeToken = totalEstimate * SWAP_OPERATIONS_BPS / 10000n;
|
|
11527
11527
|
const totalFeeTokenAmount = totalEstimate + swapOperationsInFeeToken;
|
|
11528
11528
|
const totalNativeTokenAmount = await this.convertFeeTokenToNative(
|