@injectivelabs/wallet-core 1.20.62 → 1.20.63
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/{broadcaster-DF_pH92E.cjs → broadcaster-B0iDYqb7.cjs} +16 -19
- package/dist/cjs/broadcaster.cjs +1 -1
- package/dist/cjs/broadcaster.d.cts +1 -1
- package/dist/cjs/{index-BkHfMWkC.d.cts → index-TB1ybJUD.d.cts} +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/{broadcaster-CYjdFjbm.js → broadcaster-DO14o8eB.js} +18 -21
- package/dist/esm/broadcaster.d.ts +1 -1
- package/dist/esm/broadcaster.js +1 -1
- package/dist/esm/{index-DaqeDXLx.d.ts → index-B1XSJ1Zx.d.ts} +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +7 -7
|
@@ -121,10 +121,7 @@ var MsgBroadcaster = class {
|
|
|
121
121
|
try {
|
|
122
122
|
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);
|
|
123
123
|
} catch (e) {
|
|
124
|
-
|
|
125
|
-
walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionFail);
|
|
126
|
-
if ((0, __injectivelabs_exceptions.isThrownException)(error)) throw error;
|
|
127
|
-
throw new __injectivelabs_exceptions.TransactionException(new Error(error));
|
|
124
|
+
return this.handleBroadcastError(e, tx);
|
|
128
125
|
}
|
|
129
126
|
}
|
|
130
127
|
/**
|
|
@@ -146,10 +143,7 @@ var MsgBroadcaster = class {
|
|
|
146
143
|
try {
|
|
147
144
|
return (0, __injectivelabs_wallet_base.isCosmosWallet)(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : await this.broadcastEip712V2(txWithAddresses);
|
|
148
145
|
} catch (e) {
|
|
149
|
-
|
|
150
|
-
walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionFail);
|
|
151
|
-
if ((0, __injectivelabs_exceptions.isThrownException)(error)) throw error;
|
|
152
|
-
throw new __injectivelabs_exceptions.TransactionException(new Error(error));
|
|
146
|
+
return this.handleBroadcastError(e, tx);
|
|
153
147
|
}
|
|
154
148
|
}
|
|
155
149
|
/**
|
|
@@ -170,10 +164,7 @@ var MsgBroadcaster = class {
|
|
|
170
164
|
try {
|
|
171
165
|
return (0, __injectivelabs_wallet_base.isCosmosWallet)(walletStrategy.wallet) ? await this.broadcastDirectSignWithFeeDelegation(txWithAddresses) : await this.broadcastEip712WithFeeDelegation(txWithAddresses);
|
|
172
166
|
} catch (e) {
|
|
173
|
-
|
|
174
|
-
walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionFail);
|
|
175
|
-
if ((0, __injectivelabs_exceptions.isThrownException)(error)) throw error;
|
|
176
|
-
throw new __injectivelabs_exceptions.TransactionException(new Error(error));
|
|
167
|
+
return this.handleBroadcastError(e, tx);
|
|
177
168
|
}
|
|
178
169
|
}
|
|
179
170
|
/**
|
|
@@ -229,12 +220,18 @@ var MsgBroadcaster = class {
|
|
|
229
220
|
});
|
|
230
221
|
return txResponse;
|
|
231
222
|
} catch (e) {
|
|
232
|
-
|
|
233
|
-
walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionFail);
|
|
234
|
-
if ((0, __injectivelabs_exceptions.isThrownException)(error)) throw error;
|
|
235
|
-
throw new __injectivelabs_exceptions.TransactionException(new Error(error));
|
|
223
|
+
return this.handleBroadcastError(e, { txInclusion });
|
|
236
224
|
}
|
|
237
225
|
}
|
|
226
|
+
handleBroadcastError(error, tx) {
|
|
227
|
+
if (error instanceof __injectivelabs_sdk_ts_core_tx.TxObservationAbortError || (0, __injectivelabs_utils.isAbortError)(error) && (0, __injectivelabs_sdk_ts_core_tx.getTxObservationSignals)(this.resolveTxInclusionOptions(tx)).some((signal) => signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
228
|
+
this.walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionCancelled, error);
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
this.walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionFail);
|
|
232
|
+
if ((0, __injectivelabs_exceptions.isThrownException)(error)) throw error;
|
|
233
|
+
throw new __injectivelabs_exceptions.TransactionException(new Error(error));
|
|
234
|
+
}
|
|
238
235
|
/**
|
|
239
236
|
* Prepare/sign/broadcast transaction using
|
|
240
237
|
* Ethereum native wallets on the client side.
|
|
@@ -1117,11 +1114,11 @@ var MsgBroadcaster = class {
|
|
|
1117
1114
|
return client;
|
|
1118
1115
|
}
|
|
1119
1116
|
async waitForTxInclusion({ tx, txHash, timeout }) {
|
|
1120
|
-
return this.createTxGrpcApi().waitForTxInclusion({
|
|
1117
|
+
return (0, __injectivelabs_sdk_ts_core_tx.observeTx)(txHash, () => this.createTxGrpcApi().waitForTxInclusion({
|
|
1121
1118
|
txHash,
|
|
1122
1119
|
timeout,
|
|
1123
1120
|
options: this.resolveTxInclusionOptions(tx)
|
|
1124
|
-
});
|
|
1121
|
+
}));
|
|
1125
1122
|
}
|
|
1126
1123
|
async prepareTxInclusionWaiter({ tx, timeout, txRawOrSignResponse }) {
|
|
1127
1124
|
const txRaw = (0, __injectivelabs_sdk_ts_core_tx.createTxRawFromSigResponse)(txRawOrSignResponse);
|
|
@@ -1138,7 +1135,7 @@ var MsgBroadcaster = class {
|
|
|
1138
1135
|
timeout,
|
|
1139
1136
|
txHash: responseTxHash
|
|
1140
1137
|
});
|
|
1141
|
-
const confirmedTx = await inclusionWaiter.wait(responseTxHash);
|
|
1138
|
+
const confirmedTx = await (0, __injectivelabs_sdk_ts_core_tx.observeTx)(responseTxHash, () => inclusionWaiter.wait(responseTxHash));
|
|
1142
1139
|
if (!confirmedTx) throw new __injectivelabs_exceptions.TransactionException(/* @__PURE__ */ new Error(`The transaction with ${responseTxHash} is not found`));
|
|
1143
1140
|
return confirmedTx;
|
|
1144
1141
|
}
|
package/dist/cjs/broadcaster.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./BaseWalletStrategy-CD9sBzZB.cjs";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-TB1ybJUD.cjs";
|
|
3
3
|
export { MsgBroadcaster, MsgBroadcasterOptions, MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, Web3Broadcaster };
|
|
@@ -135,6 +135,7 @@ declare class MsgBroadcaster {
|
|
|
135
135
|
txInclusion?: TxClientInclusionOptions;
|
|
136
136
|
txTimeoutInBlocks?: number;
|
|
137
137
|
}): Promise<TxResponse>;
|
|
138
|
+
private handleBroadcastError;
|
|
138
139
|
/**
|
|
139
140
|
* Prepare/sign/broadcast transaction using
|
|
140
141
|
* Ethereum native wallets on the client side.
|
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseWalletStrategy } from "./BaseWalletStrategy-CD9sBzZB.cjs";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-TB1ybJUD.cjs";
|
|
3
3
|
import "./index-DLoAMD9J.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/tx.d.ts
|
|
@@ -6,9 +6,9 @@ import { base64ToUint8Array, getGasOptionsBasedOnMessage, hexToBase64, hexToBuff
|
|
|
6
6
|
import { IndexerGrpcWeb3GwApi } from "@injectivelabs/sdk-ts/client/indexer";
|
|
7
7
|
import { getNetworkEndpoints, getNetworkInfo, isMainnet, isTestnet } from "@injectivelabs/networks";
|
|
8
8
|
import { ChainGrpcAuthApi, ChainGrpcTendermintApi, ChainGrpcTxFeesApi } from "@injectivelabs/sdk-ts/client/chain";
|
|
9
|
-
import { DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_GAS_PRICE, getStdFee, sleep, toBigNumber } from "@injectivelabs/utils";
|
|
9
|
+
import { DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_GAS_PRICE, getStdFee, isAbortError, sleep, toBigNumber } from "@injectivelabs/utils";
|
|
10
10
|
import { Wallet, WalletDeviceType, WalletStrategyEmitterEventType, createEip712StdSignDoc, getEthereumSignerAddress, getInjectiveSignerAddress, isCosmosAminoOnlyWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet } from "@injectivelabs/wallet-base";
|
|
11
|
-
import { CosmosTxV1Beta1TxPb, SIGN_DIRECT, SIGN_EIP712, SIGN_EIP712_V2, TxClient, TxGrpcApi, createTransaction, createTransactionWithSigners, createTxRawEIP712, createTxRawFromSigResponse, createWeb3Extension, getAminoStdSignDoc, getEip712TypedData, getEip712TypedDataV2 } from "@injectivelabs/sdk-ts/core/tx";
|
|
11
|
+
import { CosmosTxV1Beta1TxPb, SIGN_DIRECT, SIGN_EIP712, SIGN_EIP712_V2, TxClient, TxGrpcApi, TxObservationAbortError, createTransaction, createTransactionWithSigners, createTxRawEIP712, createTxRawFromSigResponse, createWeb3Extension, getAminoStdSignDoc, getEip712TypedData, getEip712TypedDataV2, getTxObservationSignals, observeTx } from "@injectivelabs/sdk-ts/core/tx";
|
|
12
12
|
|
|
13
13
|
//#region src/utils/tx.ts
|
|
14
14
|
const checkIfTxRunOutOfGas = (e) => {
|
|
@@ -121,10 +121,7 @@ var MsgBroadcaster = class {
|
|
|
121
121
|
try {
|
|
122
122
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : isEip712V2OnlyWallet(walletStrategy.wallet) ? await this.broadcastEip712V2(txWithAddresses) : await this.broadcastEip712(txWithAddresses);
|
|
123
123
|
} catch (e) {
|
|
124
|
-
|
|
125
|
-
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionFail);
|
|
126
|
-
if (isThrownException(error)) throw error;
|
|
127
|
-
throw new TransactionException(new Error(error));
|
|
124
|
+
return this.handleBroadcastError(e, tx);
|
|
128
125
|
}
|
|
129
126
|
}
|
|
130
127
|
/**
|
|
@@ -146,10 +143,7 @@ var MsgBroadcaster = class {
|
|
|
146
143
|
try {
|
|
147
144
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSign(txWithAddresses) : await this.broadcastEip712V2(txWithAddresses);
|
|
148
145
|
} catch (e) {
|
|
149
|
-
|
|
150
|
-
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionFail);
|
|
151
|
-
if (isThrownException(error)) throw error;
|
|
152
|
-
throw new TransactionException(new Error(error));
|
|
146
|
+
return this.handleBroadcastError(e, tx);
|
|
153
147
|
}
|
|
154
148
|
}
|
|
155
149
|
/**
|
|
@@ -170,10 +164,7 @@ var MsgBroadcaster = class {
|
|
|
170
164
|
try {
|
|
171
165
|
return isCosmosWallet(walletStrategy.wallet) ? await this.broadcastDirectSignWithFeeDelegation(txWithAddresses) : await this.broadcastEip712WithFeeDelegation(txWithAddresses);
|
|
172
166
|
} catch (e) {
|
|
173
|
-
|
|
174
|
-
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionFail);
|
|
175
|
-
if (isThrownException(error)) throw error;
|
|
176
|
-
throw new TransactionException(new Error(error));
|
|
167
|
+
return this.handleBroadcastError(e, tx);
|
|
177
168
|
}
|
|
178
169
|
}
|
|
179
170
|
/**
|
|
@@ -229,12 +220,18 @@ var MsgBroadcaster = class {
|
|
|
229
220
|
});
|
|
230
221
|
return txResponse;
|
|
231
222
|
} catch (e) {
|
|
232
|
-
|
|
233
|
-
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionFail);
|
|
234
|
-
if (isThrownException(error)) throw error;
|
|
235
|
-
throw new TransactionException(new Error(error));
|
|
223
|
+
return this.handleBroadcastError(e, { txInclusion });
|
|
236
224
|
}
|
|
237
225
|
}
|
|
226
|
+
handleBroadcastError(error, tx) {
|
|
227
|
+
if (error instanceof TxObservationAbortError || isAbortError(error) && getTxObservationSignals(this.resolveTxInclusionOptions(tx)).some((signal) => signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
228
|
+
this.walletStrategy.emit(WalletStrategyEmitterEventType.TransactionCancelled, error);
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
this.walletStrategy.emit(WalletStrategyEmitterEventType.TransactionFail);
|
|
232
|
+
if (isThrownException(error)) throw error;
|
|
233
|
+
throw new TransactionException(new Error(error));
|
|
234
|
+
}
|
|
238
235
|
/**
|
|
239
236
|
* Prepare/sign/broadcast transaction using
|
|
240
237
|
* Ethereum native wallets on the client side.
|
|
@@ -1117,11 +1114,11 @@ var MsgBroadcaster = class {
|
|
|
1117
1114
|
return client;
|
|
1118
1115
|
}
|
|
1119
1116
|
async waitForTxInclusion({ tx, txHash, timeout }) {
|
|
1120
|
-
return this.createTxGrpcApi().waitForTxInclusion({
|
|
1117
|
+
return observeTx(txHash, () => this.createTxGrpcApi().waitForTxInclusion({
|
|
1121
1118
|
txHash,
|
|
1122
1119
|
timeout,
|
|
1123
1120
|
options: this.resolveTxInclusionOptions(tx)
|
|
1124
|
-
});
|
|
1121
|
+
}));
|
|
1125
1122
|
}
|
|
1126
1123
|
async prepareTxInclusionWaiter({ tx, timeout, txRawOrSignResponse }) {
|
|
1127
1124
|
const txRaw = createTxRawFromSigResponse(txRawOrSignResponse);
|
|
@@ -1138,7 +1135,7 @@ var MsgBroadcaster = class {
|
|
|
1138
1135
|
timeout,
|
|
1139
1136
|
txHash: responseTxHash
|
|
1140
1137
|
});
|
|
1141
|
-
const confirmedTx = await inclusionWaiter.wait(responseTxHash);
|
|
1138
|
+
const confirmedTx = await observeTx(responseTxHash, () => inclusionWaiter.wait(responseTxHash));
|
|
1142
1139
|
if (!confirmedTx) throw new TransactionException(/* @__PURE__ */ new Error(`The transaction with ${responseTxHash} is not found`));
|
|
1143
1140
|
return confirmedTx;
|
|
1144
1141
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./BaseWalletStrategy-2HVN2oeB.js";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-B1XSJ1Zx.js";
|
|
3
3
|
export { MsgBroadcaster, MsgBroadcasterOptions, MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, Web3Broadcaster };
|
package/dist/esm/broadcaster.js
CHANGED
|
@@ -135,6 +135,7 @@ declare class MsgBroadcaster {
|
|
|
135
135
|
txInclusion?: TxClientInclusionOptions;
|
|
136
136
|
txTimeoutInBlocks?: number;
|
|
137
137
|
}): Promise<TxResponse>;
|
|
138
|
+
private handleBroadcastError;
|
|
138
139
|
/**
|
|
139
140
|
* Prepare/sign/broadcast transaction using
|
|
140
141
|
* Ethereum native wallets on the client side.
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseWalletStrategy } from "./BaseWalletStrategy-2HVN2oeB.js";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-B1XSJ1Zx.js";
|
|
3
3
|
import "./index-DRYular4.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/tx.d.ts
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as MsgBroadcaster, r as checkIfTxRunOutOfGas, t as Web3Broadcaster } from "./broadcaster-
|
|
1
|
+
import { n as MsgBroadcaster, r as checkIfTxRunOutOfGas, t as Web3Broadcaster } from "./broadcaster-DO14o8eB.js";
|
|
2
2
|
import "./defineProperty-D4YE9KXX.js";
|
|
3
3
|
import { t as BaseWalletStrategy } from "./strategy-Co4vD1wN.js";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-core",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.63",
|
|
4
4
|
"description": "Core wallet strategy",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@keplr-wallet/types": "^0.12.296",
|
|
86
86
|
"eventemitter3": "^5.0.1",
|
|
87
|
-
"@injectivelabs/
|
|
88
|
-
"@injectivelabs/
|
|
89
|
-
"@injectivelabs/
|
|
90
|
-
"@injectivelabs/
|
|
91
|
-
"@injectivelabs/
|
|
92
|
-
"@injectivelabs/
|
|
87
|
+
"@injectivelabs/exceptions": "1.20.63",
|
|
88
|
+
"@injectivelabs/networks": "1.20.63",
|
|
89
|
+
"@injectivelabs/utils": "1.20.63",
|
|
90
|
+
"@injectivelabs/ts-types": "1.20.63",
|
|
91
|
+
"@injectivelabs/wallet-base": "1.20.63",
|
|
92
|
+
"@injectivelabs/sdk-ts": "1.20.63"
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|