@injectivelabs/wallet-core 1.16.38-alpha.2 → 1.16.38-alpha.4
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/cjs/index.cjs +64 -57
- package/dist/cjs/index.d.cts +9 -2
- package/dist/esm/index.d.ts +9 -2
- package/dist/esm/index.js +12 -5
- package/package.json +8 -8
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,9 +2,13 @@ let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
|
2
2
|
let eventemitter3 = require("eventemitter3");
|
|
3
3
|
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
4
4
|
let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
|
|
5
|
+
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
6
|
+
let __injectivelabs_sdk_ts_core_accounts = require("@injectivelabs/sdk-ts/core/accounts");
|
|
7
|
+
let __injectivelabs_sdk_ts_client_indexer = require("@injectivelabs/sdk-ts/client/indexer");
|
|
5
8
|
let __injectivelabs_networks = require("@injectivelabs/networks");
|
|
9
|
+
let __injectivelabs_sdk_ts_client_chain = require("@injectivelabs/sdk-ts/client/chain");
|
|
6
10
|
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
7
|
-
let
|
|
11
|
+
let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
|
|
8
12
|
|
|
9
13
|
//#region src/utils/tx.ts
|
|
10
14
|
const checkIfTxRunOutOfGas = (e) => {
|
|
@@ -99,7 +103,7 @@ var BaseWalletStrategy = class {
|
|
|
99
103
|
getWallet() {
|
|
100
104
|
return this.wallet;
|
|
101
105
|
}
|
|
102
|
-
setWallet(wallet) {
|
|
106
|
+
async setWallet(wallet) {
|
|
103
107
|
this.wallet = wallet;
|
|
104
108
|
this.getStrategy();
|
|
105
109
|
}
|
|
@@ -116,6 +120,9 @@ var BaseWalletStrategy = class {
|
|
|
116
120
|
getAddresses(args) {
|
|
117
121
|
return this.getStrategy().getAddresses(args);
|
|
118
122
|
}
|
|
123
|
+
getAddressesInfo(args) {
|
|
124
|
+
return this.getStrategy().getAddressesInfo(args);
|
|
125
|
+
}
|
|
119
126
|
getWalletDeviceType() {
|
|
120
127
|
return this.getStrategy().getWalletDeviceType();
|
|
121
128
|
}
|
|
@@ -215,7 +222,7 @@ var BaseWalletStrategy = class {
|
|
|
215
222
|
//#region src/broadcaster/MsgBroadcaster.ts
|
|
216
223
|
const getEthereumWalletPubKey = async ({ pubKey, eip712TypedData, signature }) => {
|
|
217
224
|
if (pubKey) return pubKey;
|
|
218
|
-
return (0,
|
|
225
|
+
return (0, __injectivelabs_sdk_ts_utils.hexToBase64)(await (0, __injectivelabs_sdk_ts_utils.recoverTypedSignaturePubKey)(eip712TypedData, signature));
|
|
219
226
|
};
|
|
220
227
|
const defaultRetriesConfig = () => ({ [`${__injectivelabs_exceptions.TransactionChainErrorModule.CosmosSdk}-${__injectivelabs_exceptions.ChainCosmosErrorCode.ErrMempoolIsFull}`]: {
|
|
221
228
|
retries: 0,
|
|
@@ -295,7 +302,7 @@ var MsgBroadcaster = class {
|
|
|
295
302
|
ethereumAddress: (0, __injectivelabs_wallet_base.getEthereumSignerAddress)(tx.injectiveAddress),
|
|
296
303
|
injectiveAddress: (0, __injectivelabs_wallet_base.getInjectiveSignerAddress)(tx.injectiveAddress)
|
|
297
304
|
};
|
|
298
|
-
if (
|
|
305
|
+
if (__injectivelabs_sdk_ts_utils.ofacList.includes(txWithAddresses.ethereumAddress)) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
299
306
|
try {
|
|
300
307
|
return (0, __injectivelabs_wallet_base.isCosmosWallet)(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : (0, __injectivelabs_wallet_base.isEip712V2OnlyWallet)(walletStrategy.wallet) ? await this.broadcastEip712V2(txWithAddresses) : await this.broadcastEip712(txWithAddresses);
|
|
301
308
|
} catch (e) {
|
|
@@ -320,7 +327,7 @@ var MsgBroadcaster = class {
|
|
|
320
327
|
ethereumAddress: (0, __injectivelabs_wallet_base.getEthereumSignerAddress)(tx.injectiveAddress),
|
|
321
328
|
injectiveAddress: (0, __injectivelabs_wallet_base.getInjectiveSignerAddress)(tx.injectiveAddress)
|
|
322
329
|
};
|
|
323
|
-
if (
|
|
330
|
+
if (__injectivelabs_sdk_ts_utils.ofacList.includes(txWithAddresses.ethereumAddress)) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
324
331
|
try {
|
|
325
332
|
return (0, __injectivelabs_wallet_base.isCosmosWallet)(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : await this.broadcastEip712V2(txWithAddresses);
|
|
326
333
|
} catch (e) {
|
|
@@ -344,7 +351,7 @@ var MsgBroadcaster = class {
|
|
|
344
351
|
ethereumAddress: (0, __injectivelabs_wallet_base.getEthereumSignerAddress)(tx.injectiveAddress),
|
|
345
352
|
injectiveAddress: (0, __injectivelabs_wallet_base.getInjectiveSignerAddress)(tx.injectiveAddress)
|
|
346
353
|
};
|
|
347
|
-
if (
|
|
354
|
+
if (__injectivelabs_sdk_ts_utils.ofacList.includes(txWithAddresses.ethereumAddress)) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
348
355
|
try {
|
|
349
356
|
return (0, __injectivelabs_wallet_base.isCosmosWallet)(walletStrategy.wallet) ? await this.broadcastDirectSignWithFeeDelegation(txWithAddresses) : await this.broadcastEip712WithFeeDelegation(txWithAddresses);
|
|
350
357
|
} catch (e) {
|
|
@@ -374,7 +381,7 @@ var MsgBroadcaster = class {
|
|
|
374
381
|
const timeoutHeight = (0, __injectivelabs_utils.toBigNumber)(latestHeight.toString()).plus(txTimeoutInBlocks);
|
|
375
382
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
376
383
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
377
|
-
const gas = (((_tx$gas = tx.gas) === null || _tx$gas === void 0 ? void 0 : _tx$gas.gas) || (0,
|
|
384
|
+
const gas = (((_tx$gas = tx.gas) === null || _tx$gas === void 0 ? void 0 : _tx$gas.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
378
385
|
let stdFee = (0, __injectivelabs_utils.getStdFee)({
|
|
379
386
|
...tx.gas,
|
|
380
387
|
gas
|
|
@@ -388,7 +395,7 @@ var MsgBroadcaster = class {
|
|
|
388
395
|
else {
|
|
389
396
|
const { stdFee: simulatedStdFee } = await this.getTxWithSignersAndStdFee({
|
|
390
397
|
chainId,
|
|
391
|
-
signMode:
|
|
398
|
+
signMode: __injectivelabs_sdk_ts_core_tx.SIGN_EIP712,
|
|
392
399
|
memo: tx.memo,
|
|
393
400
|
message: msgs,
|
|
394
401
|
timeoutHeight: timeoutHeight.toNumber(),
|
|
@@ -402,7 +409,7 @@ var MsgBroadcaster = class {
|
|
|
402
409
|
stdFee = simulatedStdFee;
|
|
403
410
|
}
|
|
404
411
|
/** EIP712 for signing on Ethereum wallets */
|
|
405
|
-
const eip712TypedData = (0,
|
|
412
|
+
const eip712TypedData = (0, __injectivelabs_sdk_ts_core_tx.getEip712TypedData)({
|
|
406
413
|
msgs,
|
|
407
414
|
fee: stdFee,
|
|
408
415
|
tx: {
|
|
@@ -422,10 +429,10 @@ var MsgBroadcaster = class {
|
|
|
422
429
|
signature
|
|
423
430
|
});
|
|
424
431
|
/** Preparing the transaction for client broadcasting */
|
|
425
|
-
const { txRaw } = (0,
|
|
432
|
+
const { txRaw } = (0, __injectivelabs_sdk_ts_core_tx.createTransaction)({
|
|
426
433
|
message: msgs,
|
|
427
434
|
memo: tx.memo,
|
|
428
|
-
signMode:
|
|
435
|
+
signMode: __injectivelabs_sdk_ts_core_tx.SIGN_EIP712,
|
|
429
436
|
fee: stdFee,
|
|
430
437
|
pubKey: pubKeyOrSignatureDerivedPubKey,
|
|
431
438
|
sequence: baseAccount.sequence,
|
|
@@ -433,9 +440,9 @@ var MsgBroadcaster = class {
|
|
|
433
440
|
accountNumber: baseAccount.accountNumber,
|
|
434
441
|
chainId
|
|
435
442
|
});
|
|
436
|
-
const txRawEip712 = (0,
|
|
443
|
+
const txRawEip712 = (0, __injectivelabs_sdk_ts_core_tx.createTxRawEIP712)(txRaw, (0, __injectivelabs_sdk_ts_core_tx.createWeb3Extension)({ evmChainId }));
|
|
437
444
|
/** Append Signatures */
|
|
438
|
-
txRawEip712.signatures = [(0,
|
|
445
|
+
txRawEip712.signatures = [(0, __injectivelabs_sdk_ts_utils.hexToBuff)(signature)];
|
|
439
446
|
const response = await walletStrategy.sendTransaction(txRawEip712, {
|
|
440
447
|
chainId,
|
|
441
448
|
endpoints,
|
|
@@ -443,7 +450,7 @@ var MsgBroadcaster = class {
|
|
|
443
450
|
address: tx.injectiveAddress
|
|
444
451
|
});
|
|
445
452
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
446
|
-
return await new
|
|
453
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash, txTimeoutTimeInMilliSeconds);
|
|
447
454
|
}
|
|
448
455
|
/**
|
|
449
456
|
* Prepare/sign/broadcast transaction using
|
|
@@ -465,7 +472,7 @@ var MsgBroadcaster = class {
|
|
|
465
472
|
const timeoutHeight = (0, __injectivelabs_utils.toBigNumber)(latestHeight).plus(txTimeoutInBlocks);
|
|
466
473
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
467
474
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
468
|
-
const gas = (((_tx$gas2 = tx.gas) === null || _tx$gas2 === void 0 ? void 0 : _tx$gas2.gas) || (0,
|
|
475
|
+
const gas = (((_tx$gas2 = tx.gas) === null || _tx$gas2 === void 0 ? void 0 : _tx$gas2.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
469
476
|
let stdFee = (0, __injectivelabs_utils.getStdFee)({
|
|
470
477
|
...tx.gas,
|
|
471
478
|
gas
|
|
@@ -479,7 +486,7 @@ var MsgBroadcaster = class {
|
|
|
479
486
|
else {
|
|
480
487
|
const { stdFee: simulatedStdFee } = await this.getTxWithSignersAndStdFee({
|
|
481
488
|
chainId,
|
|
482
|
-
signMode:
|
|
489
|
+
signMode: __injectivelabs_sdk_ts_core_tx.SIGN_EIP712_V2,
|
|
483
490
|
memo: tx.memo,
|
|
484
491
|
message: msgs,
|
|
485
492
|
timeoutHeight: timeoutHeight.toNumber(),
|
|
@@ -494,7 +501,7 @@ var MsgBroadcaster = class {
|
|
|
494
501
|
}
|
|
495
502
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationStart);
|
|
496
503
|
/** EIP712 for signing on Ethereum wallets */
|
|
497
|
-
const eip712TypedData = (0,
|
|
504
|
+
const eip712TypedData = (0, __injectivelabs_sdk_ts_core_tx.getEip712TypedDataV2)({
|
|
498
505
|
msgs,
|
|
499
506
|
fee: stdFee,
|
|
500
507
|
tx: {
|
|
@@ -515,10 +522,10 @@ var MsgBroadcaster = class {
|
|
|
515
522
|
signature
|
|
516
523
|
});
|
|
517
524
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastStart);
|
|
518
|
-
const { txRaw } = (0,
|
|
525
|
+
const { txRaw } = (0, __injectivelabs_sdk_ts_core_tx.createTransaction)({
|
|
519
526
|
message: msgs,
|
|
520
527
|
memo: tx.memo,
|
|
521
|
-
signMode:
|
|
528
|
+
signMode: __injectivelabs_sdk_ts_core_tx.SIGN_EIP712_V2,
|
|
522
529
|
fee: stdFee,
|
|
523
530
|
pubKey: pubKeyOrSignatureDerivedPubKey,
|
|
524
531
|
sequence: baseAccount.sequence,
|
|
@@ -526,9 +533,9 @@ var MsgBroadcaster = class {
|
|
|
526
533
|
accountNumber: baseAccount.accountNumber,
|
|
527
534
|
chainId
|
|
528
535
|
});
|
|
529
|
-
const txRawEip712 = (0,
|
|
536
|
+
const txRawEip712 = (0, __injectivelabs_sdk_ts_core_tx.createTxRawEIP712)(txRaw, (0, __injectivelabs_sdk_ts_core_tx.createWeb3Extension)({ evmChainId }));
|
|
530
537
|
/** Append Signatures */
|
|
531
|
-
txRawEip712.signatures = [(0,
|
|
538
|
+
txRawEip712.signatures = [(0, __injectivelabs_sdk_ts_utils.hexToBuff)(signature)];
|
|
532
539
|
const response = await walletStrategy.sendTransaction(txRawEip712, {
|
|
533
540
|
chainId,
|
|
534
541
|
endpoints,
|
|
@@ -536,7 +543,7 @@ var MsgBroadcaster = class {
|
|
|
536
543
|
address: tx.injectiveAddress
|
|
537
544
|
});
|
|
538
545
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
539
|
-
return await new
|
|
546
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash, txTimeoutTimeInMilliSeconds);
|
|
540
547
|
}
|
|
541
548
|
/**
|
|
542
549
|
* Prepare/sign/broadcast transaction using
|
|
@@ -551,12 +558,12 @@ var MsgBroadcaster = class {
|
|
|
551
558
|
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
552
559
|
const evmChainId = await this.getEvmChainId();
|
|
553
560
|
if (!evmChainId) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
554
|
-
const transactionApi = new
|
|
561
|
+
const transactionApi = new __injectivelabs_sdk_ts_client_indexer.IndexerGrpcWeb3GwApi(endpoints.web3gw || endpoints.indexer);
|
|
555
562
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
556
563
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
557
564
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
558
565
|
let timeoutHeight = void 0;
|
|
559
|
-
if (txTimeoutOnFeeDelegation) timeoutHeight = (0, __injectivelabs_utils.toBigNumber)((await new
|
|
566
|
+
if (txTimeoutOnFeeDelegation) timeoutHeight = (0, __injectivelabs_utils.toBigNumber)((await new __injectivelabs_sdk_ts_client_chain.ChainGrpcTendermintApi(endpoints.grpc).fetchLatestBlock()).header.height.toString()).plus(txTimeoutInBlocks).toNumber();
|
|
560
567
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationStart);
|
|
561
568
|
const prepareTxResponse = await transactionApi.prepareTxRequest({
|
|
562
569
|
timeoutHeight,
|
|
@@ -564,7 +571,7 @@ var MsgBroadcaster = class {
|
|
|
564
571
|
message: web3Msgs,
|
|
565
572
|
address: tx.ethereumAddress,
|
|
566
573
|
chainId: evmChainId,
|
|
567
|
-
gasLimit: (0,
|
|
574
|
+
gasLimit: (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs),
|
|
568
575
|
estimateGas: simulateTx
|
|
569
576
|
});
|
|
570
577
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationEnd);
|
|
@@ -579,7 +586,7 @@ var MsgBroadcaster = class {
|
|
|
579
586
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastStart);
|
|
580
587
|
const response = await broadcast();
|
|
581
588
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
582
|
-
return await new
|
|
589
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash, txTimeoutTimeInMilliSeconds);
|
|
583
590
|
} catch (e) {
|
|
584
591
|
const error = e;
|
|
585
592
|
if ((0, __injectivelabs_exceptions.isThrownException)(error)) {
|
|
@@ -590,7 +597,7 @@ var MsgBroadcaster = class {
|
|
|
590
597
|
* to just broadcast the transaction twice
|
|
591
598
|
**/
|
|
592
599
|
if (walletStrategy.wallet === __injectivelabs_wallet_base.Wallet.PrivateKey && checkIfTxRunOutOfGas(exception)) {
|
|
593
|
-
const { baseAccount } = await new
|
|
600
|
+
const { baseAccount } = await new __injectivelabs_sdk_ts_client_chain.ChainGrpcAuthApi(endpoints.grpc).fetchAccount(tx.injectiveAddress);
|
|
594
601
|
/** We only do it on the first account tx fail */
|
|
595
602
|
if (baseAccount.sequence > 1) throw e;
|
|
596
603
|
return await this.broadcastEip712WithFeeDelegation(tx);
|
|
@@ -621,9 +628,9 @@ var MsgBroadcaster = class {
|
|
|
621
628
|
const { baseAccount, latestHeight } = await this.fetchAccountAndBlockDetails(tx.injectiveAddress);
|
|
622
629
|
const timeoutHeight = (0, __injectivelabs_utils.toBigNumber)(latestHeight).plus(txTimeoutInBlocks);
|
|
623
630
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
624
|
-
const signMode = (0, __injectivelabs_wallet_base.isCosmosAminoOnlyWallet)(walletStrategy.wallet) ?
|
|
631
|
+
const signMode = (0, __injectivelabs_wallet_base.isCosmosAminoOnlyWallet)(walletStrategy.wallet) ? __injectivelabs_sdk_ts_core_tx.SIGN_EIP712 : __injectivelabs_sdk_ts_core_tx.SIGN_DIRECT;
|
|
625
632
|
const pubKey = await walletStrategy.getPubKey(tx.injectiveAddress);
|
|
626
|
-
const gas = (((_tx$gas3 = tx.gas) === null || _tx$gas3 === void 0 ? void 0 : _tx$gas3.gas) || (0,
|
|
633
|
+
const gas = (((_tx$gas3 = tx.gas) === null || _tx$gas3 === void 0 ? void 0 : _tx$gas3.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
627
634
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationStart);
|
|
628
635
|
/** Prepare the Transaction * */
|
|
629
636
|
const { txRaw } = await this.getTxWithSignersAndStdFee({
|
|
@@ -646,7 +653,7 @@ var MsgBroadcaster = class {
|
|
|
646
653
|
/** Ledger using Cosmos app only allows signing amino docs */
|
|
647
654
|
if ((0, __injectivelabs_wallet_base.isCosmosAminoOnlyWallet)(walletStrategy.wallet)) {
|
|
648
655
|
var _tx$gas4;
|
|
649
|
-
const aminoSignDoc = (0,
|
|
656
|
+
const aminoSignDoc = (0, __injectivelabs_sdk_ts_core_tx.getAminoStdSignDoc)({
|
|
650
657
|
...tx,
|
|
651
658
|
...baseAccount,
|
|
652
659
|
msgs,
|
|
@@ -654,7 +661,7 @@ var MsgBroadcaster = class {
|
|
|
654
661
|
gas: gas || ((_tx$gas4 = tx.gas) === null || _tx$gas4 === void 0 || (_tx$gas4 = _tx$gas4.gas) === null || _tx$gas4 === void 0 ? void 0 : _tx$gas4.toString()),
|
|
655
662
|
timeoutHeight: timeoutHeight.toFixed()
|
|
656
663
|
});
|
|
657
|
-
txRaw.signatures = [(0,
|
|
664
|
+
txRaw.signatures = [(0, __injectivelabs_sdk_ts_utils.base64ToUint8Array)((await walletStrategy.signAminoCosmosTransaction({
|
|
658
665
|
signDoc: aminoSignDoc,
|
|
659
666
|
address: tx.injectiveAddress
|
|
660
667
|
})).signature.signature)];
|
|
@@ -666,7 +673,7 @@ var MsgBroadcaster = class {
|
|
|
666
673
|
txTimeout: txTimeoutInBlocks
|
|
667
674
|
});
|
|
668
675
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
669
|
-
return await new
|
|
676
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response$1.txHash, txTimeoutTimeInMilliSeconds);
|
|
670
677
|
}
|
|
671
678
|
const directSignResponse = await walletStrategy.signCosmosTransaction({
|
|
672
679
|
txRaw,
|
|
@@ -682,7 +689,7 @@ var MsgBroadcaster = class {
|
|
|
682
689
|
address: tx.injectiveAddress
|
|
683
690
|
});
|
|
684
691
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
685
|
-
return await new
|
|
692
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash, txTimeoutTimeInMilliSeconds);
|
|
686
693
|
}
|
|
687
694
|
/**
|
|
688
695
|
* We use this method only when we want to broadcast a transaction using Ledger on Keplr/Leap for Injective
|
|
@@ -706,9 +713,9 @@ var MsgBroadcaster = class {
|
|
|
706
713
|
const { baseAccount, latestHeight } = await this.fetchAccountAndBlockDetails(tx.injectiveAddress);
|
|
707
714
|
const timeoutHeight = (0, __injectivelabs_utils.toBigNumber)(latestHeight).plus(txTimeoutInBlocks);
|
|
708
715
|
const pubKey = await walletStrategy.getPubKey();
|
|
709
|
-
const gas = (((_tx$gas5 = tx.gas) === null || _tx$gas5 === void 0 ? void 0 : _tx$gas5.gas) || (0,
|
|
716
|
+
const gas = (((_tx$gas5 = tx.gas) === null || _tx$gas5 === void 0 ? void 0 : _tx$gas5.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
710
717
|
/** EIP712 for signing on Ethereum wallets */
|
|
711
|
-
const eip712TypedData = (0,
|
|
718
|
+
const eip712TypedData = (0, __injectivelabs_sdk_ts_core_tx.getEip712TypedData)({
|
|
712
719
|
msgs,
|
|
713
720
|
fee: await this.getStdFeeWithDynamicBaseFee({
|
|
714
721
|
...tx.gas,
|
|
@@ -739,22 +746,22 @@ var MsgBroadcaster = class {
|
|
|
739
746
|
* get as a response in case the user changed the fee/memo
|
|
740
747
|
* on the Keplr popup
|
|
741
748
|
*/
|
|
742
|
-
const { txRaw } = (0,
|
|
749
|
+
const { txRaw } = (0, __injectivelabs_sdk_ts_core_tx.createTransaction)({
|
|
743
750
|
pubKey,
|
|
744
751
|
message: msgs,
|
|
745
752
|
memo: aminoSignResponse.signed.memo,
|
|
746
|
-
signMode:
|
|
753
|
+
signMode: __injectivelabs_sdk_ts_core_tx.SIGN_EIP712,
|
|
747
754
|
fee: aminoSignResponse.signed.fee,
|
|
748
755
|
sequence: parseInt(aminoSignResponse.signed.sequence, 10),
|
|
749
756
|
timeoutHeight: parseInt(aminoSignResponse.signed.timeout_height, 10),
|
|
750
757
|
accountNumber: parseInt(aminoSignResponse.signed.account_number, 10),
|
|
751
758
|
chainId
|
|
752
759
|
});
|
|
753
|
-
const txRawEip712 = (0,
|
|
760
|
+
const txRawEip712 = (0, __injectivelabs_sdk_ts_core_tx.createTxRawEIP712)(txRaw, (0, __injectivelabs_sdk_ts_core_tx.createWeb3Extension)({ evmChainId }));
|
|
754
761
|
if (simulateTx) await this.simulateTxRaw(txRawEip712);
|
|
755
|
-
txRawEip712.signatures = [(0,
|
|
762
|
+
txRawEip712.signatures = [(0, __injectivelabs_sdk_ts_utils.base64ToUint8Array)(aminoSignResponse.signature.signature)];
|
|
756
763
|
/** Broadcast the transaction */
|
|
757
|
-
const response = await new
|
|
764
|
+
const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(txRawEip712, { txTimeout: txTimeoutInBlocks });
|
|
758
765
|
if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
|
|
759
766
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
760
767
|
contextCode: response.code,
|
|
@@ -783,17 +790,17 @@ var MsgBroadcaster = class {
|
|
|
783
790
|
const cosmosWallet = walletStrategy.getCosmosWallet(chainId);
|
|
784
791
|
const canDisableCosmosGasCheck = [__injectivelabs_wallet_base.Wallet.Keplr, __injectivelabs_wallet_base.Wallet.OWallet].includes(walletStrategy.wallet);
|
|
785
792
|
const feePayerPubKey = await this.fetchFeePayerPubKey(options.feePayerPubKey);
|
|
786
|
-
const feePayerPublicKey =
|
|
793
|
+
const feePayerPublicKey = __injectivelabs_sdk_ts_core_accounts.PublicKey.fromBase64(feePayerPubKey);
|
|
787
794
|
const feePayer = feePayerPublicKey.toAddress().address;
|
|
788
795
|
/** Account Details * */
|
|
789
796
|
const { baseAccount, latestHeight } = await this.fetchAccountAndBlockDetails(tx.injectiveAddress);
|
|
790
|
-
const chainGrpcAuthApi = new
|
|
797
|
+
const chainGrpcAuthApi = new __injectivelabs_sdk_ts_client_chain.ChainGrpcAuthApi(endpoints.grpc);
|
|
791
798
|
if (httpHeaders) chainGrpcAuthApi.setMetadata(httpHeaders);
|
|
792
799
|
const { baseAccount: feePayerBaseAccount } = await chainGrpcAuthApi.fetchAccount(feePayer);
|
|
793
800
|
const timeoutHeight = (0, __injectivelabs_utils.toBigNumber)(latestHeight).plus(txTimeoutOnFeeDelegation ? txTimeoutInBlocks : __injectivelabs_utils.DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
794
801
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
795
802
|
const pubKey = await walletStrategy.getPubKey();
|
|
796
|
-
const gas = (((_tx$gas7 = tx.gas) === null || _tx$gas7 === void 0 ? void 0 : _tx$gas7.gas) || (0,
|
|
803
|
+
const gas = (((_tx$gas7 = tx.gas) === null || _tx$gas7 === void 0 ? void 0 : _tx$gas7.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
797
804
|
/** Prepare the Transaction * */
|
|
798
805
|
const { txRaw } = await this.getTxWithSignersAndStdFee({
|
|
799
806
|
chainId,
|
|
@@ -824,11 +831,11 @@ var MsgBroadcaster = class {
|
|
|
824
831
|
accountNumber: baseAccount.accountNumber
|
|
825
832
|
});
|
|
826
833
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationEnd);
|
|
827
|
-
const transactionApi = new
|
|
834
|
+
const transactionApi = new __injectivelabs_sdk_ts_client_indexer.IndexerGrpcWeb3GwApi(endpoints.web3gw || endpoints.indexer);
|
|
828
835
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
829
836
|
const broadcast = async () => await transactionApi.broadcastCosmosTxRequest({
|
|
830
837
|
address: tx.injectiveAddress,
|
|
831
|
-
txRaw: (0,
|
|
838
|
+
txRaw: (0, __injectivelabs_sdk_ts_core_tx.createTxRawFromSigResponse)(directSignResponse),
|
|
832
839
|
signature: directSignResponse.signature.signature,
|
|
833
840
|
pubKey: directSignResponse.signature.pub_key || {
|
|
834
841
|
value: pubKey,
|
|
@@ -840,7 +847,7 @@ var MsgBroadcaster = class {
|
|
|
840
847
|
const response = await broadcast();
|
|
841
848
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionBroadcastEnd);
|
|
842
849
|
if (canDisableCosmosGasCheck && cosmosWallet.enableGasCheck) cosmosWallet.enableGasCheck(chainId);
|
|
843
|
-
return await new
|
|
850
|
+
return await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash, txTimeoutTimeInMilliSeconds);
|
|
844
851
|
} catch (e) {
|
|
845
852
|
const error = e;
|
|
846
853
|
if ((0, __injectivelabs_exceptions.isThrownException)(error)) {
|
|
@@ -858,15 +865,15 @@ var MsgBroadcaster = class {
|
|
|
858
865
|
async fetchFeePayerPubKey(existingFeePayerPubKey) {
|
|
859
866
|
if (existingFeePayerPubKey) return existingFeePayerPubKey;
|
|
860
867
|
const { endpoints, httpHeaders } = this;
|
|
861
|
-
const transactionApi = new
|
|
868
|
+
const transactionApi = new __injectivelabs_sdk_ts_client_indexer.IndexerGrpcWeb3GwApi(endpoints.web3gw || endpoints.indexer);
|
|
862
869
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
863
870
|
const response = await transactionApi.fetchFeePayer();
|
|
864
871
|
if (!response.feePayerPubKey) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide a feePayerPubKey"));
|
|
865
|
-
if (response.feePayerPubKey.key.startsWith("0x") || response.feePayerPubKey.key.length === 66) return (0,
|
|
872
|
+
if (response.feePayerPubKey.key.startsWith("0x") || response.feePayerPubKey.key.length === 66) return (0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)((0, __injectivelabs_sdk_ts_utils.hexToUint8Array)(response.feePayerPubKey.key));
|
|
866
873
|
return response.feePayerPubKey.key;
|
|
867
874
|
}
|
|
868
875
|
async getStdFeeWithDynamicBaseFee(args) {
|
|
869
|
-
const client = new
|
|
876
|
+
const client = new __injectivelabs_sdk_ts_client_chain.ChainGrpcTxFeesApi(this.endpoints.grpc);
|
|
870
877
|
let baseFee = __injectivelabs_utils.DEFAULT_GAS_PRICE;
|
|
871
878
|
try {
|
|
872
879
|
const response = await client.fetchEipBaseFee();
|
|
@@ -894,12 +901,12 @@ var MsgBroadcaster = class {
|
|
|
894
901
|
var _result$gasInfo;
|
|
895
902
|
const { simulateTx } = this;
|
|
896
903
|
if (!simulateTx) return {
|
|
897
|
-
...(0,
|
|
904
|
+
...(0, __injectivelabs_sdk_ts_core_tx.createTransactionWithSigners)(args),
|
|
898
905
|
stdFee: await this.getStdFeeWithDynamicBaseFee(args.fee)
|
|
899
906
|
};
|
|
900
907
|
const result = await this.simulateTxWithSigners(args);
|
|
901
908
|
if (!((_result$gasInfo = result.gasInfo) === null || _result$gasInfo === void 0 ? void 0 : _result$gasInfo.gasUsed)) return {
|
|
902
|
-
...(0,
|
|
909
|
+
...(0, __injectivelabs_sdk_ts_core_tx.createTransactionWithSigners)(args),
|
|
903
910
|
stdFee: await this.getStdFeeWithDynamicBaseFee(args.fee)
|
|
904
911
|
};
|
|
905
912
|
const stdGasFee = { ...await this.getStdFeeWithDynamicBaseFee({
|
|
@@ -907,7 +914,7 @@ var MsgBroadcaster = class {
|
|
|
907
914
|
gas: (0, __injectivelabs_utils.toBigNumber)(result.gasInfo.gasUsed).times(this.gasBufferCoefficient).toFixed()
|
|
908
915
|
}) };
|
|
909
916
|
return {
|
|
910
|
-
...(0,
|
|
917
|
+
...(0, __injectivelabs_sdk_ts_core_tx.createTransactionWithSigners)({
|
|
911
918
|
...args,
|
|
912
919
|
fee: stdGasFee
|
|
913
920
|
}),
|
|
@@ -920,7 +927,7 @@ var MsgBroadcaster = class {
|
|
|
920
927
|
async simulateTxRaw(txRaw) {
|
|
921
928
|
const { endpoints, httpHeaders } = this;
|
|
922
929
|
txRaw.signatures = [new Uint8Array(0)];
|
|
923
|
-
const client = new
|
|
930
|
+
const client = new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc);
|
|
924
931
|
if (httpHeaders) client.setMetadata(httpHeaders);
|
|
925
932
|
return await client.simulate(txRaw);
|
|
926
933
|
}
|
|
@@ -929,9 +936,9 @@ var MsgBroadcaster = class {
|
|
|
929
936
|
*/
|
|
930
937
|
async simulateTxWithSigners(args) {
|
|
931
938
|
const { endpoints, httpHeaders } = this;
|
|
932
|
-
const { txRaw } = (0,
|
|
939
|
+
const { txRaw } = (0, __injectivelabs_sdk_ts_core_tx.createTransactionWithSigners)(args);
|
|
933
940
|
txRaw.signatures = Array(Array.isArray(args.signers) ? args.signers.length : 1).fill(new Uint8Array(0));
|
|
934
|
-
const client = new
|
|
941
|
+
const client = new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc);
|
|
935
942
|
if (httpHeaders) client.setMetadata(httpHeaders);
|
|
936
943
|
return await client.simulate(txRaw);
|
|
937
944
|
}
|
|
@@ -956,8 +963,8 @@ var MsgBroadcaster = class {
|
|
|
956
963
|
}
|
|
957
964
|
async fetchAccountAndBlockDetails(address) {
|
|
958
965
|
const { endpoints, httpHeaders } = this;
|
|
959
|
-
const chainClient = new
|
|
960
|
-
const tendermintClient = new
|
|
966
|
+
const chainClient = new __injectivelabs_sdk_ts_client_chain.ChainGrpcAuthApi(endpoints.grpc);
|
|
967
|
+
const tendermintClient = new __injectivelabs_sdk_ts_client_chain.ChainGrpcTendermintApi(endpoints.grpc);
|
|
961
968
|
if (httpHeaders) {
|
|
962
969
|
chainClient.setMetadata(httpHeaders);
|
|
963
970
|
tendermintClient.setMetadata(httpHeaders);
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -2,8 +2,10 @@ import { ConcreteStrategiesArg, ConcreteWalletStrategy, CosmosWalletAbstraction,
|
|
|
2
2
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
3
3
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
4
4
|
import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
5
|
-
import {
|
|
5
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
6
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
6
7
|
import { EventEmitter } from "eventemitter3";
|
|
8
|
+
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
7
9
|
import { Network, NetworkEndpoints } from "@injectivelabs/networks";
|
|
8
10
|
|
|
9
11
|
//#region src/utils/tx.d.ts
|
|
@@ -75,10 +77,15 @@ declare class BaseWalletStrategy implements WalletStrategy {
|
|
|
75
77
|
emit: WalletStrategyEmitter['emit'];
|
|
76
78
|
constructor(args: WalletStrategyArguments);
|
|
77
79
|
getWallet(): Wallet;
|
|
78
|
-
setWallet(wallet: Wallet): void
|
|
80
|
+
setWallet(wallet: Wallet): Promise<void>;
|
|
79
81
|
setMetadata(metadata?: WalletMetadata): void;
|
|
80
82
|
getStrategy(): ConcreteWalletStrategy;
|
|
81
83
|
getAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
84
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
85
|
+
address: string;
|
|
86
|
+
derivationPath: string;
|
|
87
|
+
baseDerivationPath: string;
|
|
88
|
+
}[]>;
|
|
82
89
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
83
90
|
getPubKey(address?: string): Promise<string>;
|
|
84
91
|
enable(args?: unknown): Promise<boolean>;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { EventEmitter } from "eventemitter3";
|
|
|
2
2
|
import { ConcreteStrategiesArg, ConcreteWalletStrategy, CosmosWalletAbstraction, Eip1193Provider, SendTransactionOptions, Wallet, WalletDeviceType, WalletMetadata, WalletStrategy, WalletStrategyArguments, onAccountChangeCallback, onChainIdChangeCallback } from "@injectivelabs/wallet-base";
|
|
3
3
|
import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
4
|
import { Network, NetworkEndpoints } from "@injectivelabs/networks";
|
|
5
|
-
import {
|
|
5
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
6
6
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
7
7
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
8
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
9
|
+
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
8
10
|
|
|
9
11
|
//#region src/utils/tx.d.ts
|
|
10
12
|
declare const checkIfTxRunOutOfGas: (e: unknown) => boolean;
|
|
@@ -75,10 +77,15 @@ declare class BaseWalletStrategy implements WalletStrategy {
|
|
|
75
77
|
emit: WalletStrategyEmitter['emit'];
|
|
76
78
|
constructor(args: WalletStrategyArguments);
|
|
77
79
|
getWallet(): Wallet;
|
|
78
|
-
setWallet(wallet: Wallet): void
|
|
80
|
+
setWallet(wallet: Wallet): Promise<void>;
|
|
79
81
|
setMetadata(metadata?: WalletMetadata): void;
|
|
80
82
|
getStrategy(): ConcreteWalletStrategy;
|
|
81
83
|
getAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
84
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
85
|
+
address: string;
|
|
86
|
+
derivationPath: string;
|
|
87
|
+
baseDerivationPath: string;
|
|
88
|
+
}[]>;
|
|
82
89
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
83
90
|
getPubKey(address?: string): Promise<string>;
|
|
84
91
|
enable(args?: unknown): Promise<boolean>;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,9 +2,13 @@ import { ChainCosmosErrorCode, GeneralException, TransactionChainErrorModule, Tr
|
|
|
2
2
|
import { EventEmitter } from "eventemitter3";
|
|
3
3
|
import { Wallet, WalletDeviceType, createEip712StdSignDoc, getEthereumSignerAddress, getInjectiveSignerAddress, isCosmosAminoOnlyWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet } from "@injectivelabs/wallet-base";
|
|
4
4
|
import { EvmChainId } from "@injectivelabs/ts-types";
|
|
5
|
+
import { base64ToUint8Array, getGasPriceBasedOnMessage, hexToBase64, hexToBuff, hexToUint8Array, ofacList, recoverTypedSignaturePubKey, uint8ArrayToBase64 } from "@injectivelabs/sdk-ts/utils";
|
|
6
|
+
import { PublicKey } from "@injectivelabs/sdk-ts/core/accounts";
|
|
7
|
+
import { IndexerGrpcWeb3GwApi } from "@injectivelabs/sdk-ts/client/indexer";
|
|
5
8
|
import { getNetworkEndpoints, getNetworkInfo, isMainnet, isTestnet } from "@injectivelabs/networks";
|
|
9
|
+
import { ChainGrpcAuthApi, ChainGrpcTendermintApi, ChainGrpcTxFeesApi } from "@injectivelabs/sdk-ts/client/chain";
|
|
6
10
|
import { DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_GAS_PRICE, getStdFee, sleep, toBigNumber } from "@injectivelabs/utils";
|
|
7
|
-
import {
|
|
11
|
+
import { SIGN_DIRECT, SIGN_EIP712, SIGN_EIP712_V2, TxGrpcApi, createTransaction, createTransactionWithSigners, createTxRawEIP712, createTxRawFromSigResponse, createWeb3Extension, getAminoStdSignDoc, getEip712TypedData, getEip712TypedDataV2 } from "@injectivelabs/sdk-ts/core/tx";
|
|
8
12
|
|
|
9
13
|
//#region src/utils/tx.ts
|
|
10
14
|
const checkIfTxRunOutOfGas = (e) => {
|
|
@@ -99,7 +103,7 @@ var BaseWalletStrategy = class {
|
|
|
99
103
|
getWallet() {
|
|
100
104
|
return this.wallet;
|
|
101
105
|
}
|
|
102
|
-
setWallet(wallet) {
|
|
106
|
+
async setWallet(wallet) {
|
|
103
107
|
this.wallet = wallet;
|
|
104
108
|
this.getStrategy();
|
|
105
109
|
}
|
|
@@ -116,6 +120,9 @@ var BaseWalletStrategy = class {
|
|
|
116
120
|
getAddresses(args) {
|
|
117
121
|
return this.getStrategy().getAddresses(args);
|
|
118
122
|
}
|
|
123
|
+
getAddressesInfo(args) {
|
|
124
|
+
return this.getStrategy().getAddressesInfo(args);
|
|
125
|
+
}
|
|
119
126
|
getWalletDeviceType() {
|
|
120
127
|
return this.getStrategy().getWalletDeviceType();
|
|
121
128
|
}
|
|
@@ -295,7 +302,7 @@ var MsgBroadcaster = class {
|
|
|
295
302
|
ethereumAddress: getEthereumSignerAddress(tx.injectiveAddress),
|
|
296
303
|
injectiveAddress: getInjectiveSignerAddress(tx.injectiveAddress)
|
|
297
304
|
};
|
|
298
|
-
if (
|
|
305
|
+
if (ofacList.includes(txWithAddresses.ethereumAddress)) throw new GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
299
306
|
try {
|
|
300
307
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : isEip712V2OnlyWallet(walletStrategy.wallet) ? await this.broadcastEip712V2(txWithAddresses) : await this.broadcastEip712(txWithAddresses);
|
|
301
308
|
} catch (e) {
|
|
@@ -320,7 +327,7 @@ var MsgBroadcaster = class {
|
|
|
320
327
|
ethereumAddress: getEthereumSignerAddress(tx.injectiveAddress),
|
|
321
328
|
injectiveAddress: getInjectiveSignerAddress(tx.injectiveAddress)
|
|
322
329
|
};
|
|
323
|
-
if (
|
|
330
|
+
if (ofacList.includes(txWithAddresses.ethereumAddress)) throw new GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
324
331
|
try {
|
|
325
332
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : await this.broadcastEip712V2(txWithAddresses);
|
|
326
333
|
} catch (e) {
|
|
@@ -344,7 +351,7 @@ var MsgBroadcaster = class {
|
|
|
344
351
|
ethereumAddress: getEthereumSignerAddress(tx.injectiveAddress),
|
|
345
352
|
injectiveAddress: getInjectiveSignerAddress(tx.injectiveAddress)
|
|
346
353
|
};
|
|
347
|
-
if (
|
|
354
|
+
if (ofacList.includes(txWithAddresses.ethereumAddress)) throw new GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
348
355
|
try {
|
|
349
356
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSignWithFeeDelegation(txWithAddresses) : await this.broadcastEip712WithFeeDelegation(txWithAddresses);
|
|
350
357
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-core",
|
|
3
|
-
"version": "1.16.38-alpha.
|
|
3
|
+
"version": "1.16.38-alpha.4",
|
|
4
4
|
"description": "Core wallet strategy",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@keplr-wallet/types": "^0.12.
|
|
41
|
+
"@keplr-wallet/types": "^0.12.296",
|
|
42
42
|
"eventemitter3": "^5.0.1",
|
|
43
|
-
"@injectivelabs/exceptions": "1.16.38-alpha.
|
|
44
|
-
"@injectivelabs/networks": "1.16.38-alpha.
|
|
45
|
-
"@injectivelabs/
|
|
46
|
-
"@injectivelabs/
|
|
47
|
-
"@injectivelabs/ts
|
|
48
|
-
"@injectivelabs/
|
|
43
|
+
"@injectivelabs/exceptions": "1.16.38-alpha.3",
|
|
44
|
+
"@injectivelabs/networks": "1.16.38-alpha.2",
|
|
45
|
+
"@injectivelabs/ts-types": "1.16.38-alpha.2",
|
|
46
|
+
"@injectivelabs/utils": "1.16.38-alpha.3",
|
|
47
|
+
"@injectivelabs/sdk-ts": "1.16.38-alpha.4",
|
|
48
|
+
"@injectivelabs/wallet-base": "1.16.38-alpha.4"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|