@imtbl/sdk 0.1.6-alpha → 0.1.7-alpha.1
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/checkout.js +2 -0
- package/dist/checkout_sdk.d.ts +61 -61
- package/dist/checkout_sdk.js +272 -164
- package/dist/checkout_widgets.d.ts +1011 -879
- package/dist/checkout_widgets.js +46 -45
- package/dist/immutablex_client.js +2 -2
- package/dist/index.cjs +2256 -319
- package/dist/index.d.ts +1666 -346
- package/dist/index.js +2256 -322
- package/dist/orderbook.d.ts +57 -0
- package/dist/orderbook.js +1833 -0
- package/dist/passport.d.ts +1154 -1
- package/dist/passport.js +18 -13
- package/dist/provider.d.ts +0 -1
- package/dist/provider.js +80 -76
- package/package.json +15 -2
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -546,6 +546,23 @@ declare class Web3Provider extends JsonRpcProvider {
|
|
|
546
546
|
send(method: string, params: Array<any>): Promise<any>;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
declare enum Environment {
|
|
550
|
+
PRODUCTION = "production",
|
|
551
|
+
SANDBOX = "sandbox"
|
|
552
|
+
}
|
|
553
|
+
declare class ImmutableConfiguration {
|
|
554
|
+
readonly environment: Environment;
|
|
555
|
+
readonly apiKey?: string;
|
|
556
|
+
constructor(options: {
|
|
557
|
+
environment: Environment;
|
|
558
|
+
apiKey?: string;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
interface ModuleConfiguration<T> {
|
|
562
|
+
baseConfig: ImmutableConfiguration;
|
|
563
|
+
overrides?: T;
|
|
564
|
+
}
|
|
565
|
+
|
|
549
566
|
/**
|
|
550
567
|
* Interface representing token information.
|
|
551
568
|
* @property {string} name - The token name.
|
|
@@ -599,8 +616,11 @@ interface TokenFilter {
|
|
|
599
616
|
*/
|
|
600
617
|
declare enum ChainId {
|
|
601
618
|
ETHEREUM = 1,
|
|
602
|
-
|
|
603
|
-
|
|
619
|
+
SEPOLIA = 11155111,
|
|
620
|
+
IMTBL_ZKEVM_DEVNET = 13373,
|
|
621
|
+
IMTBL_ZKEVM_TESTNET = 13372,
|
|
622
|
+
POLYGON_ZKEVM_TESTNET = 1442,
|
|
623
|
+
POLYGON_ZKEVM = 137
|
|
604
624
|
}
|
|
605
625
|
/**
|
|
606
626
|
* Interface representing the information of a network.
|
|
@@ -615,6 +635,25 @@ interface NetworkInfo {
|
|
|
615
635
|
nativeCurrency: TokenInfo;
|
|
616
636
|
isSupported: boolean;
|
|
617
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* Type representing the details of a network.
|
|
640
|
+
* @property {string} chainIdHex - The hexadecimal ID of the network.
|
|
641
|
+
* @property {string} chainName - The name of the network.
|
|
642
|
+
* @property {string[]} rpcUrls - The RPS URLs of the network's node.
|
|
643
|
+
* @property {TokenInfo} nativeCurrency - The info of the network's native currency.
|
|
644
|
+
* @property {string[]} [blockExplorerUrls] - The URLs of the network's block explorer.
|
|
645
|
+
*/
|
|
646
|
+
type NetworkDetails = {
|
|
647
|
+
chainIdHex: string;
|
|
648
|
+
chainName: string;
|
|
649
|
+
rpcUrls: string[];
|
|
650
|
+
nativeCurrency: TokenInfo;
|
|
651
|
+
blockExplorerUrls?: string[];
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* Type representing the mapping between ChainId and NetworkDetails
|
|
655
|
+
*/
|
|
656
|
+
type NetworkMap = Map<ChainId, NetworkDetails>;
|
|
618
657
|
/**
|
|
619
658
|
* Interface representing the parameters for {@link Checkout.switchNetwork}.
|
|
620
659
|
* @property {Web3Provider} provider - The provider to connect to the network.
|
|
@@ -708,6 +747,10 @@ interface GetAllBalancesParams {
|
|
|
708
747
|
interface GetAllBalancesResult {
|
|
709
748
|
balances: GetBalanceResult[];
|
|
710
749
|
}
|
|
750
|
+
interface CheckoutOverrides {
|
|
751
|
+
}
|
|
752
|
+
interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
|
|
753
|
+
}
|
|
711
754
|
/**
|
|
712
755
|
* Enum representing the list of default supported providers.
|
|
713
756
|
*/
|
|
@@ -827,57 +870,6 @@ declare enum WalletFilterTypes {
|
|
|
827
870
|
DESKTOP = "desktop",
|
|
828
871
|
MOBILE = "mobile"
|
|
829
872
|
}
|
|
830
|
-
/**
|
|
831
|
-
* Enum representing the types of token filters available.
|
|
832
|
-
*/
|
|
833
|
-
declare enum SupportedFiatCurrencies {
|
|
834
|
-
USD = "USD"
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Interface representing the parameters for {@link Checkout.convertTokenToFiat}.
|
|
838
|
-
* @property {BigNumber} amount - The the amount of token we are converting.
|
|
839
|
-
* @property {TokenInfo} token - The token we are converting from.
|
|
840
|
-
* @property {SupportedFiatCurrencies} fiatSymbol - The fiat currency we are converting to.
|
|
841
|
-
*/
|
|
842
|
-
interface ConvertTokensToFiatParams {
|
|
843
|
-
amounts: {
|
|
844
|
-
[key: string]: {
|
|
845
|
-
amount: BigNumber;
|
|
846
|
-
token: TokenInfo;
|
|
847
|
-
};
|
|
848
|
-
};
|
|
849
|
-
fiatSymbol: SupportedFiatCurrencies;
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Interface representing the result of a specific token to fiat conversion.
|
|
853
|
-
* @property {TokenInfo} token - The token that we converted from.
|
|
854
|
-
* @property {string} fiatSymbol - The fiat currency we converted to.
|
|
855
|
-
* @property {number} quotedAt - The unix timestamp for when the quote was generated.
|
|
856
|
-
* @property {number} quote - The quote at the given timestamp.
|
|
857
|
-
* @property {BigNumber} amount - The amount we converted.
|
|
858
|
-
* @property {number} convertedAmount - The converted amount.
|
|
859
|
-
*/
|
|
860
|
-
interface TokenToFiatConversionResult extends FiatConversionQuote {
|
|
861
|
-
token: TokenInfo;
|
|
862
|
-
fiatSymbol: string;
|
|
863
|
-
amount: BigNumber;
|
|
864
|
-
convertedAmount: number;
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
* Interface representing the result of {@link Checkout.convertTokenToFiat}.
|
|
868
|
-
*/
|
|
869
|
-
interface ConvertTokensToFiatResult {
|
|
870
|
-
[key: string]: TokenToFiatConversionResult;
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Interface representing the result of a specific token to fiat conversion.
|
|
874
|
-
* @property {number} quotedAt - The unix timestamp for when the quote was generated.
|
|
875
|
-
* @property {number} quote - The quote at the given timestamp.
|
|
876
|
-
*/
|
|
877
|
-
interface FiatConversionQuote {
|
|
878
|
-
quote: number;
|
|
879
|
-
quotedAt: number;
|
|
880
|
-
}
|
|
881
873
|
/**
|
|
882
874
|
* The different types of errors that can be returned by the checkout process.
|
|
883
875
|
*/
|
|
@@ -892,10 +884,7 @@ declare enum CheckoutErrorType {
|
|
|
892
884
|
PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
|
|
893
885
|
PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
|
|
894
886
|
USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
|
|
895
|
-
TRANSACTION_ERROR = "TRANSACTION_ERROR"
|
|
896
|
-
FIAT_CONVERSION_ERROR = "FIAT_CONVERSION_ERROR",
|
|
897
|
-
TOKEN_NOT_SUPPORTED_ERROR = "TOKEN_NOT_SUPPORTED_ERROR",
|
|
898
|
-
FIAT_CURRENCY_NOT_SUPPORTED_ERROR = "FIAT_CURRENCY_NOT_SUPPORTED_ERROR"
|
|
887
|
+
TRANSACTION_ERROR = "TRANSACTION_ERROR"
|
|
899
888
|
}
|
|
900
889
|
/**
|
|
901
890
|
* The type signature for an error.
|
|
@@ -908,9 +897,17 @@ type ErrorType = {
|
|
|
908
897
|
[key: string]: string;
|
|
909
898
|
};
|
|
910
899
|
};
|
|
900
|
+
declare class CheckoutConfiguration {
|
|
901
|
+
readonly environment: Environment;
|
|
902
|
+
readonly networkMap: NetworkMap;
|
|
903
|
+
constructor(config: CheckoutModuleConfiguration);
|
|
904
|
+
}
|
|
911
905
|
declare class Checkout {
|
|
906
|
+
readonly config: CheckoutConfiguration;
|
|
907
|
+
constructor(config?: CheckoutModuleConfiguration);
|
|
912
908
|
/**
|
|
913
|
-
* Check if a wallet is connected to the current application
|
|
909
|
+
* Check if a wallet is connected to the current application
|
|
910
|
+
* without requesting permission from the wallet and hence triggering a connect popup.
|
|
914
911
|
* @param {CheckConnectionParams} params - The necessary data required to verify a wallet connection status.
|
|
915
912
|
* @returns Wallet connection status details.
|
|
916
913
|
* @throws {@link ErrorType}
|
|
@@ -931,14 +928,17 @@ declare class Checkout {
|
|
|
931
928
|
*/
|
|
932
929
|
switchNetwork(params: SwitchNetworkParams): Promise<SwitchNetworkResult>;
|
|
933
930
|
/**
|
|
934
|
-
* Fetch the balance of the native token of the current connected network or,
|
|
931
|
+
* Fetch the balance of the native token of the current connected network or,
|
|
932
|
+
* if a contract address is provided, it will return the balance of that ERC20 token. For example,
|
|
933
|
+
* if the wallet is connected to the Ethereum Mainnet then the function gets the wallet ETH L1 balance.
|
|
935
934
|
* @param {GetBalanceParams} params - The necessary data required to fetch the wallet balance.
|
|
936
935
|
* @returns Native token balance for the given wallet.
|
|
937
936
|
* @throws {@link ErrorType}
|
|
938
937
|
*/
|
|
939
938
|
getBalance(params: GetBalanceParams): Promise<GetBalanceResult>;
|
|
940
939
|
/**
|
|
941
|
-
* Fetch all available balances (ERC20 & Native) of the current connected network of the given wallet.
|
|
940
|
+
* Fetch all available balances (ERC20 & Native) of the current connected network of the given wallet.
|
|
941
|
+
* It will loop through the list of allowed tokens and check for balance on each one.
|
|
942
942
|
* @param {GetAllBalancesParams} params - The necessary data required to fetch all the wallet balances.
|
|
943
943
|
* @returns List of tokens balance for the given wallet.
|
|
944
944
|
* @throws {@link ErrorType}
|
|
@@ -983,4 +983,4 @@ declare class Checkout {
|
|
|
983
983
|
getNetworkInfo(params: GetNetworkParams): Promise<NetworkInfo>;
|
|
984
984
|
}
|
|
985
985
|
|
|
986
|
-
export { ChainId, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, ConnectParams, ConnectResult, ConnectionProviders,
|
|
986
|
+
export { ChainId, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, ConnectionProviders, ErrorType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, NetworkFilter, NetworkFilterTypes, NetworkInfo, SendTransactionParams, SendTransactionResult, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, Transaction, WalletFilter, WalletFilterTypes, WalletInfo };
|