@pooflabs/core 0.0.22 → 0.0.23

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.
@@ -55,3 +55,4 @@ export declare function setFile(path: string, file: File | null): Promise<boolea
55
55
  export declare function signMessage(message: string): Promise<string>;
56
56
  export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
57
57
  export declare function signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
58
+ export declare function syncItems(paths: string[]): Promise<any>;
package/dist/index.js CHANGED
@@ -3468,6 +3468,10 @@ async function setMany(many, options) {
3468
3468
  lastTxSignature = transactionResult.transactionSignature;
3469
3469
  signedTransaction = transactionResult.signedTransaction;
3470
3470
  }
3471
+ // Sync items after all transactions are confirmed
3472
+ // Wait for 1.5 seconds to ensure all transactions are confirmed
3473
+ await new Promise(resolve => setTimeout(resolve, 1500));
3474
+ await syncItems(many.map(m => m.path));
3471
3475
  // TODO: Should we wait here or do the optimistic subscription updates like below?
3472
3476
  return Object.assign(Object.assign({}, documents.map(d => d.document)), { transactionId: lastTxSignature, signedTransaction: signedTransaction });
3473
3477
  }
@@ -3679,6 +3683,15 @@ async function signAndSubmitTransaction(transaction, feePayer) {
3679
3683
  }
3680
3684
  return config.authProvider.signAndSubmitTransaction(transaction, feePayer);
3681
3685
  }
3686
+ async function syncItems(paths) {
3687
+ try {
3688
+ const response = await makeApiRequest('PUT', 'items/sync', { paths }, undefined);
3689
+ return response.data;
3690
+ }
3691
+ catch (error) {
3692
+ throw error;
3693
+ }
3694
+ }
3682
3695
 
3683
3696
  /**
3684
3697
  * WebSocket v2 Subscription Manager