@kimafinance/kima-transaction-widget 1.2.28-beta.1 → 1.2.29-beta.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/index.js +1 -139
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2 -37
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1292,93 +1292,6 @@ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.it
|
|
|
1292
1292
|
|
|
1293
1293
|
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
1294
1294
|
|
|
1295
|
-
// Asynchronously implement a generic for loop
|
|
1296
|
-
function _for(test, update, body) {
|
|
1297
|
-
var stage;
|
|
1298
|
-
for (;;) {
|
|
1299
|
-
var shouldContinue = test();
|
|
1300
|
-
if (_isSettledPact(shouldContinue)) {
|
|
1301
|
-
shouldContinue = shouldContinue.v;
|
|
1302
|
-
}
|
|
1303
|
-
if (!shouldContinue) {
|
|
1304
|
-
return result;
|
|
1305
|
-
}
|
|
1306
|
-
if (shouldContinue.then) {
|
|
1307
|
-
stage = 0;
|
|
1308
|
-
break;
|
|
1309
|
-
}
|
|
1310
|
-
var result = body();
|
|
1311
|
-
if (result && result.then) {
|
|
1312
|
-
if (_isSettledPact(result)) {
|
|
1313
|
-
result = result.s;
|
|
1314
|
-
} else {
|
|
1315
|
-
stage = 1;
|
|
1316
|
-
break;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
if (update) {
|
|
1320
|
-
var updateValue = update();
|
|
1321
|
-
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
1322
|
-
stage = 2;
|
|
1323
|
-
break;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
var pact = new _Pact();
|
|
1328
|
-
var reject = _settle.bind(null, pact, 2);
|
|
1329
|
-
(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
|
|
1330
|
-
return pact;
|
|
1331
|
-
function _resumeAfterBody(value) {
|
|
1332
|
-
result = value;
|
|
1333
|
-
do {
|
|
1334
|
-
if (update) {
|
|
1335
|
-
updateValue = update();
|
|
1336
|
-
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
1337
|
-
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
shouldContinue = test();
|
|
1342
|
-
if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
|
|
1343
|
-
_settle(pact, 1, result);
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1346
|
-
if (shouldContinue.then) {
|
|
1347
|
-
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
1348
|
-
return;
|
|
1349
|
-
}
|
|
1350
|
-
result = body();
|
|
1351
|
-
if (_isSettledPact(result)) {
|
|
1352
|
-
result = result.v;
|
|
1353
|
-
}
|
|
1354
|
-
} while (!result || !result.then);
|
|
1355
|
-
result.then(_resumeAfterBody).then(void 0, reject);
|
|
1356
|
-
}
|
|
1357
|
-
function _resumeAfterTest(shouldContinue) {
|
|
1358
|
-
if (shouldContinue) {
|
|
1359
|
-
result = body();
|
|
1360
|
-
if (result && result.then) {
|
|
1361
|
-
result.then(_resumeAfterBody).then(void 0, reject);
|
|
1362
|
-
} else {
|
|
1363
|
-
_resumeAfterBody(result);
|
|
1364
|
-
}
|
|
1365
|
-
} else {
|
|
1366
|
-
_settle(pact, 1, result);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
function _resumeAfterUpdate() {
|
|
1370
|
-
if (shouldContinue = test()) {
|
|
1371
|
-
if (shouldContinue.then) {
|
|
1372
|
-
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
1373
|
-
} else {
|
|
1374
|
-
_resumeAfterTest(shouldContinue);
|
|
1375
|
-
}
|
|
1376
|
-
} else {
|
|
1377
|
-
_settle(pact, 1, result);
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
1295
|
// Asynchronously implement a do ... while loop
|
|
1383
1296
|
function _do(body, test) {
|
|
1384
1297
|
var awaitBody;
|
|
@@ -2214,13 +2127,6 @@ function useIsWalletReady() {
|
|
|
2214
2127
|
var correctEvmNetwork = CHAIN_NAMES_TO_IDS[correctChain];
|
|
2215
2128
|
var hasCorrectEvmNetwork = evmChainId === correctEvmNetwork;
|
|
2216
2129
|
var events = react.useWeb3ModalEvents();
|
|
2217
|
-
var _useState = React.useState('loading'),
|
|
2218
|
-
capabilityState = _useState[0],
|
|
2219
|
-
setCapabilityState = _useState[1];
|
|
2220
|
-
var _useState2 = React.useState(),
|
|
2221
|
-
capabilities = _useState2[0],
|
|
2222
|
-
setCapabilities = _useState2[1];
|
|
2223
|
-
var capabilityMessage = capabilityState === 'loading' ? 'Checking capabilities...' : capabilityState === 'cancelled' ? 'Capability check cancelled by wallet. Please refresh the page and try again.' : capabilityState === 'missing' ? 'Could not find an installed Sats Connect capable wallet. Please install a wallet and try again.' : !capabilities ? 'Something went wrong with getting capabilities' : undefined;
|
|
2224
2130
|
React.useEffect(function () {
|
|
2225
2131
|
var _events$data, _events$data2;
|
|
2226
2132
|
if (((_events$data = events.data) === null || _events$data === void 0 ? void 0 : _events$data.event) === 'SELECT_WALLET' || ((_events$data2 = events.data) === null || _events$data2 === void 0 ? void 0 : _events$data2.event) === 'CONNECT_SUCCESS') {
|
|
@@ -2228,50 +2134,6 @@ function useIsWalletReady() {
|
|
|
2228
2134
|
localStorage.setItem('wallet', (_events$data3 = events.data) === null || _events$data3 === void 0 ? void 0 : (_events$data3$propert = _events$data3.properties) === null || _events$data3$propert === void 0 ? void 0 : _events$data3$propert.name);
|
|
2229
2135
|
}
|
|
2230
2136
|
}, [events]);
|
|
2231
|
-
React.useEffect(function () {
|
|
2232
|
-
var runCapabilityCheck = function runCapabilityCheck() {
|
|
2233
|
-
try {
|
|
2234
|
-
var runs = 0;
|
|
2235
|
-
var MAX_RUNS = 20;
|
|
2236
|
-
setCapabilityState('loading');
|
|
2237
|
-
var _temp3 = _for(function () {
|
|
2238
|
-
return runs < MAX_RUNS;
|
|
2239
|
-
}, void 0, function () {
|
|
2240
|
-
function _temp2() {
|
|
2241
|
-
return Promise.resolve(new Promise(function (resolve) {
|
|
2242
|
-
return setTimeout(resolve, 100);
|
|
2243
|
-
})).then(function () {});
|
|
2244
|
-
}
|
|
2245
|
-
var _temp = _catch(function () {
|
|
2246
|
-
return Promise.resolve(satsConnect.getCapabilities({
|
|
2247
|
-
onFinish: function onFinish(response) {
|
|
2248
|
-
setCapabilities(new Set(response));
|
|
2249
|
-
setCapabilityState('loaded');
|
|
2250
|
-
},
|
|
2251
|
-
onCancel: function onCancel() {
|
|
2252
|
-
setCapabilityState('cancelled');
|
|
2253
|
-
},
|
|
2254
|
-
payload: {
|
|
2255
|
-
network: {
|
|
2256
|
-
type: satsConnect.BitcoinNetworkType.Testnet
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
})).then(function () {});
|
|
2260
|
-
}, function () {
|
|
2261
|
-
runs++;
|
|
2262
|
-
if (runs === MAX_RUNS) {
|
|
2263
|
-
setCapabilityState('missing');
|
|
2264
|
-
}
|
|
2265
|
-
});
|
|
2266
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
2267
|
-
});
|
|
2268
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
2269
|
-
} catch (e) {
|
|
2270
|
-
return Promise.reject(e);
|
|
2271
|
-
}
|
|
2272
|
-
};
|
|
2273
|
-
runCapabilityCheck();
|
|
2274
|
-
}, []);
|
|
2275
2137
|
var connectBitcoinWallet = React.useCallback(function () {
|
|
2276
2138
|
try {
|
|
2277
2139
|
return Promise.resolve(satsConnect.getAddress({
|
|
@@ -2332,7 +2194,7 @@ function useIsWalletReady() {
|
|
|
2332
2194
|
if (bitcoinAddress) {
|
|
2333
2195
|
return createWalletStatus(true, undefined, connectBitcoinWallet, bitcoinAddress);
|
|
2334
2196
|
}
|
|
2335
|
-
return createWalletStatus(false,
|
|
2197
|
+
return createWalletStatus(false, 'Xverse wallet connection error', connectBitcoinWallet, '');
|
|
2336
2198
|
} else if (isEVMChain(correctChain) && hasEthInfo && evmAddress) {
|
|
2337
2199
|
if (hasCorrectEvmNetwork) {
|
|
2338
2200
|
return createWalletStatus(true, undefined, connectBitcoinWallet, evmAddress);
|