@imtbl/sdk 0.0.1-alpha.1 → 0.0.1-alpha.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/browser/checkout.js +2 -0
- package/dist/checkout_sdk.d.ts +641 -0
- package/dist/checkout_sdk.js +468 -0
- package/dist/checkout_widgets.d.ts +14442 -0
- package/dist/checkout_widgets.js +180 -0
- package/dist/index.cjs +554 -0
- package/dist/index.d.ts +14841 -5
- package/dist/index.js +555 -2
- package/package.json +15 -5
package/dist/index.js
CHANGED
|
@@ -3,11 +3,12 @@ import BN from 'bn.js';
|
|
|
3
3
|
import * as encUtils from 'enc-utils';
|
|
4
4
|
import { parseUnits } from '@ethersproject/units';
|
|
5
5
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
6
|
-
import { ethers } from 'ethers';
|
|
6
|
+
import { ethers, utils, Contract } from 'ethers';
|
|
7
7
|
import detectEthereumProvider from '@metamask/detect-provider';
|
|
8
8
|
import { UserManager } from 'oidc-client-ts';
|
|
9
9
|
import { Magic } from 'magic-sdk';
|
|
10
10
|
import { OpenIdExtension } from '@magic-ext/oidc';
|
|
11
|
+
import { Web3Provider } from '@ethersproject/providers';
|
|
11
12
|
|
|
12
13
|
var Environment;
|
|
13
14
|
(function (Environment) {
|
|
@@ -1980,4 +1981,556 @@ class Passport {
|
|
|
1980
1981
|
}
|
|
1981
1982
|
}
|
|
1982
1983
|
|
|
1983
|
-
export
|
|
1984
|
+
const $762782b6c862d954$export$db5daa1b5156ccfe = [
|
|
1985
|
+
{
|
|
1986
|
+
constant: true,
|
|
1987
|
+
inputs: [],
|
|
1988
|
+
name: "name",
|
|
1989
|
+
outputs: [
|
|
1990
|
+
{
|
|
1991
|
+
name: "",
|
|
1992
|
+
type: "string"
|
|
1993
|
+
}
|
|
1994
|
+
],
|
|
1995
|
+
payable: false,
|
|
1996
|
+
type: "function"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
constant: true,
|
|
2000
|
+
inputs: [],
|
|
2001
|
+
name: "decimals",
|
|
2002
|
+
outputs: [
|
|
2003
|
+
{
|
|
2004
|
+
name: "",
|
|
2005
|
+
type: "uint8"
|
|
2006
|
+
}
|
|
2007
|
+
],
|
|
2008
|
+
payable: false,
|
|
2009
|
+
type: "function"
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
constant: true,
|
|
2013
|
+
inputs: [
|
|
2014
|
+
{
|
|
2015
|
+
name: "_owner",
|
|
2016
|
+
type: "address"
|
|
2017
|
+
}
|
|
2018
|
+
],
|
|
2019
|
+
name: "balanceOf",
|
|
2020
|
+
outputs: [
|
|
2021
|
+
{
|
|
2022
|
+
name: "balance",
|
|
2023
|
+
type: "uint256"
|
|
2024
|
+
}
|
|
2025
|
+
],
|
|
2026
|
+
payable: false,
|
|
2027
|
+
type: "function"
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
constant: true,
|
|
2031
|
+
inputs: [],
|
|
2032
|
+
name: "symbol",
|
|
2033
|
+
outputs: [
|
|
2034
|
+
{
|
|
2035
|
+
name: "",
|
|
2036
|
+
type: "string"
|
|
2037
|
+
}
|
|
2038
|
+
],
|
|
2039
|
+
payable: false,
|
|
2040
|
+
type: "function"
|
|
2041
|
+
}
|
|
2042
|
+
];
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
let $d176a05e966364ba$export$3bfad4d03ada24c4;
|
|
2046
|
+
(function(ConnectionProviders) {
|
|
2047
|
+
ConnectionProviders["METAMASK"] = "metamask";
|
|
2048
|
+
})($d176a05e966364ba$export$3bfad4d03ada24c4 || ($d176a05e966364ba$export$3bfad4d03ada24c4 = {}));
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
let $a47e48dd2c04791b$export$c06e1e7429de6283;
|
|
2052
|
+
(function(ChainId) {
|
|
2053
|
+
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
2054
|
+
ChainId[ChainId["GOERLI"] = 5] = "GOERLI";
|
|
2055
|
+
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
|
|
2056
|
+
})($a47e48dd2c04791b$export$c06e1e7429de6283 || ($a47e48dd2c04791b$export$c06e1e7429de6283 = {}));
|
|
2057
|
+
const $a47e48dd2c04791b$export$f61f4aaec62f6be9 = {
|
|
2058
|
+
[$a47e48dd2c04791b$export$c06e1e7429de6283.ETHEREUM]: {
|
|
2059
|
+
chainIdHex: "0x1",
|
|
2060
|
+
chainName: "Ethereum",
|
|
2061
|
+
rpcUrls: [
|
|
2062
|
+
"https://mainnet.infura.io/v3/"
|
|
2063
|
+
],
|
|
2064
|
+
nativeCurrency: {
|
|
2065
|
+
name: "Ethereum",
|
|
2066
|
+
symbol: "ETH",
|
|
2067
|
+
decimals: 18
|
|
2068
|
+
},
|
|
2069
|
+
blockExplorerUrls: [
|
|
2070
|
+
"https://etherscan.io/"
|
|
2071
|
+
]
|
|
2072
|
+
},
|
|
2073
|
+
[$a47e48dd2c04791b$export$c06e1e7429de6283.GOERLI]: {
|
|
2074
|
+
chainIdHex: "0x5",
|
|
2075
|
+
chainName: "Goerli",
|
|
2076
|
+
rpcUrls: [
|
|
2077
|
+
"https://goerli.infura.io/v3/"
|
|
2078
|
+
],
|
|
2079
|
+
nativeCurrency: {
|
|
2080
|
+
name: "Goerli Eth",
|
|
2081
|
+
symbol: "ETH",
|
|
2082
|
+
decimals: 18
|
|
2083
|
+
},
|
|
2084
|
+
blockExplorerUrls: [
|
|
2085
|
+
"https://goerli.etherscan.io/"
|
|
2086
|
+
]
|
|
2087
|
+
},
|
|
2088
|
+
[$a47e48dd2c04791b$export$c06e1e7429de6283.POLYGON]: {
|
|
2089
|
+
chainIdHex: "0x89",
|
|
2090
|
+
chainName: "Polygon",
|
|
2091
|
+
rpcUrls: [
|
|
2092
|
+
"https://polygon-rpc.com"
|
|
2093
|
+
],
|
|
2094
|
+
nativeCurrency: {
|
|
2095
|
+
name: "MATIC",
|
|
2096
|
+
symbol: "MATIC",
|
|
2097
|
+
decimals: 18
|
|
2098
|
+
},
|
|
2099
|
+
blockExplorerUrls: [
|
|
2100
|
+
"https://polygonscan.com/"
|
|
2101
|
+
]
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
const $4f91c5f280efe242$export$a130407f3423b97d = {
|
|
2111
|
+
CHECK_CONNECTION: "eth_accounts",
|
|
2112
|
+
CONNECT: "eth_requestAccounts",
|
|
2113
|
+
ADD_NETWORK: "wallet_addEthereumChain",
|
|
2114
|
+
SWITCH_NETWORK: "wallet_switchEthereumChain"
|
|
2115
|
+
};
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
let $a8bc256d81a5e2c1$export$e3dc0620abde7f5a;
|
|
2121
|
+
(function(CheckoutErrorType) {
|
|
2122
|
+
CheckoutErrorType["CONNECT_PROVIDER_ERROR"] = "CONNECT_PROVIDER_ERROR";
|
|
2123
|
+
CheckoutErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
2124
|
+
CheckoutErrorType["GET_ERC20_BALANCE_ERROR"] = "GET_ERC20_BALANCE_ERROR";
|
|
2125
|
+
CheckoutErrorType["METAMASK_PROVIDER_ERROR"] = "METAMASK_PROVIDER_ERROR";
|
|
2126
|
+
CheckoutErrorType["CHAIN_NOT_SUPPORTED_ERROR"] = "CHAIN_NOT_SUPPORTED_ERROR";
|
|
2127
|
+
CheckoutErrorType["PROVIDER_REQUEST_MISSING_ERROR"] = "PROVIDER_REQUEST_MISSING_ERROR";
|
|
2128
|
+
CheckoutErrorType["USER_REJECTED_REQUEST_ERROR"] = "USER_REJECTED_REQUEST_ERROR";
|
|
2129
|
+
CheckoutErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
|
|
2130
|
+
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
2131
|
+
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
2132
|
+
constructor(message, type){
|
|
2133
|
+
super(message);
|
|
2134
|
+
this.type = type;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
const $a8bc256d81a5e2c1$export$bacc563de539c6c3 = async (fn, customError)=>{
|
|
2138
|
+
try {
|
|
2139
|
+
return await fn();
|
|
2140
|
+
} catch (error) {
|
|
2141
|
+
const errorMessage = customError.message || `${error.message}` || "UnknownError";
|
|
2142
|
+
throw new $a8bc256d81a5e2c1$export$b722478a3cbfa3bc(errorMessage, customError.type);
|
|
2143
|
+
}
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
async function $de192de6ef100f9f$export$79f13b4cfaaf0d09(provider) {
|
|
2153
|
+
const network = await provider.getNetwork();
|
|
2154
|
+
if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(network.chainId)) // return empty details
|
|
2155
|
+
return {};
|
|
2156
|
+
const chainIdNetworkInfo = ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[network.chainId];
|
|
2157
|
+
const networkInfo = {
|
|
2158
|
+
name: chainIdNetworkInfo.chainName,
|
|
2159
|
+
chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
|
|
2160
|
+
nativeCurrency: chainIdNetworkInfo.nativeCurrency
|
|
2161
|
+
};
|
|
2162
|
+
return networkInfo;
|
|
2163
|
+
}
|
|
2164
|
+
async function $de192de6ef100f9f$export$b827d9418aeb5dbd(provider, chainId) {
|
|
2165
|
+
if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
|
|
2166
|
+
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider object is missing request function", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
|
|
2167
|
+
// WT-1146 - Refer to the README in this folder for explantion on the switch network flow
|
|
2168
|
+
try {
|
|
2169
|
+
await $de192de6ef100f9f$var$switchNetworkInWallet(provider, chainId);
|
|
2170
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2171
|
+
} catch (err) {
|
|
2172
|
+
if (err.message.includes("Unrecognized chain ID")) try {
|
|
2173
|
+
await $de192de6ef100f9f$var$addNetworkToWallet(provider, chainId);
|
|
2174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2175
|
+
} catch (err) {
|
|
2176
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("user cancelled the add network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
|
|
2177
|
+
}
|
|
2178
|
+
else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("user cancelled the switch network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
|
|
2179
|
+
}
|
|
2180
|
+
// we can assume that if the above succeeds then user has successfully
|
|
2181
|
+
// switched to the network specified
|
|
2182
|
+
const newNetwork = ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId];
|
|
2183
|
+
return {
|
|
2184
|
+
network: {
|
|
2185
|
+
name: newNetwork.chainName,
|
|
2186
|
+
chainId: parseInt(newNetwork.chainIdHex, 16),
|
|
2187
|
+
nativeCurrency: newNetwork.nativeCurrency
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
// these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
|
|
2192
|
+
// make sure to check if(provider.provider?.request) in the exported function and throw an error
|
|
2193
|
+
async function $de192de6ef100f9f$var$switchNetworkInWallet(provider, chainId) {
|
|
2194
|
+
if (provider.provider?.request) return await provider.provider.request({
|
|
2195
|
+
method: ($4f91c5f280efe242$export$a130407f3423b97d).SWITCH_NETWORK,
|
|
2196
|
+
params: [
|
|
2197
|
+
{
|
|
2198
|
+
chainId: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].chainIdHex
|
|
2199
|
+
}
|
|
2200
|
+
]
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
async function $de192de6ef100f9f$var$addNetworkToWallet(provider, chainId) {
|
|
2204
|
+
if (provider.provider?.request) {
|
|
2205
|
+
const addNetwork = {
|
|
2206
|
+
chainId: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].chainIdHex,
|
|
2207
|
+
chainName: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].chainName,
|
|
2208
|
+
rpcUrls: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].rpcUrls,
|
|
2209
|
+
nativeCurrency: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].nativeCurrency,
|
|
2210
|
+
blockExplorerUrls: ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[chainId].blockExplorerUrls
|
|
2211
|
+
};
|
|
2212
|
+
return await provider.provider.request({
|
|
2213
|
+
method: ($4f91c5f280efe242$export$a130407f3423b97d).ADD_NETWORK,
|
|
2214
|
+
params: [
|
|
2215
|
+
addNetwork
|
|
2216
|
+
]
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
let $efe60cea83bfc4e8$export$f04a61298a47a40f;
|
|
2226
|
+
(function(Icon) {
|
|
2227
|
+
Icon["ETH"] = "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A";
|
|
2228
|
+
Icon["MATIC"] = "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 38.4 33.5' style='enable-background:new 0 0 38.4 33.5;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%238247E5;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3 c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7 c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4,1.6-0.4,2.4,0l4.3,2.5c0.7,0.4,1.2,1.2,1.2,2.1v5c0,0.8-0.4,1.6-1.2,2.1 L29,28.8c-0.7,0.4-1.6,0.4-2.4,0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8,2.2v3.3c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l8.1-4.7c0.7-0.4,1.2-1.2,1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29,10.2z'/%3E%3C/g%3E%3C/svg%3E%0A";
|
|
2229
|
+
Icon["IMX"] = "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A";
|
|
2230
|
+
})($efe60cea83bfc4e8$export$f04a61298a47a40f || ($efe60cea83bfc4e8$export$f04a61298a47a40f = {}));
|
|
2231
|
+
const $efe60cea83bfc4e8$export$3dbcce43073f40c7 = [
|
|
2232
|
+
{
|
|
2233
|
+
name: "Ethereum",
|
|
2234
|
+
symbol: "ETH",
|
|
2235
|
+
decimals: 18,
|
|
2236
|
+
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
name: "Matic",
|
|
2240
|
+
symbol: "MATIC",
|
|
2241
|
+
address: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
|
|
2242
|
+
decimals: 18,
|
|
2243
|
+
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 38.4 33.5' style='enable-background:new 0 0 38.4 33.5;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%238247E5;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3 c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7 c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4,1.6-0.4,2.4,0l4.3,2.5c0.7,0.4,1.2,1.2,1.2,2.1v5c0,0.8-0.4,1.6-1.2,2.1 L29,28.8c-0.7,0.4-1.6,0.4-2.4,0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8,2.2v3.3c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l8.1-4.7c0.7-0.4,1.2-1.2,1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29,10.2z'/%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2244
|
+
},
|
|
2245
|
+
{
|
|
2246
|
+
name: "Immutable X",
|
|
2247
|
+
symbol: "IMX",
|
|
2248
|
+
address: "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF",
|
|
2249
|
+
decimals: 18,
|
|
2250
|
+
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2251
|
+
}
|
|
2252
|
+
];
|
|
2253
|
+
const $efe60cea83bfc4e8$var$goerliTokensList = [
|
|
2254
|
+
{
|
|
2255
|
+
name: "Ethereum",
|
|
2256
|
+
symbol: "ETH",
|
|
2257
|
+
decimals: 18,
|
|
2258
|
+
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2259
|
+
},
|
|
2260
|
+
{
|
|
2261
|
+
name: "Immutable X",
|
|
2262
|
+
symbol: "IMX",
|
|
2263
|
+
address: "0x1facdd0165489f373255a90304650e15481b2c85",
|
|
2264
|
+
decimals: 18,
|
|
2265
|
+
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2266
|
+
}
|
|
2267
|
+
];
|
|
2268
|
+
const $efe60cea83bfc4e8$var$polygonTokensList = [];
|
|
2269
|
+
const $efe60cea83bfc4e8$export$473cec51305fdae8 = (chainId)=>{
|
|
2270
|
+
let tokenList = [];
|
|
2271
|
+
switch(chainId){
|
|
2272
|
+
case ($a47e48dd2c04791b$export$c06e1e7429de6283).ETHEREUM:
|
|
2273
|
+
tokenList = $efe60cea83bfc4e8$export$3dbcce43073f40c7;
|
|
2274
|
+
break;
|
|
2275
|
+
case ($a47e48dd2c04791b$export$c06e1e7429de6283).GOERLI:
|
|
2276
|
+
tokenList = $efe60cea83bfc4e8$var$goerliTokensList;
|
|
2277
|
+
break;
|
|
2278
|
+
case ($a47e48dd2c04791b$export$c06e1e7429de6283).POLYGON:
|
|
2279
|
+
tokenList = $efe60cea83bfc4e8$var$polygonTokensList;
|
|
2280
|
+
break;
|
|
2281
|
+
default:
|
|
2282
|
+
tokenList = $efe60cea83bfc4e8$export$3dbcce43073f40c7;
|
|
2283
|
+
}
|
|
2284
|
+
return {
|
|
2285
|
+
tokens: tokenList
|
|
2286
|
+
};
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (provider, walletAddress)=>{
|
|
2293
|
+
return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2294
|
+
const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(provider);
|
|
2295
|
+
const balance = await provider.getBalance(walletAddress);
|
|
2296
|
+
return {
|
|
2297
|
+
balance: balance,
|
|
2298
|
+
formattedBalance: (utils).formatUnits(balance, networkInfo.nativeCurrency.decimals),
|
|
2299
|
+
token: networkInfo.nativeCurrency
|
|
2300
|
+
};
|
|
2301
|
+
}, {
|
|
2302
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_BALANCE_ERROR
|
|
2303
|
+
});
|
|
2304
|
+
};
|
|
2305
|
+
async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress, contractAddress) {
|
|
2306
|
+
return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2307
|
+
const contract = new (Contract)(contractAddress, JSON.stringify(($762782b6c862d954$export$db5daa1b5156ccfe)), provider);
|
|
2308
|
+
const name = await contract.name();
|
|
2309
|
+
const symbol = await contract.symbol();
|
|
2310
|
+
const balance = await contract.balanceOf(walletAddress);
|
|
2311
|
+
const decimals = await contract.decimals();
|
|
2312
|
+
const formattedBalance = (utils).formatUnits(balance, decimals);
|
|
2313
|
+
return {
|
|
2314
|
+
balance: balance,
|
|
2315
|
+
formattedBalance: formattedBalance,
|
|
2316
|
+
token: {
|
|
2317
|
+
name: name,
|
|
2318
|
+
symbol: symbol,
|
|
2319
|
+
decimals: decimals,
|
|
2320
|
+
address: contractAddress
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
}, {
|
|
2324
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ERC20_BALANCE_ERROR
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
const $1564e43dde50bb61$export$fee49741664a4d7e = async (provider, walletAddress, chainId)=>{
|
|
2328
|
+
if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
|
|
2329
|
+
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider object is missing request function", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
|
|
2330
|
+
const tokenList = ($efe60cea83bfc4e8$export$473cec51305fdae8)(chainId);
|
|
2331
|
+
const allBalancePromises = [];
|
|
2332
|
+
allBalancePromises.push($1564e43dde50bb61$export$df96cd8d56be0ab1(provider, walletAddress));
|
|
2333
|
+
tokenList.tokens.filter((token)=>token.address).forEach((token)=>allBalancePromises.push($1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress, token.address ?? "")));
|
|
2334
|
+
const balanceResults = await Promise.allSettled(allBalancePromises);
|
|
2335
|
+
const getBalanceResults = balanceResults.filter((result)=>result.status === "fulfilled").map((fulfilledResult)=>fulfilledResult.value);
|
|
2336
|
+
return {
|
|
2337
|
+
balances: getBalanceResults
|
|
2338
|
+
};
|
|
2339
|
+
};
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
async function $c99672cf2294e839$export$2d040992269b4717(providerPreference) {
|
|
2350
|
+
const provider = await $c99672cf2294e839$var$getWalletProviderForPreference(providerPreference);
|
|
2351
|
+
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
|
|
2352
|
+
const accounts = await provider.provider.request({
|
|
2353
|
+
method: ($4f91c5f280efe242$export$a130407f3423b97d).CHECK_CONNECTION,
|
|
2354
|
+
params: []
|
|
2355
|
+
});
|
|
2356
|
+
// accounts[0] will have the active account if connected.
|
|
2357
|
+
return {
|
|
2358
|
+
isConnected: accounts && accounts.length > 0,
|
|
2359
|
+
walletAddress: accounts[0] ?? ""
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
async function $c99672cf2294e839$export$fba2f6c3656e07c1(params) {
|
|
2363
|
+
const web3Provider = await $c99672cf2294e839$var$getWalletProviderForPreference(params.providerPreference);
|
|
2364
|
+
await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2365
|
+
if (!web3Provider || !web3Provider?.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No MetaMask provider installed.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR);
|
|
2366
|
+
// this makes the request to the wallet to connect i.e request eth accounts ('eth_requestAccounts')
|
|
2367
|
+
await web3Provider.provider.request({
|
|
2368
|
+
method: ($4f91c5f280efe242$export$a130407f3423b97d).CONNECT,
|
|
2369
|
+
params: []
|
|
2370
|
+
});
|
|
2371
|
+
}, {
|
|
2372
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR
|
|
2373
|
+
});
|
|
2374
|
+
return web3Provider;
|
|
2375
|
+
}
|
|
2376
|
+
async function $c99672cf2294e839$var$getWalletProviderForPreference(providerPreference) {
|
|
2377
|
+
let web3Provider = null;
|
|
2378
|
+
switch(providerPreference){
|
|
2379
|
+
case ($d176a05e966364ba$export$3bfad4d03ada24c4).METAMASK:
|
|
2380
|
+
web3Provider = await $c99672cf2294e839$var$getMetaMaskProvider();
|
|
2381
|
+
break;
|
|
2382
|
+
default:
|
|
2383
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider preference was not detected", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CONNECT_PROVIDER_ERROR);
|
|
2384
|
+
}
|
|
2385
|
+
return web3Provider;
|
|
2386
|
+
}
|
|
2387
|
+
async function $c99672cf2294e839$var$getMetaMaskProvider() {
|
|
2388
|
+
const provider = await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2389
|
+
return await (detectEthereumProvider)();
|
|
2390
|
+
}, {
|
|
2391
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR
|
|
2392
|
+
});
|
|
2393
|
+
if (!provider || !provider.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No MetaMask provider installed.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR);
|
|
2394
|
+
return new (Web3Provider)(provider);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (params)=>{
|
|
2403
|
+
const { provider: provider , transaction: transaction } = params;
|
|
2404
|
+
return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2405
|
+
const transactionResponse = await provider.getSigner().sendTransaction(transaction);
|
|
2406
|
+
return {
|
|
2407
|
+
transactionResponse: transactionResponse
|
|
2408
|
+
};
|
|
2409
|
+
}, {
|
|
2410
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_ERROR
|
|
2411
|
+
});
|
|
2412
|
+
};
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
2418
|
+
async checkIsWalletConnected(params) {
|
|
2419
|
+
return $c99672cf2294e839$export$2d040992269b4717(params.providerPreference);
|
|
2420
|
+
}
|
|
2421
|
+
async connect(params) {
|
|
2422
|
+
const provider = await $c99672cf2294e839$export$fba2f6c3656e07c1(params);
|
|
2423
|
+
const network = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(provider);
|
|
2424
|
+
return {
|
|
2425
|
+
provider: provider,
|
|
2426
|
+
network: network
|
|
2427
|
+
};
|
|
2428
|
+
}
|
|
2429
|
+
async switchNetwork(params) {
|
|
2430
|
+
return await ($de192de6ef100f9f$export$b827d9418aeb5dbd)(params.provider, params.chainId);
|
|
2431
|
+
}
|
|
2432
|
+
async getBalance(params) {
|
|
2433
|
+
if (!params.contractAddress || params.contractAddress === "") return await $1564e43dde50bb61$export$df96cd8d56be0ab1(params.provider, params.walletAddress);
|
|
2434
|
+
return await $1564e43dde50bb61$export$60e0fe116a0e6ed0(params.provider, params.walletAddress, params.contractAddress);
|
|
2435
|
+
}
|
|
2436
|
+
async getAllBalances(params) {
|
|
2437
|
+
return $1564e43dde50bb61$export$fee49741664a4d7e(params.provider, params.walletAddress, params.chainId);
|
|
2438
|
+
}
|
|
2439
|
+
getTokenAllowList(params) {
|
|
2440
|
+
return $efe60cea83bfc4e8$export$473cec51305fdae8(params.chainId);
|
|
2441
|
+
}
|
|
2442
|
+
async sendTransaction(params) {
|
|
2443
|
+
return await $dbe95599a4661140$export$8e0e7ffc78696d30(params);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
function $parcel$export(e, n, v, s) {
|
|
2448
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
2449
|
+
}
|
|
2450
|
+
var $88e4c575901cd68c$exports = {};
|
|
2451
|
+
|
|
2452
|
+
$parcel$export($88e4c575901cd68c$exports, "IMTBLWidgetEvents", () => $88e4c575901cd68c$export$5a0ace85cae72d45);
|
|
2453
|
+
let $88e4c575901cd68c$export$5a0ace85cae72d45;
|
|
2454
|
+
(function(IMTBLWidgetEvents) {
|
|
2455
|
+
IMTBLWidgetEvents["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
|
|
2456
|
+
IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
|
|
2457
|
+
IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
|
|
2458
|
+
IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
|
|
2459
|
+
IMTBLWidgetEvents["IMTBL_BUY_WIDGET_EVENT"] = "imtbl-buy-widget";
|
|
2460
|
+
})($88e4c575901cd68c$export$5a0ace85cae72d45 || ($88e4c575901cd68c$export$5a0ace85cae72d45 = {}));
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
var $d71a87afc3136184$exports = {};
|
|
2464
|
+
|
|
2465
|
+
$parcel$export($d71a87afc3136184$exports, "ConnectEventType", () => $d71a87afc3136184$export$e72e7f9969a47dd3);
|
|
2466
|
+
let $d71a87afc3136184$export$e72e7f9969a47dd3;
|
|
2467
|
+
(function(ConnectEventType) {
|
|
2468
|
+
ConnectEventType["SUCCESS"] = "success";
|
|
2469
|
+
ConnectEventType["FAILURE"] = "failure";
|
|
2470
|
+
})($d71a87afc3136184$export$e72e7f9969a47dd3 || ($d71a87afc3136184$export$e72e7f9969a47dd3 = {}));
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
var $9d0f1783d4d36e8a$exports = {};
|
|
2474
|
+
|
|
2475
|
+
$parcel$export($9d0f1783d4d36e8a$exports, "WalletEventType", () => $9d0f1783d4d36e8a$export$d9be06b70b28c742);
|
|
2476
|
+
//wallet widget events
|
|
2477
|
+
let $9d0f1783d4d36e8a$export$d9be06b70b28c742;
|
|
2478
|
+
(function(WalletEventType) {
|
|
2479
|
+
WalletEventType["CLOSE_WIDGET"] = "close-widget";
|
|
2480
|
+
WalletEventType["NETWORK_SWITCH"] = "network-switch";
|
|
2481
|
+
})($9d0f1783d4d36e8a$export$d9be06b70b28c742 || ($9d0f1783d4d36e8a$export$d9be06b70b28c742 = {}));
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
var $5d497088f13bb116$exports = {};
|
|
2485
|
+
|
|
2486
|
+
$parcel$export($5d497088f13bb116$exports, "SwapEventType", () => $5d497088f13bb116$export$140a49745ab55563);
|
|
2487
|
+
let $5d497088f13bb116$export$140a49745ab55563;
|
|
2488
|
+
(function(SwapEventType) {
|
|
2489
|
+
SwapEventType["SUCCESS"] = "success";
|
|
2490
|
+
SwapEventType["FAILURE"] = "failure";
|
|
2491
|
+
})($5d497088f13bb116$export$140a49745ab55563 || ($5d497088f13bb116$export$140a49745ab55563 = {}));
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
var $28a5fdc2f5e6c742$exports = {};
|
|
2495
|
+
|
|
2496
|
+
$parcel$export($28a5fdc2f5e6c742$exports, "BridgeEventType", () => $28a5fdc2f5e6c742$export$d1bfa21f7c76447a);
|
|
2497
|
+
let $28a5fdc2f5e6c742$export$d1bfa21f7c76447a;
|
|
2498
|
+
(function(BridgeEventType) {
|
|
2499
|
+
BridgeEventType["CLOSE_WIDGET"] = "close-widget";
|
|
2500
|
+
BridgeEventType["SUCCESS"] = "success";
|
|
2501
|
+
BridgeEventType["FAILURE"] = "failure";
|
|
2502
|
+
})($28a5fdc2f5e6c742$export$d1bfa21f7c76447a || ($28a5fdc2f5e6c742$export$d1bfa21f7c76447a = {}));
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
var $ede253beebe0de4a$exports = {};
|
|
2506
|
+
|
|
2507
|
+
$parcel$export($ede253beebe0de4a$exports, "BuyEventType", () => $ede253beebe0de4a$export$90db5fe1be5993c1);
|
|
2508
|
+
let $ede253beebe0de4a$export$90db5fe1be5993c1;
|
|
2509
|
+
(function(BuyEventType) {
|
|
2510
|
+
BuyEventType["SUCCESS"] = "success";
|
|
2511
|
+
BuyEventType["FAILURE"] = "failure";
|
|
2512
|
+
BuyEventType["NOT_CONNECTED"] = "not_connected";
|
|
2513
|
+
BuyEventType["CLOSE"] = "close";
|
|
2514
|
+
})($ede253beebe0de4a$export$90db5fe1be5993c1 || ($ede253beebe0de4a$export$90db5fe1be5993c1 = {}));
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
var $9234b4c577442a97$exports = {};
|
|
2518
|
+
|
|
2519
|
+
$parcel$export($9234b4c577442a97$exports, "Network", () => $9234b4c577442a97$export$95be4ae94445245a);
|
|
2520
|
+
$parcel$export($9234b4c577442a97$exports, "WidgetTheme", () => $9234b4c577442a97$export$c88931fdc51854eb);
|
|
2521
|
+
$parcel$export($9234b4c577442a97$exports, "ConnectionProviders", () => $d176a05e966364ba$export$3bfad4d03ada24c4);
|
|
2522
|
+
|
|
2523
|
+
let $9234b4c577442a97$export$95be4ae94445245a;
|
|
2524
|
+
(function(Network) {
|
|
2525
|
+
Network["ETHEREUM"] = "Ethereum";
|
|
2526
|
+
Network["GOERLI"] = "Goerli";
|
|
2527
|
+
Network["POLYGON"] = "Polygon";
|
|
2528
|
+
})($9234b4c577442a97$export$95be4ae94445245a || ($9234b4c577442a97$export$95be4ae94445245a = {}));
|
|
2529
|
+
let $9234b4c577442a97$export$c88931fdc51854eb;
|
|
2530
|
+
(function(WidgetTheme) {
|
|
2531
|
+
WidgetTheme["LIGHT"] = "light";
|
|
2532
|
+
WidgetTheme["DARK"] = "dark";
|
|
2533
|
+
WidgetTheme["CUSTOM"] = "custom";
|
|
2534
|
+
})($9234b4c577442a97$export$c88931fdc51854eb || ($9234b4c577442a97$export$c88931fdc51854eb = {}));
|
|
2535
|
+
|
|
2536
|
+
export { $28a5fdc2f5e6c742$export$d1bfa21f7c76447a as BridgeEventType, $ede253beebe0de4a$export$90db5fe1be5993c1 as BuyEventType, $a47e48dd2c04791b$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, Config, Configuration, $d71a87afc3136184$export$e72e7f9969a47dd3 as ConnectEventType, $d176a05e966364ba$export$3bfad4d03ada24c4 as ConnectionProviders, Environment, GenericIMXProvider, $88e4c575901cd68c$export$5a0ace85cae72d45 as IMTBLWidgetEvents, MetaMaskIMXProvider, $9234b4c577442a97$export$95be4ae94445245a as Network, PRODUCTION, Passport, PassportError, SANDBOX, StarkExAPIFactory, $5d497088f13bb116$export$140a49745ab55563 as SwapEventType, $9d0f1783d4d36e8a$export$d9be06b70b28c742 as WalletEventType, $9234b4c577442a97$export$c88931fdc51854eb as WidgetTheme };
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.2",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@biom3/design-tokens": "0.1.4-beta",
|
|
9
|
+
"@biom3/react": "^0.1.3-beta",
|
|
8
10
|
"@ethersproject/providers": "^5.7.2",
|
|
9
11
|
"@imtbl/core-sdk": "^1.0.2-alpha.5",
|
|
10
12
|
"@magic-ext/oidc": "^1.0.1",
|
|
11
13
|
"@metamask/detect-provider": "^2.0.0",
|
|
12
|
-
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
13
|
-
"@typescript-eslint/parser": "^5.57.1",
|
|
14
14
|
"axios": "^1.3.5",
|
|
15
15
|
"eslint": "^8.37.0",
|
|
16
16
|
"ethers": "^5.7.2",
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"oidc-client-ts": "^2.2.1",
|
|
19
19
|
"react": "^18.2.0",
|
|
20
20
|
"react-dom": "^18.2.0",
|
|
21
|
-
"react-router-dom": "^6.
|
|
21
|
+
"react-router-dom": "^6.10.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@imtbl/checkout-sdk-web": "0.0.0",
|
|
25
|
+
"@imtbl/checkout-ui-types": "0.0.0",
|
|
24
26
|
"@imtbl/config": "0.0.0",
|
|
25
27
|
"@imtbl/passport": "0.0.0",
|
|
26
28
|
"@imtbl/provider": "0.0.0",
|
|
@@ -57,6 +59,14 @@
|
|
|
57
59
|
"./provider": {
|
|
58
60
|
"types": "./dist/provider.d.ts",
|
|
59
61
|
"import": "./dist/provider.js"
|
|
62
|
+
},
|
|
63
|
+
"./checkout_sdk": {
|
|
64
|
+
"types": "./dist/checkout_sdk.d.ts",
|
|
65
|
+
"import": "./dist/checkout_sdk.js"
|
|
66
|
+
},
|
|
67
|
+
"./checkout_widgets": {
|
|
68
|
+
"types": "./dist/checkout_widgets.d.ts",
|
|
69
|
+
"import": "./dist/checkout_widgets.js"
|
|
60
70
|
}
|
|
61
71
|
},
|
|
62
72
|
"files": [
|
|
@@ -67,7 +77,7 @@
|
|
|
67
77
|
"main": "./dist/index.cjs",
|
|
68
78
|
"repository": "immutable/ts-immutable-sdk.git",
|
|
69
79
|
"scripts": {
|
|
70
|
-
"build": "yarn packageList
|
|
80
|
+
"build": "yarn packageList && yarn updateDependencies && rm -rf dist && NODE_ENV=production rollup --config rollup.config.js && rm -rf dist/types",
|
|
71
81
|
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
|
|
72
82
|
"packageList": "./scripts/generate-package-list.sh",
|
|
73
83
|
"typecheck": "tsc --noEmit --jsx preserve",
|