Browse Source

ts: Make account unsubscribe async (#707)

xjcaa 4 years ago
parent
commit
8af34c4d08
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ts/src/program/namespace/account.ts

+ 2 - 2
ts/src/program/namespace/account.ts

@@ -206,14 +206,14 @@ export class AccountClient {
   /**
   /**
    * Unsubscribes from the account at the given address.
    * Unsubscribes from the account at the given address.
    */
    */
-  unsubscribe(address: Address) {
+  async unsubscribe(address: Address) {
     let sub = subscriptions.get(address.toString());
     let sub = subscriptions.get(address.toString());
     if (!sub) {
     if (!sub) {
       console.warn("Address is not subscribed");
       console.warn("Address is not subscribed");
       return;
       return;
     }
     }
     if (subscriptions) {
     if (subscriptions) {
-      this._provider.connection
+      await this._provider.connection
         .removeAccountChangeListener(sub.listener)
         .removeAccountChangeListener(sub.listener)
         .then(() => {
         .then(() => {
           subscriptions.delete(address.toString());
           subscriptions.delete(address.toString());