Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solana fix #55

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/sdk-core/src/lib/chains/solana/SolanaConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;

Expand All @@ -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
)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -269,7 +269,7 @@ export class SolanaConnect {
* @returns {Promise<Transaction>}
*/
async optin(signerAddress: string, tokenSymbol: string): Promise<string> {
const signer = this.accountStore.get(signerAddress)
const signer = this.accountsStore.get(signerAddress)
if (!signer) throw new Error('Account unavailable')

const transaction = await this.optinTransaction(
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-integration-tests/tests/SolanaConnect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -47,7 +47,7 @@ describe("SolanaConnect", () => {
})

it("Provides Solana AccountStore", async () => {
expect(solConnect.accountStore).toBeTruthy()
expect(solConnect.accountsStore).toBeTruthy()
})

it("Provides supported tokens", async () => {
Expand Down