@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.
- package/package.json +1 -1
- package/src/client.js +7 -7
package/package.json
CHANGED
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=
|
|
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 =
|
|
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(
|
|
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 =
|
|
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=
|
|
916
|
-
* @param {number} [options.intervalMs=
|
|
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 =
|
|
925
|
+
const { maxAttempts = 225, intervalMs = 400 } = options;
|
|
926
926
|
|
|
927
927
|
try {
|
|
928
928
|
for (let i = 0; i < maxAttempts; i++) {
|