From 362262fa81ff59faf65cce465e0af8fa4ad16fc9 Mon Sep 17 00:00:00 2001 From: Saad Ahmed <48211799+saadjhk@users.noreply.github.com> Date: Wed, 26 Apr 2023 04:13:39 +0500 Subject: [PATCH 1/2] Update SolanaConnect.ts --- .../sdk-core/src/lib/chains/solana/SolanaConnect.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/sdk-core/src/lib/chains/solana/SolanaConnect.ts b/packages/sdk-core/src/lib/chains/solana/SolanaConnect.ts index 7de27a77..e58b8bb3 100644 --- a/packages/sdk-core/src/lib/chains/solana/SolanaConnect.ts +++ b/packages/sdk-core/src/lib/chains/solana/SolanaConnect.ts @@ -10,7 +10,7 @@ import {bridgeUSDC, createAssociatedTokenAccountTransaction, getAssociatedTokenA export class SolanaConnect { readonly defaultConnection: "testnet" | "devnet" | "mainnet"; - readonly accountStore: SolanaAccountsStore; + readonly accountsStore: SolanaAccountsStore; readonly solanaConfig: SolanaConfig; readonly connections: Record<"testnet" | "devnet" | "mainnet", Connection>; @@ -31,7 +31,7 @@ export class SolanaConnect { config.solana.server ) } - this.accountStore = new SolanaAccountsStore( + this.accountsStore = new SolanaAccountsStore( config.name === GlitterEnvironment.mainnet ? this.connections.mainnet : this.connections.testnet ) @@ -145,7 +145,7 @@ export class SolanaConnect { amount ) let connection = this.connections[this.defaultConnection] - const account = this.accountStore.get(sourceAddress) + const account = this.accountsStore.get(sourceAddress) if (tokenSymbol.toLowerCase() === "usdc" && this.defaultConnection === "testnet") { connection = this.connections.devnet } @@ -194,10 +194,10 @@ export class SolanaConnect { if (!token) return Promise.reject(new Error('Token Config unavailable')) const isNative = tksLowercase === "sol" - return isNative ? await this.accountStore.getSOLBalance( + return isNative ? await this.accountsStore.getSOLBalance( account, this.connections[this.defaultConnection] - ) : await this.accountStore.getSPLTokenBalance( + ) : await this.accountsStore.getSPLTokenBalance( account, token, this.getConnection(tokenSymbol) @@ -269,7 +269,7 @@ export class SolanaConnect { * @returns {Promise} */ async optin(signerAddress: string, tokenSymbol: string): Promise { - const signer = this.accountStore.get(signerAddress) + const signer = this.accountsStore.get(signerAddress) if (!signer) throw new Error('Account unavailable') const transaction = await this.optinTransaction( From ce5eeae477c1f0d61226686500ce943ec583b653 Mon Sep 17 00:00:00 2001 From: Saad Ahmed <48211799+saadjhk@users.noreply.github.com> Date: Wed, 26 Apr 2023 04:14:33 +0500 Subject: [PATCH 2/2] Update SolanaConnect.test.ts --- packages/sdk-integration-tests/tests/SolanaConnect.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sdk-integration-tests/tests/SolanaConnect.test.ts b/packages/sdk-integration-tests/tests/SolanaConnect.test.ts index 50df3692..12f7bc5e 100644 --- a/packages/sdk-integration-tests/tests/SolanaConnect.test.ts +++ b/packages/sdk-integration-tests/tests/SolanaConnect.test.ts @@ -19,7 +19,7 @@ describe("SolanaConnect", () => { glitterSdk.setEnvironment(GlitterEnvironment.testnet) glitterSdk = glitterSdk.connect([BridgeNetworks.solana]); solConnect = glitterSdk.solana! - solAccount = await solConnect.accountStore.createNew() + solAccount = await solConnect.accountsStore.createNew() }); it("Provides solana network connections", async () => { @@ -47,7 +47,7 @@ describe("SolanaConnect", () => { }) it("Provides Solana AccountStore", async () => { - expect(solConnect.accountStore).toBeTruthy() + expect(solConnect.accountsStore).toBeTruthy() }) it("Provides supported tokens", async () => {