carbon-js-sdk 0.5.3 → 0.5.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/lib/wallet/CarbonWallet.js +14 -12
- package/package.json +1 -1
|
@@ -354,13 +354,14 @@ class CarbonWallet {
|
|
|
354
354
|
sendInitialMergeAccountTx(msgs, opts) {
|
|
355
355
|
return __awaiter(this, void 0, void 0, function* () {
|
|
356
356
|
let msg;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
357
|
+
yield this.reloadMergeAccountStatus();
|
|
358
|
+
if (!this.accountMerged && msgs[0].typeUrl !== util_1.CarbonTx.Types.MsgMergeAccount) {
|
|
359
|
+
const accountInfo = yield this.reloadAccountInfo();
|
|
360
|
+
if (!accountInfo) {
|
|
361
|
+
throw new Error('Account not found!');
|
|
362
|
+
}
|
|
363
|
+
const { address, sequence, accountNumber } = accountInfo;
|
|
364
|
+
try {
|
|
364
365
|
msg = {
|
|
365
366
|
typeUrl: util_1.CarbonTx.Types.MsgMergeAccount,
|
|
366
367
|
value: codec_1.MsgMergeAccount.fromPartial({
|
|
@@ -368,15 +369,16 @@ class CarbonWallet {
|
|
|
368
369
|
pubKey: this.publicKey.toString('hex')
|
|
369
370
|
})
|
|
370
371
|
};
|
|
371
|
-
const modifiedOpts = Object.assign(Object.assign({}, opts), { sequence
|
|
372
|
+
const modifiedOpts = Object.assign(Object.assign({}, opts), { sequence,
|
|
373
|
+
accountNumber });
|
|
372
374
|
yield this.signAndBroadcast([msg], modifiedOpts, { mode: tx_1.BroadcastTxMode.BroadcastTxBlock });
|
|
373
375
|
this.updateMergeAccountStatus();
|
|
374
376
|
yield util_1.GenericUtils.callIgnoreError(() => { var _a; return (_a = this.onBroadcastTxSuccess) === null || _a === void 0 ? void 0 : _a.call(this, [msg]); });
|
|
375
377
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
catch (error) {
|
|
379
|
+
yield util_1.GenericUtils.callIgnoreError(() => { var _a; return (_a = this.onBroadcastTxFail) === null || _a === void 0 ? void 0 : _a.call(this, [msg]); });
|
|
380
|
+
throw error;
|
|
381
|
+
}
|
|
380
382
|
}
|
|
381
383
|
});
|
|
382
384
|
}
|