@imtbl/sdk 0.36.1-alpha.1 → 0.36.2
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/sdk.js +2 -2
- package/dist/browser/checkout/widgets.js +45 -45
- package/dist/checkout.d.ts +12 -12
- package/dist/checkout.js +7 -7
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.d.ts +12 -12
- package/dist/index.js +9 -9
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout.d.ts
CHANGED
|
@@ -10680,12 +10680,12 @@ interface TokenInfo {
|
|
|
10680
10680
|
* Interface representing the parameters for {@link Checkout.getBalance}.
|
|
10681
10681
|
* @property {Web3Provider} provider - The provider used to get the balance.
|
|
10682
10682
|
* @property {string} walletAddress - The wallet address.
|
|
10683
|
-
* @property {string | undefined}
|
|
10683
|
+
* @property {string | undefined} tokenAddress - The contract address of the token.
|
|
10684
10684
|
*/
|
|
10685
10685
|
interface GetBalanceParams {
|
|
10686
10686
|
provider: Web3Provider;
|
|
10687
10687
|
walletAddress: string;
|
|
10688
|
-
|
|
10688
|
+
tokenAddress?: string;
|
|
10689
10689
|
}
|
|
10690
10690
|
/**
|
|
10691
10691
|
* Interface representing the result of {@link Checkout.getBalance}.
|
|
@@ -12354,13 +12354,13 @@ type ConnectWidgetParams = {};
|
|
|
12354
12354
|
|
|
12355
12355
|
/**
|
|
12356
12356
|
* Bridge Widget parameters
|
|
12357
|
-
* @property {string | undefined}
|
|
12357
|
+
* @property {string | undefined} tokenAddress
|
|
12358
12358
|
* @property {string | undefined} amount
|
|
12359
12359
|
* @property {WalletProviderName | undefined} walletProviderName
|
|
12360
12360
|
*/
|
|
12361
12361
|
type BridgeWidgetParams = {
|
|
12362
12362
|
/** The contract address of the token to bridge from, used to populate the bridge form token field */
|
|
12363
|
-
|
|
12363
|
+
tokenAddress?: string;
|
|
12364
12364
|
/** The formatted amount to bridge, used to populate the bridge form amount field */
|
|
12365
12365
|
amount?: string;
|
|
12366
12366
|
/** The wallet provider name to use for the bridge widget */
|
|
@@ -12379,30 +12379,30 @@ type WalletWidgetParams = {
|
|
|
12379
12379
|
/**
|
|
12380
12380
|
* Swap Widget parameters
|
|
12381
12381
|
* @property {string | undefined} amount
|
|
12382
|
-
* @property {string | undefined}
|
|
12383
|
-
* @property {string | undefined}
|
|
12382
|
+
* @property {string | undefined} fromTokenAddress
|
|
12383
|
+
* @property {string | undefined} toTokenAddress
|
|
12384
12384
|
* @property {WalletProviderName | undefined} walletProviderName
|
|
12385
12385
|
*/
|
|
12386
12386
|
type SwapWidgetParams = {
|
|
12387
12387
|
/** The formatted amount to swap, used to populate the swap from amount field */
|
|
12388
12388
|
amount?: string;
|
|
12389
12389
|
/** The contract address of the token to swap from */
|
|
12390
|
-
|
|
12390
|
+
fromTokenAddress?: string;
|
|
12391
12391
|
/** The contract address of the token to swap to */
|
|
12392
|
-
|
|
12392
|
+
toTokenAddress?: string;
|
|
12393
12393
|
/** The wallet provider name to use for the swap widget */
|
|
12394
12394
|
walletProviderName?: WalletProviderName;
|
|
12395
12395
|
};
|
|
12396
12396
|
|
|
12397
12397
|
/**
|
|
12398
12398
|
* OnRamp Widget parameters
|
|
12399
|
-
* @property {string | undefined}
|
|
12399
|
+
* @property {string | undefined} tokenAddress
|
|
12400
12400
|
* @property {string | undefined} amount
|
|
12401
12401
|
* @property {WalletProviderName | undefined} walletProviderName
|
|
12402
12402
|
*/
|
|
12403
12403
|
type OnRampWidgetParams = {
|
|
12404
12404
|
/** The contract address of the token to onramp */
|
|
12405
|
-
|
|
12405
|
+
tokenAddress?: string;
|
|
12406
12406
|
/** The formatted amount to onramp, used to populate the onramp form amount field */
|
|
12407
12407
|
amount?: string;
|
|
12408
12408
|
/** The wallet provider name to use for the onramp widget */
|
|
@@ -12413,7 +12413,7 @@ type OnRampWidgetParams = {
|
|
|
12413
12413
|
* Sale Widget parameters
|
|
12414
12414
|
* @property {string} amount
|
|
12415
12415
|
* @property {string} environmentId
|
|
12416
|
-
* @property {string}
|
|
12416
|
+
* @property {string} fromTokenAddress
|
|
12417
12417
|
* @property {SaleItem[]} items
|
|
12418
12418
|
* @property {WalletProviderName | undefined} walletProviderName
|
|
12419
12419
|
*/
|
|
@@ -12421,7 +12421,7 @@ type SaleWidgetParams = {
|
|
|
12421
12421
|
/** The total price to pay for the items in the sale */
|
|
12422
12422
|
amount?: string;
|
|
12423
12423
|
environmentId?: string;
|
|
12424
|
-
|
|
12424
|
+
fromTokenAddress?: string;
|
|
12425
12425
|
/** The list of products to be purchased */
|
|
12426
12426
|
items?: SaleItem[];
|
|
12427
12427
|
/** The wallet provider name to default to if no web3Provider is passed */
|
package/dist/checkout.js
CHANGED
|
@@ -25770,7 +25770,7 @@ class APIError extends Error {
|
|
|
25770
25770
|
|
|
25771
25771
|
/* eslint-disable implicit-arrow-linebreak */
|
|
25772
25772
|
const defaultHeaders = {
|
|
25773
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.
|
|
25773
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.2',
|
|
25774
25774
|
};
|
|
25775
25775
|
/**
|
|
25776
25776
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -27075,7 +27075,7 @@ const GAS_OVERRIDES = {
|
|
|
27075
27075
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
27076
27076
|
};
|
|
27077
27077
|
|
|
27078
|
-
const SDK_VERSION_MARKER = '0.36.
|
|
27078
|
+
const SDK_VERSION_MARKER = '0.36.2';
|
|
27079
27079
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
27080
27080
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
27081
27081
|
|
|
@@ -27402,9 +27402,9 @@ const getBalance = async (config, web3Provider, walletAddress) => await withChec
|
|
|
27402
27402
|
token: networkInfo.nativeCurrency,
|
|
27403
27403
|
};
|
|
27404
27404
|
}, { type: CheckoutErrorType.GET_BALANCE_ERROR });
|
|
27405
|
-
async function getERC20Balance(web3Provider, walletAddress,
|
|
27405
|
+
async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
|
|
27406
27406
|
return await withCheckoutError(async () => {
|
|
27407
|
-
const contract = new Contract$1(
|
|
27407
|
+
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
27408
27408
|
return Promise.all([
|
|
27409
27409
|
contract.name(),
|
|
27410
27410
|
contract.symbol(),
|
|
@@ -27420,7 +27420,7 @@ async function getERC20Balance(web3Provider, walletAddress, contractAddress) {
|
|
|
27420
27420
|
name,
|
|
27421
27421
|
symbol,
|
|
27422
27422
|
decimals,
|
|
27423
|
-
address:
|
|
27423
|
+
address: tokenAddress,
|
|
27424
27424
|
},
|
|
27425
27425
|
};
|
|
27426
27426
|
});
|
|
@@ -30632,10 +30632,10 @@ class Checkout {
|
|
|
30632
30632
|
*/
|
|
30633
30633
|
async getBalance(params) {
|
|
30634
30634
|
const web3Provider = await validateProvider(this.config, params.provider);
|
|
30635
|
-
if (!params.
|
|
30635
|
+
if (!params.tokenAddress || params.tokenAddress === '') {
|
|
30636
30636
|
return await getBalance(this.config, web3Provider, params.walletAddress);
|
|
30637
30637
|
}
|
|
30638
|
-
return await getERC20Balance(web3Provider, params.walletAddress, params.
|
|
30638
|
+
return await getERC20Balance(web3Provider, params.walletAddress, params.tokenAddress);
|
|
30639
30639
|
}
|
|
30640
30640
|
/**
|
|
30641
30641
|
* Retrieves the balances of all tokens for a given wallet address on a specific chain.
|
|
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
17
17
|
chainID,
|
|
18
18
|
coreContractAddress,
|
|
19
19
|
registrationContractAddress,
|
|
20
|
-
sdkVersion: 'ts-immutable-sdk-0.36.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.36.2',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|