@argonprotocol/mainchain 1.3.3 → 1.3.5

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.
@@ -8,7 +8,6 @@ import { Percent, AccountId32, H256, MultiAddress, Call, Hash, SignedBlock, Bloc
8
8
  export { AccountId, AccountId32, Block, Call, H160, H256, Header, MultiAddress, Permill } from '@polkadot/types/interfaces/runtime';
9
9
  import { FrameSupportPalletId, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpWeightsRuntimeDbWeight, SpVersionRuntimeVersion, FrameSupportTokensMiscBalanceStatus, SpRuntimeDispatchError, ArgonPrimitivesBitcoinUtxoRef, ArgonPrimitivesBitcoinBitcoinRejectedReason, ArgonPrimitivesBlockSealBlockPayout, PalletDomainsDomainRegistration, ArgonPrimitivesDomainZoneRecord, ArgonRuntimeOriginCaller, SpConsensusGrandpaAppPublic, PalletHyperbridgeVersionedHostParams, PalletIsmpErrorsHandlingError, IsmpEventsRequestResponseHandled, IsmpEventsTimeoutHandled, IsmpHostStateMachine, IsmpConsensusStateMachineHeight, IsmpConsensusStateMachineId, ArgonPrimitivesBlockSealMiningRegistration, PalletMintMintType, PalletMultisigTimepoint, ArgonPrimitivesNotaryNotaryRecord, ArgonPrimitivesNotaryNotaryMeta, ArgonNotaryAuditErrorVerifyError, PalletProxyDepositKind, ArgonRuntimeProxyType, FrameSystemDispatchEventInfo, PalletBalancesAccountData, FrameSupportTokensMiscIdAmountRuntimeFreezeReason, FrameSupportTokensMiscIdAmountRuntimeHoldReason, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBitcoinLocksLockedBitcoin, PalletBitcoinLocksLockReleaseRequest, ArgonPrimitivesBitcoinBitcoinNetwork, ArgonPrimitivesBitcoinBitcoinBlock, ArgonPrimitivesBitcoinUtxoValue, ArgonPrimitivesForkPower, ArgonPrimitivesProvidersBlockSealerInfo, ArgonPrimitivesInherentsBlockSealInherent, ArgonPrimitivesDigestsBlockVoteDigest, ArgonPrimitivesNotaryNotaryNotebookVoteDigestDetails, PalletChainTransferQueuedTransferOut, ArgonPrimitivesDigestsDigestset, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, IsmpConsensusStateCommitment, PalletLiquidityPoolsLiquidityPoolCapital, PalletLiquidityPoolsPrebondedArgons, PalletLiquidityPoolsLiquidityPool, ArgonPrimitivesBlockSealMiningBidStats, ArgonPrimitivesBlockSealMiningSlotConfig, PalletMintMintAction, PalletMultisigMultisig, ArgonPrimitivesBalanceChangeAccountOrigin, ArgonPrimitivesDigestsNotebookDigest, ArgonPrimitivesNotaryNotaryNotebookKeyDetails, PalletPriceIndexPriceIndex, PalletProxyAnnouncement, PalletProxyProxyDefinition, FrameSystemAccountInfo, FrameSystemCodeUpgradeAuthorization, FrameSupportDispatchPerDispatchClassWeight, SpRuntimeDigest, FrameSystemEventRecord, FrameSystemPhase, SpWeightsWeightV2Weight, FrameSystemLastRuntimeUpgradeInfo, ArgonPrimitivesTickTicker, PalletTransactionPaymentReleases, PalletVaultsVaultFrameFeeRevenue, ArgonPrimitivesVault, ArgonPrimitivesBitcoinBitcoinXPub, PalletBalancesAdjustmentDirection, ArgonPrimitivesBitcoinCompressedBitcoinPubkey, ArgonPrimitivesBitcoinH256Le, ArgonPrimitivesInherentsBitcoinUtxoSync, SpConsensusGrandpaEquivocationProof, SpCoreVoid, IsmpMessagingCreateConsensusState, PalletIsmpUtilsFundMessageParams, IsmpMessagingMessage, PalletIsmpUtilsUpdateConsensusState, IsmpGrandpaAddStateMachine, ArgonRuntimeSessionKeys, ArgonPrimitivesNotebookSignedNotebookHeader, PalletTokenGatewayAssetRegistration, PalletTokenGatewayTeleportParams, PalletTokenGatewayPrecisionUpdate, TokenGatewayPrimitivesGatewayAssetUpdate, PalletVaultsVaultConfig, ArgonPrimitivesVaultVaultTerms, ArgonPrimitivesBitcoinOpaqueBitcoinXpub } from '@polkadot/types/lookup';
10
10
  export * from '@polkadot/types/lookup';
11
- import * as _polkadot_types_types from '@polkadot/types/types';
12
11
  import { Observable, IExtrinsic } from '@polkadot/types/types';
13
12
  import { AugmentedRpc } from '@polkadot/rpc-core/types';
14
13
  import { StorageKey, Metadata, Data, GenericEvent as GenericEvent$1 } from '@polkadot/types';
@@ -90,13 +89,15 @@ export { Keyring } from '@polkadot/api';
90
89
  export { decodeAddress, mnemonicGenerate } from '@polkadot/util-crypto';
91
90
  export { InterfaceTypes as interfaces } from '@polkadot/types/types/registry';
92
91
  export { KeypairType } from '@polkadot/util-crypto/types';
92
+ import * as _polkadot_types_types_extrinsic from '@polkadot/types/types/extrinsic';
93
93
  import { ISubmittableResult } from '@polkadot/types/types/extrinsic';
94
+ export { IExtrinsic, ISignerPayload, ISubmittableResult, Signer, SignerResult } from '@polkadot/types/types/extrinsic';
94
95
  import { SubmittableExtrinsic as SubmittableExtrinsic$1 } from '@polkadot/api/promise/types';
95
96
  import { SignerOptions, ApiDecoration } from '@polkadot/api/types';
96
97
  import { GenericEvent } from '@polkadot/types/generic';
97
98
  export { GenericAddress, GenericBlock, GenericEvent } from '@polkadot/types/generic';
98
99
  import BigNumber from 'bignumber.js';
99
- import { DispatchError as DispatchError$1, Header as Header$1, ExtrinsicStatus as ExtrinsicStatus$1 } from '@polkadot/types/interfaces';
100
+ import { DispatchError as DispatchError$1, Header as Header$1 } from '@polkadot/types/interfaces';
100
101
  export { hexToU8a, u8aEq, u8aToHex } from '@polkadot/util';
101
102
 
102
103
  declare module '@polkadot/api-base/types/consts' {
@@ -11254,9 +11255,10 @@ declare class TxSubmitter {
11254
11255
  logResults?: boolean;
11255
11256
  waitForBlock?: boolean;
11256
11257
  useLatestNonce?: boolean;
11257
- onResultCallback?: (result: ISubmittableResult) => void;
11258
+ txProgressCallback?: ITxProgressCallback;
11258
11259
  }): Promise<TxResult>;
11259
11260
  }
