@imtbl/sdk 0.3.0-alpha.2 → 0.3.0-alpha.3
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/blockchain-data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +11 -0
- package/dist/checkout_sdk.js +23 -3
- package/dist/checkout_widgets.d.ts +3 -0
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +15 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +90 -43
- package/dist/index.d.ts +32 -4
- package/dist/index.js +77 -31
- package/dist/passport.d.ts +18 -4
- package/dist/passport.js +52 -26
- package/package.json +2 -2
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -565,6 +565,16 @@ interface ModuleConfiguration<T> {
|
|
|
565
565
|
overrides?: T;
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
+
/**
|
|
569
|
+
* Interface representing the secondary fees for a swap
|
|
570
|
+
* @property {string} feeRecipient - The fee recipient address
|
|
571
|
+
* @property {number} feeBasisPoints - The fee percentage in basis points
|
|
572
|
+
* @example 100 basis points = 1%
|
|
573
|
+
*/
|
|
574
|
+
type SecondaryFee = {
|
|
575
|
+
feeRecipient: string;
|
|
576
|
+
feeBasisPoints: number;
|
|
577
|
+
};
|
|
568
578
|
/**
|
|
569
579
|
* Interface representing a token
|
|
570
580
|
* @property {number} chainId - The chain ID
|
|
@@ -585,6 +595,7 @@ interface ExchangeOverrides {
|
|
|
585
595
|
exchangeContracts: ExchangeContracts;
|
|
586
596
|
commonRoutingTokens: TokenInfo$1[];
|
|
587
597
|
nativeToken: TokenInfo$1;
|
|
598
|
+
secondaryFees?: SecondaryFee[];
|
|
588
599
|
}
|
|
589
600
|
|
|
590
601
|
/**
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -12512,16 +12512,28 @@ const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
|
|
|
12512
12512
|
[Environment$1.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
|
|
12513
12513
|
};
|
|
12514
12514
|
function validateOverrides(overrides) {
|
|
12515
|
-
|
|
12516
|
-
|
|
12515
|
+
const keysToCheck = ['rpcURL', 'exchangeContracts', 'commonRoutingTokens', 'nativeToken'];
|
|
12516
|
+
for (const key of keysToCheck) {
|
|
12517
|
+
if (!overrides[key]) {
|
|
12517
12518
|
throw new InvalidConfigurationError(`Missing override: ${key}`);
|
|
12518
12519
|
}
|
|
12519
|
-
}
|
|
12520
|
+
}
|
|
12520
12521
|
Object.entries(overrides.exchangeContracts).forEach(([key, contract]) => {
|
|
12521
12522
|
if (!isValidNonZeroAddress(contract)) {
|
|
12522
12523
|
throw new InvalidConfigurationError(`Invalid exchange contract address for ${key}`);
|
|
12523
12524
|
}
|
|
12524
12525
|
});
|
|
12526
|
+
if (!overrides.secondaryFees) {
|
|
12527
|
+
return;
|
|
12528
|
+
}
|
|
12529
|
+
for (const secondaryFee of overrides.secondaryFees) {
|
|
12530
|
+
if (!isValidNonZeroAddress(secondaryFee.feeRecipient)) {
|
|
12531
|
+
throw new InvalidConfigurationError(`Invalid secondary fee recipient address: ${secondaryFee.feeRecipient}`);
|
|
12532
|
+
}
|
|
12533
|
+
if (secondaryFee.feeBasisPoints < 0 || secondaryFee.feeBasisPoints > 10000) {
|
|
12534
|
+
throw new InvalidConfigurationError(`Invalid secondary fee percentage: ${secondaryFee.feeBasisPoints}`);
|
|
12535
|
+
}
|
|
12536
|
+
}
|
|
12525
12537
|
}
|
|
12526
12538
|
/**
|
|
12527
12539
|
* {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
|
|
@@ -12531,6 +12543,7 @@ function validateOverrides(overrides) {
|
|
|
12531
12543
|
class ExchangeConfiguration {
|
|
12532
12544
|
baseConfig;
|
|
12533
12545
|
chain;
|
|
12546
|
+
secondaryFees;
|
|
12534
12547
|
constructor({ chainId, baseConfig, overrides }) {
|
|
12535
12548
|
this.baseConfig = baseConfig;
|
|
12536
12549
|
if (overrides) {
|
|
@@ -12542,8 +12555,10 @@ class ExchangeConfiguration {
|
|
|
12542
12555
|
commonRoutingTokens: overrides.commonRoutingTokens,
|
|
12543
12556
|
nativeToken: overrides.nativeToken,
|
|
12544
12557
|
};
|
|
12558
|
+
this.secondaryFees = overrides.secondaryFees ? overrides.secondaryFees : [];
|
|
12545
12559
|
return;
|
|
12546
12560
|
}
|
|
12561
|
+
this.secondaryFees = [];
|
|
12547
12562
|
const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
|
|
12548
12563
|
if (!chain) {
|
|
12549
12564
|
throw new ChainNotSupportedError(chainId, baseConfig.environment);
|
|
@@ -12557,11 +12572,13 @@ class Exchange {
|
|
|
12557
12572
|
router;
|
|
12558
12573
|
chainId;
|
|
12559
12574
|
nativeToken;
|
|
12575
|
+
secondaryFees;
|
|
12560
12576
|
constructor(configuration) {
|
|
12561
12577
|
const config = new ExchangeConfiguration(configuration);
|
|
12562
12578
|
this.chainId = config.chain.chainId;
|
|
12563
12579
|
this.nativeToken = config.chain.nativeToken;
|
|
12564
12580
|
this.provider = new ethers.providers.JsonRpcProvider(config.chain.rpcUrl);
|
|
12581
|
+
this.secondaryFees = config.secondaryFees;
|
|
12565
12582
|
this.router = new Router(this.provider, config.chain.commonRoutingTokens, {
|
|
12566
12583
|
multicallAddress: config.chain.contracts.multicall,
|
|
12567
12584
|
factoryAddress: config.chain.contracts.coreFactory,
|
|
@@ -12644,6 +12661,9 @@ class Exchange {
|
|
|
12644
12661
|
async getUnsignedSwapTxFromAmountOut(fromAddress, tokenInAddress, tokenOutAddress, amountOut, slippagePercent = DEFAULT_SLIPPAGE, maxHops = DEFAULT_MAX_HOPS, deadline = DEFAULT_DEADLINE) {
|
|
12645
12662
|
return await this.getUnsignedSwapTx(fromAddress, tokenInAddress, tokenOutAddress, amountOut, slippagePercent, maxHops, deadline, TradeType.EXACT_OUTPUT);
|
|
12646
12663
|
}
|
|
12664
|
+
thereAreSecondaryFees() {
|
|
12665
|
+
return this.secondaryFees.length > 0;
|
|
12666
|
+
}
|
|
12647
12667
|
}
|
|
12648
12668
|
|
|
12649
12669
|
/* eslint-disable class-methods-use-this */
|
|
@@ -14135,6 +14135,9 @@ declare namespace React {
|
|
|
14135
14135
|
// - "string"
|
|
14136
14136
|
// - union of string literals
|
|
14137
14137
|
interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
14138
|
+
// React-specific Attributes
|
|
14139
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
14140
|
+
|
|
14138
14141
|
// Attributes which also defined in HTMLAttributes
|
|
14139
14142
|
// See comment in SVGDOMPropertyConfig.js
|
|
14140
14143
|
className?: string | undefined;
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.3.0-alpha.
|
|
7
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.3.0-alpha.3";
|
|
8
8
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
9
9
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.3.0-alpha.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.3.0-alpha.3',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|