@moon-x/react-sdk 0.8.0 → 0.9.0
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/README.md +98 -19
- package/dist/{chunk-Y6HSLN2H.mjs → chunk-7XFCJAFG.mjs} +75 -74
- package/dist/{chunk-4YS67FSE.js → chunk-F345C4FX.js} +107 -102
- package/dist/{chunk-RFAKWGRF.mjs → chunk-OAG4S5VJ.mjs} +20 -19
- package/dist/{chunk-YFGHPPR5.js → chunk-VBAVYDWQ.js} +236 -241
- package/dist/{ethereum-CWhbeptv.d.ts → ethereum-Eg3cJKce.d.ts} +20 -6
- package/dist/{ethereum-CGSlkQOw.d.mts → ethereum-lovLlqC2.d.mts} +20 -6
- package/dist/index.d.mts +146 -17
- package/dist/index.d.ts +146 -17
- package/dist/index.js +3085 -2647
- package/dist/index.mjs +1550 -1470
- package/dist/{solana-Cr7r3wi8.d.mts → solana-BVrNImZ1.d.mts} +13 -4
- package/dist/{solana-nUvZo4Zp.d.ts → solana-C9rN8lxH.d.ts} +13 -4
- package/dist/wallets/ethereum.d.mts +1 -1
- package/dist/wallets/ethereum.d.ts +1 -1
- package/dist/wallets/ethereum.js +15 -15
- package/dist/wallets/ethereum.mjs +1 -1
- package/dist/wallets/solana.d.mts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +11 -11
- package/dist/wallets/solana.mjs +1 -1
- package/package.json +6 -3
|
@@ -378,7 +378,7 @@ var useEthereumProvider = function useEthereumProvider(wallet) {
|
|
|
378
378
|
var currentChainId = wallet.chainId || 1;
|
|
379
379
|
var request = function request(args) {
|
|
380
380
|
return _async_to_generator(function() {
|
|
381
|
-
var method, _args_params, params, message, messageText, response, _params, transaction,
|
|
381
|
+
var method, _args_params, params, message, messageText, response, _params, transaction, requestedSendChainId, sendEntry, sendRpcUrl, sendResponse, _params1, txToSign, signResponse, _params2, typedData, accountAddr, typedDataResponse, _params3, typedDataV4, accountAddrV4, typedDataV4Response, _params4, hash, secp256k1Response, defaultEntry, rpcUrl, response2, data, error;
|
|
382
382
|
return _ts_generator(this, function(_state) {
|
|
383
383
|
switch(_state.label){
|
|
384
384
|
case 0:
|
|
@@ -487,28 +487,43 @@ var useEthereumProvider = function useEthereumProvider(wallet) {
|
|
|
487
487
|
throw new Error("eth_sendTransaction requires transaction parameter");
|
|
488
488
|
}
|
|
489
489
|
_params = _sliced_to_array(params, 1), transaction = _params[0];
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
'access',
|
|
493
|
-
function(_) {
|
|
494
|
-
return _.config;
|
|
495
|
-
},
|
|
496
|
-
'optionalAccess',
|
|
497
|
-
function(_2) {
|
|
498
|
-
return _2.ethereum;
|
|
499
|
-
},
|
|
490
|
+
requestedSendChainId = _optionalChain([
|
|
491
|
+
transaction,
|
|
500
492
|
'optionalAccess',
|
|
501
|
-
function(
|
|
502
|
-
return
|
|
493
|
+
function(_) {
|
|
494
|
+
return _.chainId;
|
|
503
495
|
}
|
|
504
|
-
]);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
496
|
+
]) != null && Number.isFinite(Number(transaction.chainId)) ? Number(transaction.chainId) : void 0;
|
|
497
|
+
sendEntry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
498
|
+
chains: _optionalChain([
|
|
499
|
+
coreSDK,
|
|
500
|
+
'access',
|
|
501
|
+
function(_2) {
|
|
502
|
+
return _2.config;
|
|
503
|
+
},
|
|
504
|
+
'optionalAccess',
|
|
505
|
+
function(_3) {
|
|
506
|
+
return _3.chains;
|
|
507
|
+
}
|
|
508
|
+
]),
|
|
509
|
+
requestedChainId: requestedSendChainId,
|
|
510
|
+
walletChainId: currentChainId,
|
|
511
|
+
defaultSelector: _optionalChain([
|
|
512
|
+
coreSDK,
|
|
513
|
+
'access',
|
|
514
|
+
function(_4) {
|
|
515
|
+
return _4.config;
|
|
516
|
+
},
|
|
517
|
+
'optionalAccess',
|
|
518
|
+
function(_5) {
|
|
519
|
+
return _5.defaultChain;
|
|
520
|
+
}
|
|
521
|
+
])
|
|
522
|
+
});
|
|
523
|
+
if (!sendEntry) {
|
|
524
|
+
throw new Error(requestedSendChainId != null ? "Transaction targets chainId ".concat(requestedSendChainId, ", which is not in the configured chains.") : "No chain configured. Please set `chains` (and optionally `defaultChain`) in MoonKeyProvider config.");
|
|
511
525
|
}
|
|
526
|
+
sendRpcUrl = _lib.resolveRpcUrl.call(void 0, sendEntry);
|
|
512
527
|
return [
|
|
513
528
|
4,
|
|
514
529
|
coreSDK.sendEthereumTransactionHeadless({
|
|
@@ -607,49 +622,34 @@ var useEthereumProvider = function useEthereumProvider(wallet) {
|
|
|
607
622
|
secp256k1Response.signature
|
|
608
623
|
];
|
|
609
624
|
case 16:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
'access',
|
|
613
|
-
function(_4) {
|
|
614
|
-
return _4.config;
|
|
615
|
-
},
|
|
616
|
-
'optionalAccess',
|
|
617
|
-
function(_5) {
|
|
618
|
-
return _5.ethereum;
|
|
619
|
-
},
|
|
620
|
-
'optionalAccess',
|
|
621
|
-
function(_6) {
|
|
622
|
-
return _6.supportedChains;
|
|
623
|
-
}
|
|
624
|
-
]);
|
|
625
|
-
if (supportedChains && supportedChains.length > 0) {
|
|
626
|
-
chain = _lib.getChainById.call(void 0, supportedChains, currentChainId);
|
|
627
|
-
if (chain) {
|
|
628
|
-
rpcUrl = _lib.getRpcUrl.call(void 0, chain);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
if (!rpcUrl) {
|
|
632
|
-
fallbackChain = _optionalChain([
|
|
625
|
+
defaultEntry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
626
|
+
chains: _optionalChain([
|
|
633
627
|
coreSDK,
|
|
634
628
|
'access',
|
|
635
|
-
function(
|
|
636
|
-
return
|
|
629
|
+
function(_6) {
|
|
630
|
+
return _6.config;
|
|
637
631
|
},
|
|
638
632
|
'optionalAccess',
|
|
633
|
+
function(_7) {
|
|
634
|
+
return _7.chains;
|
|
635
|
+
}
|
|
636
|
+
]),
|
|
637
|
+
walletChainId: currentChainId,
|
|
638
|
+
defaultSelector: _optionalChain([
|
|
639
|
+
coreSDK,
|
|
640
|
+
'access',
|
|
639
641
|
function(_8) {
|
|
640
|
-
return _8.
|
|
642
|
+
return _8.config;
|
|
641
643
|
},
|
|
642
644
|
'optionalAccess',
|
|
643
645
|
function(_9) {
|
|
644
646
|
return _9.defaultChain;
|
|
645
647
|
}
|
|
646
|
-
])
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
}
|
|
650
|
-
}
|
|
648
|
+
])
|
|
649
|
+
});
|
|
650
|
+
rpcUrl = defaultEntry ? _lib.resolveRpcUrl.call(void 0, defaultEntry) : void 0;
|
|
651
651
|
if (!rpcUrl) {
|
|
652
|
-
throw new Error("Unsupported method: ".concat(method, ". No RPC configured for chain ID ").concat(currentChainId, ". Please configure '
|
|
652
|
+
throw new Error("Unsupported method: ".concat(method, ". No RPC configured for chain ID ").concat(currentChainId, ". Please configure 'chains' (and optionally 'defaultChain') in MoonKeyProvider."));
|
|
653
653
|
}
|
|
654
654
|
_state.label = 17;
|
|
655
655
|
case 17:
|
|
@@ -771,7 +771,7 @@ var createEthereumProvider = function createEthereumProvider(wallet, coreSDK) {
|
|
|
771
771
|
var currentChainId = wallet.chainId || 1;
|
|
772
772
|
var request = function request(args) {
|
|
773
773
|
return _async_to_generator(function() {
|
|
774
|
-
var method, _args_params, params, message, messageText, response, _params, transaction,
|
|
774
|
+
var method, _args_params, params, message, messageText, response, _params, transaction, requestedSendChainId, sendEntry, sendTxRpcUrl, txResponse, _params1, txToSign, signResponse, _params2, typedData, typedDataResponse, defaultEntry, rpcUrl, rpcResponse, rpcResult;
|
|
775
775
|
return _ts_generator(this, function(_state) {
|
|
776
776
|
switch(_state.label){
|
|
777
777
|
case 0:
|
|
@@ -875,25 +875,43 @@ var createEthereumProvider = function createEthereumProvider(wallet, coreSDK) {
|
|
|
875
875
|
throw new Error("eth_sendTransaction requires transaction parameter");
|
|
876
876
|
}
|
|
877
877
|
_params = _sliced_to_array(params, 1), transaction = _params[0];
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
'access',
|
|
881
|
-
function(_10) {
|
|
882
|
-
return _10.config;
|
|
883
|
-
},
|
|
878
|
+
requestedSendChainId = _optionalChain([
|
|
879
|
+
transaction,
|
|
884
880
|
'optionalAccess',
|
|
885
|
-
function(
|
|
886
|
-
return
|
|
887
|
-
},
|
|
888
|
-
'optionalAccess',
|
|
889
|
-
function(_12) {
|
|
890
|
-
return _12.defaultChain;
|
|
881
|
+
function(_10) {
|
|
882
|
+
return _10.chainId;
|
|
891
883
|
}
|
|
892
|
-
]);
|
|
893
|
-
|
|
894
|
-
|
|
884
|
+
]) != null && Number.isFinite(Number(transaction.chainId)) ? Number(transaction.chainId) : void 0;
|
|
885
|
+
sendEntry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
886
|
+
chains: _optionalChain([
|
|
887
|
+
coreSDK,
|
|
888
|
+
'access',
|
|
889
|
+
function(_11) {
|
|
890
|
+
return _11.config;
|
|
891
|
+
},
|
|
892
|
+
'optionalAccess',
|
|
893
|
+
function(_12) {
|
|
894
|
+
return _12.chains;
|
|
895
|
+
}
|
|
896
|
+
]),
|
|
897
|
+
requestedChainId: requestedSendChainId,
|
|
898
|
+
walletChainId: currentChainId,
|
|
899
|
+
defaultSelector: _optionalChain([
|
|
900
|
+
coreSDK,
|
|
901
|
+
'access',
|
|
902
|
+
function(_13) {
|
|
903
|
+
return _13.config;
|
|
904
|
+
},
|
|
905
|
+
'optionalAccess',
|
|
906
|
+
function(_14) {
|
|
907
|
+
return _14.defaultChain;
|
|
908
|
+
}
|
|
909
|
+
])
|
|
910
|
+
});
|
|
911
|
+
if (!sendEntry) {
|
|
912
|
+
throw new Error(requestedSendChainId != null ? "Transaction targets chainId ".concat(requestedSendChainId, ", which is not in the configured chains.") : "No default chain configured");
|
|
895
913
|
}
|
|
896
|
-
sendTxRpcUrl = _lib.
|
|
914
|
+
sendTxRpcUrl = _lib.resolveRpcUrl.call(void 0, sendEntry);
|
|
897
915
|
return [
|
|
898
916
|
4,
|
|
899
917
|
coreSDK.sendEthereumTransactionHeadless({
|
|
@@ -948,43 +966,32 @@ var createEthereumProvider = function createEthereumProvider(wallet, coreSDK) {
|
|
|
948
966
|
typedDataResponse.signature
|
|
949
967
|
];
|
|
950
968
|
case 12:
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
'access',
|
|
954
|
-
function(_13) {
|
|
955
|
-
return _13.config;
|
|
956
|
-
},
|
|
957
|
-
'optionalAccess',
|
|
958
|
-
function(_14) {
|
|
959
|
-
return _14.ethereum;
|
|
960
|
-
},
|
|
961
|
-
'optionalAccess',
|
|
962
|
-
function(_15) {
|
|
963
|
-
return _15.supportedChains;
|
|
964
|
-
}
|
|
965
|
-
]) || [];
|
|
966
|
-
chain = _lib.getChainById.call(void 0, supportedChains, currentChainId);
|
|
967
|
-
rpcUrl = chain ? _lib.getRpcUrl.call(void 0, chain) : void 0;
|
|
968
|
-
if (!rpcUrl) {
|
|
969
|
-
defaultChain2 = _optionalChain([
|
|
969
|
+
defaultEntry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
970
|
+
chains: _optionalChain([
|
|
970
971
|
coreSDK,
|
|
971
972
|
'access',
|
|
972
|
-
function(
|
|
973
|
-
return
|
|
973
|
+
function(_15) {
|
|
974
|
+
return _15.config;
|
|
974
975
|
},
|
|
975
976
|
'optionalAccess',
|
|
977
|
+
function(_16) {
|
|
978
|
+
return _16.chains;
|
|
979
|
+
}
|
|
980
|
+
]),
|
|
981
|
+
walletChainId: currentChainId,
|
|
982
|
+
defaultSelector: _optionalChain([
|
|
983
|
+
coreSDK,
|
|
984
|
+
'access',
|
|
976
985
|
function(_17) {
|
|
977
|
-
return _17.
|
|
986
|
+
return _17.config;
|
|
978
987
|
},
|
|
979
988
|
'optionalAccess',
|
|
980
989
|
function(_18) {
|
|
981
990
|
return _18.defaultChain;
|
|
982
991
|
}
|
|
983
|
-
])
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}
|
|
987
|
-
}
|
|
992
|
+
])
|
|
993
|
+
});
|
|
994
|
+
rpcUrl = defaultEntry ? _lib.resolveRpcUrl.call(void 0, defaultEntry) : void 0;
|
|
988
995
|
if (!rpcUrl) {
|
|
989
996
|
throw new Error("Unsupported method: ".concat(method, ". No RPC URL found for chain ").concat(currentChainId));
|
|
990
997
|
}
|
|
@@ -1186,22 +1193,37 @@ var useWallets = function useWallets() {
|
|
|
1186
1193
|
var enhanceWallet = _react3.useCallback.call(void 0, function(wallet) {
|
|
1187
1194
|
var ethereumWallet = _object_spread_props(_object_spread({}, wallet), {
|
|
1188
1195
|
chainId: wallet.chainId || _optionalChain([
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1196
|
+
_lib.resolveEvmChainEntry.call(void 0, {
|
|
1197
|
+
chains: _optionalChain([
|
|
1198
|
+
coreSDK,
|
|
1199
|
+
'access',
|
|
1200
|
+
function(_23) {
|
|
1201
|
+
return _23.config;
|
|
1202
|
+
},
|
|
1203
|
+
'optionalAccess',
|
|
1204
|
+
function(_24) {
|
|
1205
|
+
return _24.chains;
|
|
1206
|
+
}
|
|
1207
|
+
]),
|
|
1208
|
+
defaultSelector: _optionalChain([
|
|
1209
|
+
coreSDK,
|
|
1210
|
+
'access',
|
|
1211
|
+
function(_25) {
|
|
1212
|
+
return _25.config;
|
|
1213
|
+
},
|
|
1214
|
+
'optionalAccess',
|
|
1215
|
+
function(_26) {
|
|
1216
|
+
return _26.defaultChain;
|
|
1217
|
+
}
|
|
1218
|
+
])
|
|
1219
|
+
}),
|
|
1198
1220
|
'optionalAccess',
|
|
1199
|
-
function(
|
|
1200
|
-
return
|
|
1221
|
+
function(_27) {
|
|
1222
|
+
return _27.chain;
|
|
1201
1223
|
},
|
|
1202
|
-
'
|
|
1203
|
-
function(
|
|
1204
|
-
return
|
|
1224
|
+
'access',
|
|
1225
|
+
function(_28) {
|
|
1226
|
+
return _28.id;
|
|
1205
1227
|
}
|
|
1206
1228
|
]),
|
|
1207
1229
|
switchChain: function switchChain(chainId) {
|
|
@@ -1263,26 +1285,26 @@ var useSignMessage = function useSignMessage() {
|
|
|
1263
1285
|
showWalletUI = _chunkSPXMMQ7Zjs.shouldShowWalletUI.call(void 0, _optionalChain([
|
|
1264
1286
|
params,
|
|
1265
1287
|
'access',
|
|
1266
|
-
function(
|
|
1267
|
-
return
|
|
1288
|
+
function(_29) {
|
|
1289
|
+
return _29.options;
|
|
1268
1290
|
},
|
|
1269
1291
|
'optionalAccess',
|
|
1270
|
-
function(
|
|
1271
|
-
return
|
|
1292
|
+
function(_30) {
|
|
1293
|
+
return _30.uiOptions;
|
|
1272
1294
|
}
|
|
1273
1295
|
]), _optionalChain([
|
|
1274
1296
|
coreSDK,
|
|
1275
1297
|
'access',
|
|
1276
|
-
function(
|
|
1277
|
-
return
|
|
1298
|
+
function(_31) {
|
|
1299
|
+
return _31.config;
|
|
1278
1300
|
},
|
|
1279
1301
|
'optionalAccess',
|
|
1280
|
-
function(
|
|
1281
|
-
return
|
|
1302
|
+
function(_32) {
|
|
1303
|
+
return _32.signMessageConfig;
|
|
1282
1304
|
},
|
|
1283
1305
|
'optionalAccess',
|
|
1284
|
-
function(
|
|
1285
|
-
return
|
|
1306
|
+
function(_33) {
|
|
1307
|
+
return _33.uiConfig;
|
|
1286
1308
|
}
|
|
1287
1309
|
]));
|
|
1288
1310
|
return [
|
|
@@ -1321,7 +1343,7 @@ var useSignTransaction = function useSignTransaction() {
|
|
|
1321
1343
|
var shared = _ethereum.useSignTransaction.call(void 0);
|
|
1322
1344
|
return {
|
|
1323
1345
|
signTransaction: function signTransaction(param) {
|
|
1324
|
-
var transaction = param.transaction, wallet = param.wallet, options = param.options;
|
|
1346
|
+
var transaction = param.transaction, wallet = param.wallet, chain = param.chain, options = param.options;
|
|
1325
1347
|
return _async_to_generator(function() {
|
|
1326
1348
|
var serializedTransaction, showWalletUI, error;
|
|
1327
1349
|
return _ts_generator(this, function(_state) {
|
|
@@ -1341,36 +1363,29 @@ var useSignTransaction = function useSignTransaction() {
|
|
|
1341
1363
|
public_address: wallet.public_address,
|
|
1342
1364
|
chainId: wallet.chainId
|
|
1343
1365
|
},
|
|
1344
|
-
|
|
1366
|
+
chains: _optionalChain([
|
|
1345
1367
|
coreSDK,
|
|
1346
1368
|
'access',
|
|
1347
|
-
function(
|
|
1348
|
-
return
|
|
1349
|
-
},
|
|
1350
|
-
'optionalAccess',
|
|
1351
|
-
function(_33) {
|
|
1352
|
-
return _33.ethereum;
|
|
1369
|
+
function(_34) {
|
|
1370
|
+
return _34.config;
|
|
1353
1371
|
},
|
|
1354
1372
|
'optionalAccess',
|
|
1355
|
-
function(
|
|
1356
|
-
return
|
|
1373
|
+
function(_35) {
|
|
1374
|
+
return _35.chains;
|
|
1357
1375
|
}
|
|
1358
1376
|
]),
|
|
1359
1377
|
defaultChain: _optionalChain([
|
|
1360
1378
|
coreSDK,
|
|
1361
1379
|
'access',
|
|
1362
|
-
function(_35) {
|
|
1363
|
-
return _35.config;
|
|
1364
|
-
},
|
|
1365
|
-
'optionalAccess',
|
|
1366
1380
|
function(_36) {
|
|
1367
|
-
return _36.
|
|
1381
|
+
return _36.config;
|
|
1368
1382
|
},
|
|
1369
1383
|
'optionalAccess',
|
|
1370
1384
|
function(_37) {
|
|
1371
1385
|
return _37.defaultChain;
|
|
1372
1386
|
}
|
|
1373
|
-
])
|
|
1387
|
+
]),
|
|
1388
|
+
chainSelector: chain
|
|
1374
1389
|
})
|
|
1375
1390
|
];
|
|
1376
1391
|
case 1:
|
|
@@ -1558,51 +1573,43 @@ var useSign7702Authorization = function useSign7702Authorization() {
|
|
|
1558
1573
|
var coreSDK = _chunkSPXMMQ7Zjs.useAuthSDK.call(void 0);
|
|
1559
1574
|
return {
|
|
1560
1575
|
signAuthorization: function signAuthorization(param) {
|
|
1561
|
-
var contractAddress = param.contractAddress, nonce = param.nonce, executor = param.executor, wallet = param.wallet, options = param.options;
|
|
1576
|
+
var contractAddress = param.contractAddress, nonce = param.nonce, executor = param.executor, wallet = param.wallet, chain = param.chain, options = param.options;
|
|
1562
1577
|
return _async_to_generator(function() {
|
|
1563
|
-
var walletChainId,
|
|
1578
|
+
var walletChainId, targetEntry, derivedChainId, showWalletUI, error;
|
|
1564
1579
|
return _ts_generator(this, function(_state) {
|
|
1565
1580
|
switch(_state.label){
|
|
1566
1581
|
case 0:
|
|
1567
1582
|
walletChainId = wallet.chainId;
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
'access',
|
|
1571
|
-
function(_48) {
|
|
1572
|
-
return _48.config;
|
|
1573
|
-
},
|
|
1574
|
-
'optionalAccess',
|
|
1575
|
-
function(_49) {
|
|
1576
|
-
return _49.ethereum;
|
|
1577
|
-
},
|
|
1578
|
-
'optionalAccess',
|
|
1579
|
-
function(_50) {
|
|
1580
|
-
return _50.supportedChains;
|
|
1581
|
-
}
|
|
1582
|
-
])) {
|
|
1583
|
-
targetChain = _lib.getChainById.call(void 0, coreSDK.config.ethereum.supportedChains, walletChainId);
|
|
1584
|
-
}
|
|
1585
|
-
if (!targetChain) {
|
|
1586
|
-
targetChain = _optionalChain([
|
|
1583
|
+
targetEntry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
1584
|
+
chains: _optionalChain([
|
|
1587
1585
|
coreSDK,
|
|
1588
1586
|
'access',
|
|
1589
|
-
function(
|
|
1590
|
-
return
|
|
1587
|
+
function(_48) {
|
|
1588
|
+
return _48.config;
|
|
1591
1589
|
},
|
|
1592
1590
|
'optionalAccess',
|
|
1593
|
-
function(
|
|
1594
|
-
return
|
|
1591
|
+
function(_49) {
|
|
1592
|
+
return _49.chains;
|
|
1593
|
+
}
|
|
1594
|
+
]),
|
|
1595
|
+
selector: chain,
|
|
1596
|
+
walletChainId: walletChainId,
|
|
1597
|
+
defaultSelector: _optionalChain([
|
|
1598
|
+
coreSDK,
|
|
1599
|
+
'access',
|
|
1600
|
+
function(_50) {
|
|
1601
|
+
return _50.config;
|
|
1595
1602
|
},
|
|
1596
1603
|
'optionalAccess',
|
|
1597
|
-
function(
|
|
1598
|
-
return
|
|
1604
|
+
function(_51) {
|
|
1605
|
+
return _51.defaultChain;
|
|
1599
1606
|
}
|
|
1600
|
-
])
|
|
1607
|
+
])
|
|
1608
|
+
});
|
|
1609
|
+
if (!targetEntry) {
|
|
1610
|
+
throw new Error(chain != null ? 'chain "'.concat(chain, '" is not in the configured chains.') : "No chain configured. Please set `chains` (and optionally `defaultChain`) in MoonKeyProvider config.");
|
|
1601
1611
|
}
|
|
1602
|
-
|
|
1603
|
-
throw new Error("No chain configured. Please set ethereum.defaultChain in MoonKeyProvider config.");
|
|
1604
|
-
}
|
|
1605
|
-
derivedChainId = targetChain.id;
|
|
1612
|
+
derivedChainId = targetEntry.chain.id;
|
|
1606
1613
|
_state.label = 1;
|
|
1607
1614
|
case 1:
|
|
1608
1615
|
_state.trys.push([
|
|
@@ -1614,22 +1621,22 @@ var useSign7702Authorization = function useSign7702Authorization() {
|
|
|
1614
1621
|
showWalletUI = _chunkSPXMMQ7Zjs.shouldShowWalletUI.call(void 0, _optionalChain([
|
|
1615
1622
|
options,
|
|
1616
1623
|
'optionalAccess',
|
|
1617
|
-
function(
|
|
1618
|
-
return
|
|
1624
|
+
function(_52) {
|
|
1625
|
+
return _52.uiOptions;
|
|
1619
1626
|
}
|
|
1620
1627
|
]), _optionalChain([
|
|
1621
1628
|
coreSDK,
|
|
1622
1629
|
'access',
|
|
1623
|
-
function(
|
|
1624
|
-
return
|
|
1630
|
+
function(_53) {
|
|
1631
|
+
return _53.config;
|
|
1625
1632
|
},
|
|
1626
1633
|
'optionalAccess',
|
|
1627
|
-
function(
|
|
1628
|
-
return
|
|
1634
|
+
function(_54) {
|
|
1635
|
+
return _54.signMessageConfig;
|
|
1629
1636
|
},
|
|
1630
1637
|
'optionalAccess',
|
|
1631
|
-
function(
|
|
1632
|
-
return
|
|
1638
|
+
function(_55) {
|
|
1639
|
+
return _55.uiConfig;
|
|
1633
1640
|
}
|
|
1634
1641
|
]));
|
|
1635
1642
|
return [
|
|
@@ -1645,8 +1652,8 @@ var useSign7702Authorization = function useSign7702Authorization() {
|
|
|
1645
1652
|
uiOptions: _optionalChain([
|
|
1646
1653
|
options,
|
|
1647
1654
|
'optionalAccess',
|
|
1648
|
-
function(
|
|
1649
|
-
return
|
|
1655
|
+
function(_56) {
|
|
1656
|
+
return _56.uiOptions;
|
|
1650
1657
|
}
|
|
1651
1658
|
])
|
|
1652
1659
|
}
|
|
@@ -1681,7 +1688,7 @@ var useSendTransaction = function useSendTransaction() {
|
|
|
1681
1688
|
var shared = _ethereum.useSendTransaction.call(void 0);
|
|
1682
1689
|
return {
|
|
1683
1690
|
sendTransaction: function sendTransaction(param) {
|
|
1684
|
-
var transaction = param.transaction, wallet = param.wallet, options = param.options;
|
|
1691
|
+
var transaction = param.transaction, wallet = param.wallet, chain = param.chain, rpcUrlOverride = param.rpcUrl, options = param.options;
|
|
1685
1692
|
return _async_to_generator(function() {
|
|
1686
1693
|
var _ref, preparedTx, rpcUrl, showWalletUI, response, error;
|
|
1687
1694
|
return _ts_generator(this, function(_state) {
|
|
@@ -1701,36 +1708,30 @@ var useSendTransaction = function useSendTransaction() {
|
|
|
1701
1708
|
public_address: wallet.public_address,
|
|
1702
1709
|
chainId: wallet.chainId
|
|
1703
1710
|
},
|
|
1704
|
-
|
|
1711
|
+
chains: _optionalChain([
|
|
1705
1712
|
coreSDK,
|
|
1706
1713
|
'access',
|
|
1707
|
-
function(
|
|
1708
|
-
return
|
|
1714
|
+
function(_57) {
|
|
1715
|
+
return _57.config;
|
|
1709
1716
|
},
|
|
1710
1717
|
'optionalAccess',
|
|
1711
|
-
function(
|
|
1712
|
-
return
|
|
1713
|
-
},
|
|
1714
|
-
'optionalAccess',
|
|
1715
|
-
function(_61) {
|
|
1716
|
-
return _61.supportedChains;
|
|
1718
|
+
function(_58) {
|
|
1719
|
+
return _58.chains;
|
|
1717
1720
|
}
|
|
1718
1721
|
]),
|
|
1719
1722
|
defaultChain: _optionalChain([
|
|
1720
1723
|
coreSDK,
|
|
1721
1724
|
'access',
|
|
1722
|
-
function(
|
|
1723
|
-
return
|
|
1724
|
-
},
|
|
1725
|
-
'optionalAccess',
|
|
1726
|
-
function(_63) {
|
|
1727
|
-
return _63.ethereum;
|
|
1725
|
+
function(_59) {
|
|
1726
|
+
return _59.config;
|
|
1728
1727
|
},
|
|
1729
1728
|
'optionalAccess',
|
|
1730
|
-
function(
|
|
1731
|
-
return
|
|
1729
|
+
function(_60) {
|
|
1730
|
+
return _60.defaultChain;
|
|
1732
1731
|
}
|
|
1733
|
-
])
|
|
1732
|
+
]),
|
|
1733
|
+
chainSelector: chain,
|
|
1734
|
+
rpcUrlOverride: rpcUrlOverride
|
|
1734
1735
|
})
|
|
1735
1736
|
];
|
|
1736
1737
|
case 1:
|
|
@@ -1738,22 +1739,22 @@ var useSendTransaction = function useSendTransaction() {
|
|
|
1738
1739
|
showWalletUI = _chunkSPXMMQ7Zjs.shouldShowWalletUI.call(void 0, _optionalChain([
|
|
1739
1740
|
options,
|
|
1740
1741
|
'optionalAccess',
|
|
1741
|
-
function(
|
|
1742
|
-
return
|
|
1742
|
+
function(_61) {
|
|
1743
|
+
return _61.uiOptions;
|
|
1743
1744
|
}
|
|
1744
1745
|
]), _optionalChain([
|
|
1745
1746
|
coreSDK,
|
|
1746
1747
|
'access',
|
|
1747
|
-
function(
|
|
1748
|
-
return
|
|
1748
|
+
function(_62) {
|
|
1749
|
+
return _62.config;
|
|
1749
1750
|
},
|
|
1750
1751
|
'optionalAccess',
|
|
1751
|
-
function(
|
|
1752
|
-
return
|
|
1752
|
+
function(_63) {
|
|
1753
|
+
return _63.signMessageConfig;
|
|
1753
1754
|
},
|
|
1754
1755
|
'optionalAccess',
|
|
1755
|
-
function(
|
|
1756
|
-
return
|
|
1756
|
+
function(_64) {
|
|
1757
|
+
return _64.uiConfig;
|
|
1757
1758
|
}
|
|
1758
1759
|
]));
|
|
1759
1760
|
return [
|
|
@@ -1767,8 +1768,8 @@ var useSendTransaction = function useSendTransaction() {
|
|
|
1767
1768
|
uiOptions: _optionalChain([
|
|
1768
1769
|
options,
|
|
1769
1770
|
'optionalAccess',
|
|
1770
|
-
function(
|
|
1771
|
-
return
|
|
1771
|
+
function(_65) {
|
|
1772
|
+
return _65.uiOptions;
|
|
1772
1773
|
}
|
|
1773
1774
|
])
|
|
1774
1775
|
}
|
|
@@ -1807,7 +1808,7 @@ var useGetBalance = function useGetBalance() {
|
|
|
1807
1808
|
return {
|
|
1808
1809
|
getBalance: function getBalance(params) {
|
|
1809
1810
|
return _async_to_generator(function() {
|
|
1810
|
-
var walletChainId,
|
|
1811
|
+
var walletChainId, entry, rpcUrl, error;
|
|
1811
1812
|
return _ts_generator(this, function(_state) {
|
|
1812
1813
|
switch(_state.label){
|
|
1813
1814
|
case 0:
|
|
@@ -1818,46 +1819,40 @@ var useGetBalance = function useGetBalance() {
|
|
|
1818
1819
|
3
|
|
1819
1820
|
]);
|
|
1820
1821
|
walletChainId = params.wallet.chainId;
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
'access',
|
|
1824
|
-
function(_70) {
|
|
1825
|
-
return _70.config;
|
|
1826
|
-
},
|
|
1827
|
-
'optionalAccess',
|
|
1828
|
-
function(_71) {
|
|
1829
|
-
return _71.ethereum;
|
|
1830
|
-
},
|
|
1831
|
-
'optionalAccess',
|
|
1832
|
-
function(_72) {
|
|
1833
|
-
return _72.supportedChains;
|
|
1834
|
-
}
|
|
1835
|
-
])) {
|
|
1836
|
-
targetChain = _lib.getChainById.call(void 0, coreSDK.config.ethereum.supportedChains, walletChainId);
|
|
1837
|
-
}
|
|
1838
|
-
if (!targetChain) {
|
|
1839
|
-
targetChain = _optionalChain([
|
|
1822
|
+
entry = _lib.resolveEvmChainEntry.call(void 0, {
|
|
1823
|
+
chains: _optionalChain([
|
|
1840
1824
|
coreSDK,
|
|
1841
1825
|
'access',
|
|
1842
|
-
function(
|
|
1843
|
-
return
|
|
1826
|
+
function(_66) {
|
|
1827
|
+
return _66.config;
|
|
1844
1828
|
},
|
|
1845
1829
|
'optionalAccess',
|
|
1846
|
-
function(
|
|
1847
|
-
return
|
|
1830
|
+
function(_67) {
|
|
1831
|
+
return _67.chains;
|
|
1832
|
+
}
|
|
1833
|
+
]),
|
|
1834
|
+
selector: params.chain,
|
|
1835
|
+
walletChainId: walletChainId,
|
|
1836
|
+
defaultSelector: _optionalChain([
|
|
1837
|
+
coreSDK,
|
|
1838
|
+
'access',
|
|
1839
|
+
function(_68) {
|
|
1840
|
+
return _68.config;
|
|
1848
1841
|
},
|
|
1849
1842
|
'optionalAccess',
|
|
1850
|
-
function(
|
|
1851
|
-
return
|
|
1843
|
+
function(_69) {
|
|
1844
|
+
return _69.defaultChain;
|
|
1852
1845
|
}
|
|
1853
|
-
])
|
|
1854
|
-
}
|
|
1855
|
-
if (!
|
|
1856
|
-
throw new Error(
|
|
1846
|
+
])
|
|
1847
|
+
});
|
|
1848
|
+
if (params.chain != null && !entry && !params.rpcUrl) {
|
|
1849
|
+
throw new Error('chain "'.concat(params.chain, '" is not in the configured chains.'));
|
|
1857
1850
|
}
|
|
1858
|
-
rpcUrl =
|
|
1851
|
+
rpcUrl = _nullishCoalesce(params.rpcUrl, function() {
|
|
1852
|
+
return entry ? _lib.resolveRpcUrl.call(void 0, entry) : void 0;
|
|
1853
|
+
});
|
|
1859
1854
|
if (!rpcUrl) {
|
|
1860
|
-
throw new Error("No RPC URL
|
|
1855
|
+
throw new Error("No RPC URL \u2014 set `chains` (and optionally `defaultChain`) in MoonKeyProvider config, or pass an `rpcUrl`.");
|
|
1861
1856
|
}
|
|
1862
1857
|
return [
|
|
1863
1858
|
4,
|
|
@@ -1934,8 +1929,8 @@ var useImportKey = function useImportKey() {
|
|
|
1934
1929
|
if (!(_optionalChain([
|
|
1935
1930
|
params,
|
|
1936
1931
|
'optionalAccess',
|
|
1937
|
-
function(
|
|
1938
|
-
return
|
|
1932
|
+
function(_70) {
|
|
1933
|
+
return _70.key;
|
|
1939
1934
|
}
|
|
1940
1935
|
]) !== void 0)) return [
|
|
1941
1936
|
3,
|