11261
+ type ITxProgressCallback = (progressToInBlock: number, result: TxResult) => void;
11260
11262
  declare class TxResult {
11261
11263
  private readonly client;
11262
11264
  private shouldLog;
@@ -11277,7 +11279,7 @@ declare class TxResult {
11277
11279
  * The fee tip paid for the transaction.
11278
11280
  */
11279
11281
  finalFeeTip?: bigint;
11280
- onResultCallback?: (result: ISubmittableResult) => void;
11282
+ txProgressCallback?: ITxProgressCallback;
11281
11283
  private inBlockResolve;
11282
11284
  private inBlockReject;
11283
11285
  private finalizedResolve;
@@ -11297,7 +11299,7 @@ declare class AccountRegistry {
11297
11299
  }
11298
11300
 
11299
11301
  declare const MICROGONS_PER_ARGON = 1000000;
11300
- declare function formatArgons(x: bigint | number): string;
11302
+ declare function formatArgons(microgons: bigint | number): string;
11301
11303
  declare function formatPercent(x: BigNumber | undefined): string;
11302
11304
  type NonNullableProps<T> = {
11303
11305
  [K in keyof T]-?: Exclude<T[K], undefined | null>;
@@ -11613,9 +11615,8 @@ declare class MiningBids {
11613
11615
  }
11614
11616
 
11615
11617
  declare class Vault {
11616
- private tickDuration;
11618
+ tickDuration: number;
11617
11619
  securitization: bigint;
11618
- securitizationRatio: BigNumber;
11619
11620
  argonsLocked: bigint;
11620
11621
  argonsPendingActivation: bigint;
11621
11622
  argonsScheduledForRelease: Map<number, bigint>;
@@ -11627,10 +11628,12 @@ declare class Vault {
11627
11628
  pendingTermsChangeTick?: number;
11628
11629
  openedDate: Date;
11629
11630
  openedTick: number;
11631
+ securitizationRatio: number;
11630
11632
  constructor(id: number, vault: ArgonPrimitivesVault, tickDuration: number);
11631
11633
  load(vault: ArgonPrimitivesVault): void;
11632
11634
  availableBitcoinSpace(): bigint;
11633
11635
  getRelockCapacity(): bigint;
11636
+ securitizationRatioBN(): BigNumber;
11634
11637
  recoverySecuritization(): bigint;
11635
11638
  minimumSecuritization(): bigint;
11636
11639
  activatedSecuritization(): bigint;
@@ -11649,7 +11652,7 @@ declare class Vault {
11649
11652
  liquidityPoolProfitSharing: number;
11650
11653
  tip?: bigint;
11651
11654
  doNotExceedBalance?: bigint;
11652
- progressCallback?: (progressPct: number, status: ExtrinsicStatus$1) => void;
11655
+ txProgressCallback?: ITxProgressCallback;
11653
11656
  }, config?: {
11654
11657
  tickDurationMillis?: number;
11655
11658
  }): Promise<{
@@ -11840,6 +11843,7 @@ declare class BitcoinLocks {
11840
11843
  utxoId: number;
11841
11844
  vaultSignature: Uint8Array;
11842
11845
  argonKeyring: KeyringPair;
11846
+ txProgressCallback?: ITxProgressCallback;
11843
11847
  }): Promise<TxResult>;
11844
11848
  getBitcoinLock(utxoId: number): Promise<IBitcoinLock | undefined>;
11845
11849
  /**
@@ -11862,7 +11866,7 @@ declare class BitcoinLocks {
11862
11866
  reducedBalanceBy?: bigint;
11863
11867
  tip?: bigint;
11864
11868
  }): Promise<{
11865
- tx: _polkadot_api_base_types.SubmittableExtrinsic<"promise", _polkadot_types_types.ISubmittableResult>;
11869
+ tx: _polkadot_api_base_types.SubmittableExtrinsic<"promise", _polkadot_types_types_extrinsic.ISubmittableResult>;
11866
11870
  securityFee: bigint;
11867
11871
  txFee: bigint;
11868
11872
  }>;
@@ -11872,6 +11876,7 @@ declare class BitcoinLocks {
11872
11876
  argonKeyring: KeyringPair;
11873
11877
  satoshis: bigint;
11874
11878
  tip?: bigint;
11879
+ txProgressCallback?: ITxProgressCallback;
11875
11880
  }): Promise<{
11876
11881
  lock: IBitcoinLock;
11877
11882
  createdAtHeight: number;
@@ -11884,6 +11889,7 @@ declare class BitcoinLocks {
11884
11889
  releaseRequest: IReleaseRequest;
11885
11890
  argonKeyring: KeyringPair;
11886
11891
  tip?: bigint;
11892
+ txProgressCallback?: ITxProgressCallback;
11887
11893
  }): Promise<{
11888
11894
  blockHash: Uint8Array;
11889
11895
  blockHeight: number;
@@ -11899,6 +11905,7 @@ declare class BitcoinLocks {
11899
11905
  argonKeyring: KeyringPair;
11900
11906
  tip?: bigint;
11901
11907
  vault: Vault;
11908
+ txProgressCallback?: ITxProgressCallback;
11902
11909
  }): Promise<{
11903
11910
  securityFee: bigint;
11904
11911
  txFee: bigint;
@@ -11926,6 +11933,7 @@ declare class BitcoinLocks {
11926
11933
  }
11927
11934
  interface IBitcoinLockConfig {
11928
11935
  releaseExpirationBlocks: number;
11936
+ pendingConfirmationExpirationBlocks: number;
11929
11937
  tickDurationMillis: number;
11930
11938
  bitcoinNetwork: ArgonPrimitivesBitcoinBitcoinNetwork;
11931
11939
  }
@@ -11987,4 +11995,4 @@ declare function waitForLoad(): Promise<void>;
11987
11995
  */
11988
11996
  declare function getClient(host: string): Promise<ArgonClient>;
11989
11997
 
11990
- export { AccountMiners, AccountRegistry, Accountset, type ArgonClient, type ArgonClientConfig, BidPool, BitcoinLocks, BlockWatch, CohortBidder, ExtrinsicError, FrameCalculator, type IBitcoinLock, type IBitcoinLockConfig, type IMiningIndex, type IReleaseRequest, type IReleaseRequestDetails, type ISubaccountMiner, JsonExt, MICROGONS_PER_ARGON, MiningBids, SATS_PER_BTC, TxSubmitter, TypedEmitter, Vault, VaultMonitor, WageProtector, checkForExtrinsicSuccess, convertFixedU128ToBigNumber, convertNumberToFixedU128, convertNumberToPermill, convertPermillToBigNumber, createKeyringPair, createNanoEvents, dispatchErrorToExtrinsicError, dispatchErrorToString, eventDataToJson, filterUndefined, formatArgons, formatPercent, getAuthorFromHeader, getClient, getConfig, getTickFromHeader, gettersToObject, keyringFromSuri, setConfig, toFixedNumber, waitForLoad };
11998
+ export { AccountMiners, AccountRegistry, Accountset, type ArgonClient, type ArgonClientConfig, BidPool, BitcoinLocks, BlockWatch, CohortBidder, ExtrinsicError, FrameCalculator, type IBitcoinLock, type IBitcoinLockConfig, type IMiningIndex, type IReleaseRequest, type IReleaseRequestDetails, type ISubaccountMiner, type ITxProgressCallback, JsonExt, MICROGONS_PER_ARGON, MiningBids, SATS_PER_BTC, TxResult, TxSubmitter, TypedEmitter, Vault, VaultMonitor, WageProtector, checkForExtrinsicSuccess, convertFixedU128ToBigNumber, convertNumberToFixedU128, convertNumberToPermill, convertPermillToBigNumber, createKeyringPair, createNanoEvents, dispatchErrorToExtrinsicError, dispatchErrorToString, eventDataToJson, filterUndefined, formatArgons, formatPercent, getAuthorFromHeader, getClient, getConfig, getTickFromHeader, gettersToObject, keyringFromSuri, setConfig, toFixedNumber, waitForLoad };
package/browser/index.js CHANGED
@@ -13,7 +13,7 @@ import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
13
13
  export { decodeAddress, mnemonicGenerate } from '@polkadot/util-crypto';
14
14
  import * as BigNumber from 'bignumber.js';
15
15
  import BigNumber__default from 'bignumber.js';
16
- import { hexToU8a, u8aToHex } from '@polkadot/util';
16
+ import { u8aToHex, hexToU8a } from '@polkadot/util';
17
17
  export { hexToU8a, u8aEq, u8aToHex } from '@polkadot/util';
18
18
  import { printTable, Table } from 'console-table-printer';
19
19
  import bs58check from 'bs58check';
@@ -121,20 +121,21 @@ var TxSubmitter = class {
121
121
  const { tip, unavailableBalance } = options;
122
122
  const account = await this.client.query.system.account(this.pair.address);
123
123
  let availableBalance = account.data.free.toBigInt();
124
+ const userBalance = availableBalance;
124
125
  if (unavailableBalance) {
125
126
  availableBalance -= unavailableBalance;
126
127
  }
127
128
  const existentialDeposit = options.includeExistentialDeposit ? this.client.consts.balances.existentialDeposit.toBigInt() : 0n;
128
129
  const fees = await this.feeEstimate(tip);
129
130
  const totalCharge = fees + (tip ?? 0n);
130
- const canAfford = availableBalance > totalCharge + existentialDeposit;
131
- return { canAfford, availableBalance, txFee: fees };
131
+ const canAfford = availableBalance >= totalCharge + existentialDeposit;
132
+ return { canAfford, availableBalance: userBalance, txFee: fees };
132
133
  }
133
134
  async submit(options = {}) {
134
135
  const { logResults, waitForBlock, useLatestNonce, ...apiOptions } = options;
135
136
  await waitForLoad();
136
137
  const result = new TxResult(this.client, logResults);
137
- result.onResultCallback = options.onResultCallback;
138
+ result.txProgressCallback = options.txProgressCallback;
138
139
  let toHuman = this.tx.toHuman().method;
139
140
  let txString = [];
140
141
  let api = formatCall(toHuman);
@@ -187,7 +188,7 @@ var TxResult = class {
187
188
  * The fee tip paid for the transaction.
188
189
  */
189
190
  __publicField(this, "finalFeeTip");
190
- __publicField(this, "onResultCallback");
191
+ __publicField(this, "txProgressCallback");
191
192
  __publicField(this, "inBlockResolve");
192
193
  __publicField(this, "inBlockReject");
193
194
  __publicField(this, "finalizedResolve");
@@ -238,7 +239,15 @@ var TxResult = class {
238
239
  if (isFinalized) {
239
240
  this.finalizedResolve(status.asFinalized);
240
241
  }
241
- this.onResultCallback?.(result);
242
+ if (this.txProgressCallback) {
243
+ let percent = 0;
244
+ if (result.status.isBroadcast) {
245
+ percent = 50;
246
+ } else if (result.status.isInBlock) {
247
+ percent = 100;
248
+ }
249
+ this.txProgressCallback(percent, this);
250
+ }
242
251
  }
243
252
  reject(error) {
244
253
  this.inBlockReject(error);
@@ -247,10 +256,10 @@ var TxResult = class {
247
256
  };
248
257
  var { ROUND_FLOOR } = BigNumber;
249
258
  var MICROGONS_PER_ARGON = 1e6;
250
- function formatArgons(x) {
251
- if (x === void 0 || x === null) return "na";
252
- const isNegative = x < 0;
253
- let format = BigNumber__default(x.toString()).abs().div(MICROGONS_PER_ARGON).toFormat(2, ROUND_FLOOR);
259
+ function formatArgons(microgons) {
260
+ if (microgons === void 0 || microgons === null) return "na";
261
+ const isNegative = microgons < 0;
262
+ let format = BigNumber__default(microgons.toString()).abs().div(MICROGONS_PER_ARGON).toFormat(2, ROUND_FLOOR);
254
263
  if (format.endsWith(".00")) {
255
264
  format = format.slice(0, -3);
256
265
  }
@@ -394,7 +403,7 @@ var JsonExt = class {
394
403
  return BigInt(v.slice(0, -1));
395
404
  }
396
405
  if (typeof v === "object" && v !== null && v.type === "Buffer" && Array.isArray(v.data)) {
397
- return hexToU8a(v.data);
406
+ return Uint8Array.from(v.data);
398
407
  }
399
408
  return v;
400
409
  });
@@ -1289,10 +1298,9 @@ var Vault = class _Vault {
1289
1298
  constructor(id, vault, tickDuration) {
1290
1299
  this.tickDuration = tickDuration;
1291
1300
  __publicField(this, "securitization");
1292
- __publicField(this, "securitizationRatio");
1293
1301
  __publicField(this, "argonsLocked");
1294
1302
  __publicField(this, "argonsPendingActivation");
1295
- __publicField(this, "argonsScheduledForRelease", /* @__PURE__ */ new Map());
1303
+ __publicField(this, "argonsScheduledForRelease");
1296
1304
  __publicField(this, "terms");
1297
1305
  __publicField(this, "operatorAccountId");
1298
1306
  __publicField(this, "isClosed");
@@ -1301,14 +1309,18 @@ var Vault = class _Vault {
1301
1309
  __publicField(this, "pendingTermsChangeTick");
1302
1310
  __publicField(this, "openedDate");
1303
1311
  __publicField(this, "openedTick");
1312
+ __publicField(this, "securitizationRatio");
1304
1313
  this.vaultId = id;
1305
- this.load(vault);
1306
1314
  this.openedTick = vault.openedTick.toNumber();
1307
1315
  this.openedDate = new Date(this.openedTick * this.tickDuration);
1316
+ this.argonsScheduledForRelease = /* @__PURE__ */ new Map();
1317
+ this.load(vault);
1308
1318
  }
1309
1319
  load(vault) {
1310
1320
  this.securitization = vault.securitization.toBigInt();
1311
- this.securitizationRatio = convertFixedU128ToBigNumber(vault.securitizationRatio.toBigInt());
1321
+ this.securitizationRatio = convertFixedU128ToBigNumber(
1322
+ vault.securitizationRatio.toBigInt()
1323
+ ).toNumber();
1312
1324
  this.argonsLocked = vault.argonsLocked.toBigInt();
1313
1325
  this.argonsPendingActivation = vault.argonsPendingActivation.toBigInt();
1314
1326
  if (vault.argonsScheduledForRelease.size > 0) {
@@ -1350,21 +1362,21 @@ var Vault = class _Vault {
1350
1362
  getRelockCapacity() {
1351
1363
  return [...this.argonsScheduledForRelease.values()].reduce((acc, val) => acc + val, 0n);
1352
1364
  }
1365
+ securitizationRatioBN() {
1366
+ return new BigNumber__default(this.securitizationRatio);
1367
+ }
1353
1368
  recoverySecuritization() {
1354
- const reserved = new BigNumber__default(1).div(this.securitizationRatio);
1369
+ const reserved = new BigNumber__default(1).div(this.securitizationRatioBN());
1355
1370
  return this.securitization - BigInt(reserved.multipliedBy(this.securitization.toString()).toFixed(0, ROUND_FLOOR2));
1356
1371
  }
1357
1372
  minimumSecuritization() {
1358
1373
  return BigInt(
1359
- this.securitizationRatio.multipliedBy(this.argonsLocked.toString()).decimalPlaces(0, BigNumber__default.ROUND_CEIL).toString()
1374
+ this.securitizationRatioBN().multipliedBy(this.argonsLocked.toString()).decimalPlaces(0, BigNumber__default.ROUND_CEIL).toString()
1360
1375
  );
1361
1376
  }
1362
1377
  activatedSecuritization() {
1363
1378
  const activated = this.argonsLocked - this.argonsPendingActivation;
1364
- let maxRatio = this.securitizationRatio;
1365
- if (this.securitizationRatio.toNumber() > 2) {
1366
- maxRatio = BigNumber__default(2);
1367
- }
1379
+ const maxRatio = BigNumber__default(Math.min(this.securitizationRatio, 2));
1368
1380
  return BigInt(maxRatio.multipliedBy(activated.toString()).toFixed(0, ROUND_FLOOR2));
1369
1381
  }
1370
1382
  /**
@@ -1395,7 +1407,7 @@ var Vault = class _Vault {
1395
1407
  bitcoinXpub,
1396
1408
  tip,
1397
1409
  doNotExceedBalance,
1398
- progressCallback
1410
+ txProgressCallback
1399
1411
  } = args;
1400
1412
  let xpubBytes = hexToU8a(bitcoinXpub);
1401
1413
  if (xpubBytes.length !== 78) {
@@ -1438,21 +1450,7 @@ var Vault = class _Vault {
1438
1450
  tip,
1439
1451
  useLatestNonce: true,
1440
1452
  waitForBlock: true,
1441
- onResultCallback(result2) {
1442
- let percent = 0;
1443
- if (result2.status.isInvalid || result2.status.isDropped || result2.status.isUsurped || result2.status.isRetracted) {
1444
- percent = 1;
1445
- } else if (result2.status.isReady) {
1446
- percent = 0;
1447
- } else if (result2.status.isBroadcast) {
1448
- percent = 0.5;
1449
- } else if (result2.status.isInBlock) {
1450
- percent = 1;
1451
- } else if (result2.status.isFinalized) {
1452
- percent = 1.1;
1453
- }
1454
- progressCallback?.(percent, result2.status);
1455
- }
1453
+ txProgressCallback
1456
1454
  });
1457
1455
  await result.inBlockPromise;
1458
1456
  let vaultId;
@@ -1557,7 +1555,7 @@ var VaultMonitor = class {
1557
1555
  id: vaultId,
1558
1556
  btcSpace: `${formatArgons(vault.availableBitcoinSpace())} (${formatArgons(vault.argonsPendingActivation)} pending)`,
1559
1557
  btcDeal: `${formatArgons(vault.terms.bitcoinBaseFee)} + ${formatPercent(vault.terms.bitcoinAnnualPercentRate)}`,
1560
- securitization: `${formatArgons(vault.securitization)} at ${vault.securitizationRatio.toFormat(1)}x`,
1558
+ securitization: `${formatArgons(vault.securitization)} at ${vault.securitizationRatio}x`,
1561
1559
  securActivated: `${formatArgons(vault.activatedSecuritizationPerSlot())}/slot`,
1562
1560
  liquidPoolDeal: `${formatPercent(vault.terms.liquidityPoolProfitSharing)} sharing`,
1563
1561
  operator: `${this.accountset.namedAccounts.has(vault.operatorAccountId) ? ` (${this.accountset.namedAccounts.get(vault.operatorAccountId)})` : vault.operatorAccountId}`,
@@ -2271,6 +2269,7 @@ var BitcoinLocks = class _BitcoinLocks {
2271
2269
  const bitcoinNetwork = await client.query.bitcoinUtxos.bitcoinNetwork();
2272
2270
  return {
2273
2271
  releaseExpirationBlocks: client.consts.bitcoinLocks.lockReleaseCosignDeadlineBlocks.toNumber(),
2272
+ pendingConfirmationExpirationBlocks: client.consts.bitcoinUtxos.maxPendingConfirmationBlocks.toNumber(),
2274
2273
  tickDurationMillis: await client.query.ticks.genesisTicker().then((x) => x.tickDurationMillis.toNumber()),
2275
2274
  bitcoinNetwork
2276
2275
  };
@@ -2325,7 +2324,7 @@ var BitcoinLocks = class _BitcoinLocks {
2325
2324
  return void 0;
2326
2325
  }
2327
2326
  async submitVaultSignature(args) {
2328
- const { utxoId, vaultSignature, argonKeyring } = args;
2327
+ const { utxoId, vaultSignature, argonKeyring, txProgressCallback } = args;
2329
2328
  const client = await this.client;
2330
2329
  if (!vaultSignature || vaultSignature.byteLength < 70 || vaultSignature.byteLength > 73) {
2331
2330
  throw new Error(
@@ -2335,7 +2334,7 @@ var BitcoinLocks = class _BitcoinLocks {
2335
2334
  const signature = u8aToHex(vaultSignature);
2336
2335
  const tx = client.tx.bitcoinLocks.cosignRelease(utxoId, signature);
2337
2336
  const submitter = new TxSubmitter(client, tx, argonKeyring);
2338
- return await submitter.submit();
2337
+ return await submitter.submit({ txProgressCallback });
2339
2338
  }
2340
2339
  async getBitcoinLock(utxoId) {
2341
2340
  const client = await this.client;
@@ -2506,11 +2505,16 @@ var BitcoinLocks = class _BitcoinLocks {
2506
2505
  return { tx, securityFee, txFee };
2507
2506
  }
2508
2507
  async initializeLock(args) {
2509
- const { argonKeyring, tip = 0n } = args;
2508
+ const { argonKeyring, tip = 0n, txProgressCallback } = args;
2510
2509
  const client = await this.client;
2511
2510
  const { tx, securityFee } = await this.createInitializeLockTx(args);
2512
2511
  const submitter = new TxSubmitter(client, tx, argonKeyring);
2513
- const txResult = await submitter.submit({ waitForBlock: true, logResults: true, tip });
2512
+ const txResult = await submitter.submit({
2513
+ waitForBlock: true,
2514
+ logResults: true,
2515
+ tip,
2516
+ txProgressCallback
2517
+ });
2514
2518
  const blockHash = await txResult.inBlockPromise;
2515
2519
  const blockHeight = await client.at(blockHash).then((x) => x.query.system.number()).then((x) => x.toNumber());
2516
2520
  const utxoId = await this.getUtxoIdFromEvents(txResult.events) ?? 0;
@@ -2533,7 +2537,8 @@ var BitcoinLocks = class _BitcoinLocks {
2533
2537
  lock,
2534
2538
  releaseRequest: { bitcoinNetworkFee, toScriptPubkey },
2535
2539
  argonKeyring,
2536
- tip
2540
+ tip,
2541
+ txProgressCallback
2537
2542
  } = args;
2538
2543
  if (!toScriptPubkey.startsWith("0x")) {
2539
2544
  throw new Error("toScriptPubkey must be a hex string starting with 0x");
@@ -2556,7 +2561,12 @@ var BitcoinLocks = class _BitcoinLocks {
2556
2561
  `Insufficient funds to release lock. Available: ${formatArgons(canAfford.availableBalance)}, Required: ${formatArgons(redemptionPrice)}`
2557
2562
  );
2558
2563
  }
2559
- const txResult = await submitter.submit({ waitForBlock: true, logResults: true, tip });
2564
+ const txResult = await submitter.submit({
2565
+ waitForBlock: true,
2566
+ logResults: true,
2567
+ tip,
2568
+ txProgressCallback
2569
+ });
2560
2570
  const blockHash = await txResult.inBlockPromise;
2561
2571
  const blockHeight = await client.at(blockHash).then((x) => x.query.system.number()).then((x) => x.toNumber());
2562
2572
  return {
@@ -2595,7 +2605,7 @@ var BitcoinLocks = class _BitcoinLocks {
2595
2605
  };
2596
2606
  }
2597
2607
  async ratchet(args) {
2598
- const { lock, argonKeyring, tip = 0n, vault } = args;
2608
+ const { lock, argonKeyring, tip = 0n, vault, txProgressCallback } = args;
2599
2609
  const client = await this.client;
2600
2610
  const ratchetPrice = await this.getRatchetPrice(lock, vault);
2601
2611
  const txSubmitter = new TxSubmitter(
@@ -2616,7 +2626,8 @@ var BitcoinLocks = class _BitcoinLocks {
2616
2626
  }
2617
2627
  const submission = await txSubmitter.submit({
2618
2628
  waitForBlock: true,
2619
- tip
2629
+ tip,
2630
+ txProgressCallback
2620
2631
  });
2621
2632
  const ratchetEvent = submission.events.find(
2622
2633
  (x) => client.events.bitcoinLocks.BitcoinLockRatcheted.is(x)
@@ -2716,6 +2727,6 @@ async function getClient(host) {
2716
2727
  return await ApiPromise.create({ provider, noInitWarn: true });
2717
2728
  }
2718
2729
 
2719
- export { AccountMiners, AccountRegistry, Accountset, BidPool, BitcoinLocks, BlockWatch, CohortBidder, ExtrinsicError2 as ExtrinsicError, FrameCalculator, JsonExt, MICROGONS_PER_ARGON, MiningBids, SATS_PER_BTC, TxSubmitter, TypedEmitter, Vault, VaultMonitor, WageProtector, checkForExtrinsicSuccess, convertFixedU128ToBigNumber, convertNumberToFixedU128, convertNumberToPermill, convertPermillToBigNumber, createKeyringPair, createNanoEvents, dispatchErrorToExtrinsicError, dispatchErrorToString, eventDataToJson, filterUndefined, formatArgons, formatPercent, getAuthorFromHeader, getClient, getConfig, getTickFromHeader, gettersToObject, keyringFromSuri, setConfig, toFixedNumber, waitForLoad };
2730
+ export { AccountMiners, AccountRegistry, Accountset, BidPool, BitcoinLocks, BlockWatch, CohortBidder, ExtrinsicError2 as ExtrinsicError, FrameCalculator, JsonExt, MICROGONS_PER_ARGON, MiningBids, SATS_PER_BTC, TxResult, TxSubmitter, TypedEmitter, Vault, VaultMonitor, WageProtector, checkForExtrinsicSuccess, convertFixedU128ToBigNumber, convertNumberToFixedU128, convertNumberToPermill, convertPermillToBigNumber, createKeyringPair, createNanoEvents, dispatchErrorToExtrinsicError, dispatchErrorToString, eventDataToJson, filterUndefined, formatArgons, formatPercent, getAuthorFromHeader, getClient, getConfig, getTickFromHeader, gettersToObject, keyringFromSuri, setConfig, toFixedNumber, waitForLoad };
2720
2731
  //# sourceMappingURL=index.js.map
2721
2732
  //# sourceMappingURL=index.js.map