@fairblock/stabletrust 1.0.11 → 1.0.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/client.js +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairblock/stabletrust",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "SDK for confidential transfers using homomorphic encryption and zero-knowledge proofs",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/client.js CHANGED
@@ -155,11 +155,11 @@ export class ConfidentialTransferClient {
155
155
  * @param {ethers.Wallet|ethers.Signer} wallet - The wallet to create account for
156
156
  * @param {Object} [options] - Options
157
157
  * @param {boolean} [options.waitForFinalization=true] - Wait for account finalization
158
- * @param {number} [options.maxAttempts=30] - Max attempts to wait for finalization
158
+ * @param {number} [options.maxAttempts=225] - Max attempts to wait for finalization
159
159
  * @returns {Promise<{publicKey: string, privateKey: string}>} The derived keys
160
160
  */
161
161
  async ensureAccount(wallet, options = {}) {
162
- const { waitForFinalization = true, maxAttempts = 30 } = options;
162
+ const { waitForFinalization = true, maxAttempts = 225 } = options;
163
163
 
164
164
  try {
165
165
  const address = await wallet.getAddress();
@@ -183,7 +183,7 @@ export class ConfidentialTransferClient {
183
183
  if (waitForFinalization) {
184
184
  let attempts = 0;
185
185
  while (!accountInfo.finalized && attempts < maxAttempts) {
186
- await sleep(2000);
186
+ await sleep(400);
187
187
  accountInfo = await this.getAccountInfo(address);
188
188
  attempts++;
189
189
  }
@@ -881,7 +881,7 @@ export class ConfidentialTransferClient {
881
881
  */
882
882
  async _waitForGlobalState(address, actionLabel) {
883
883
  let attempts = 0;
884
- const maxAttempts = 300;
884
+ const maxAttempts = 450; // 450 * 200ms = 90 seconds max wait
885
885
 
886
886
  while (attempts < maxAttempts) {
887
887
  try {
@@ -912,8 +912,8 @@ export class ConfidentialTransferClient {
912
912
  * @param {string} privateKey - Private key for decryption
913
913
  * @param {string} tokenAddress - Token address
914
914
  * @param {Object} [options] - Options
915
- * @param {number} [options.maxAttempts=60] - Maximum polling attempts
916
- * @param {number} [options.intervalMs=3000] - Polling interval in milliseconds
915
+ * @param {number} [options.maxAttempts=225] - Maximum polling attempts
916
+ * @param {number} [options.intervalMs=400] - Polling interval in milliseconds
917
917
  * @returns {Promise<{amount: number, ciphertext: string}>}
918
918
  */
919
919
  async _waitForPendingBalance(
@@ -922,7 +922,7 @@ export class ConfidentialTransferClient {
922
922
  tokenAddress,
923
923
  options = {},
924
924
  ) {
925
- const { maxAttempts = 60, intervalMs = 3000 } = options;
925
+ const { maxAttempts = 225, intervalMs = 400 } = options;
926
926
 
927
927
  try {
928
928
  for (let i = 0; i < maxAttempts; i++) {