@xitadel-fi/sdk 0.1.3 → 0.1.5
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/dist/sdk/src/program.d.ts +53 -0
- package/dist/sdk/src/program.js +151 -12
- package/dist/sdk/src/utils.d.ts +2 -1
- package/dist/sdk/src/utils.js +10 -0
- package/dist/target/idl/xitadel.json +643 -16
- package/dist/target/types/xitadel.d.ts +643 -16
- package/package.json +1 -1
|
@@ -155,6 +155,7 @@ export declare class XitadelProgram {
|
|
|
155
155
|
chainlinkDataStreamDecimals: number;
|
|
156
156
|
chainlinkDataStreamVersion: number;
|
|
157
157
|
positionNftMintB: PublicKey;
|
|
158
|
+
stakedCollateralAmount: BN;
|
|
158
159
|
}>;
|
|
159
160
|
/**
|
|
160
161
|
* Helper method to get LP authority PDA
|
|
@@ -356,6 +357,7 @@ export declare class XitadelProgram {
|
|
|
356
357
|
chainlinkDataStreamDecimals: number;
|
|
357
358
|
chainlinkDataStreamVersion: number;
|
|
358
359
|
positionNftMintB: PublicKey;
|
|
360
|
+
stakedCollateralAmount: BN;
|
|
359
361
|
}>;
|
|
360
362
|
/**
|
|
361
363
|
* Redeem LTT tokens
|
|
@@ -442,4 +444,55 @@ export declare class XitadelProgram {
|
|
|
442
444
|
* @returns Transaction instruction for claiming fees
|
|
443
445
|
*/
|
|
444
446
|
claimFees(signer: PublicKey, lttId: PublicKey, positionNftMint: PublicKey, ammConfig: PublicKey, cpAmmProgramId: PublicKey, receiver: PublicKey): Promise<TransactionInstruction>;
|
|
447
|
+
/**
|
|
448
|
+
* Deposit stake to flash trade from collateral vault
|
|
449
|
+
* @param lttId The LTT ID
|
|
450
|
+
* @param authority The authority (manager or issuer) public key
|
|
451
|
+
* @param amount The amount to stake
|
|
452
|
+
* @param lpTokenMint The LP token mint
|
|
453
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
454
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
455
|
+
* @param pool The pool account from flash_trade
|
|
456
|
+
* @param transferAuthority The transfer authority account from flash_trade
|
|
457
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
458
|
+
* @param poolStakedLpVault The pool staked LP vault from flash_trade
|
|
459
|
+
* @param eventAuthority The event authority from flash_trade
|
|
460
|
+
* @returns Transaction instruction for depositing stake to flash trade
|
|
461
|
+
*/
|
|
462
|
+
depositStakeFlashTrade(lttId: PublicKey, authority: PublicKey, amount: BN, lpTokenMint: PublicKey, flashTradeProgramId: PublicKey, perpetuals: PublicKey, pool: PublicKey, transferAuthority: PublicKey, flpStakeAccount: PublicKey, poolStakedLpVault: PublicKey, eventAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
463
|
+
/**
|
|
464
|
+
* Claim flash trade fees to funding vault
|
|
465
|
+
* @param lttId The LTT ID
|
|
466
|
+
* @param authority The authority (manager or issuer) public key
|
|
467
|
+
* @param fundingTokenMint The funding token mint
|
|
468
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
469
|
+
* @param transferAuthority The transfer authority (ltt_configuration PDA)
|
|
470
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
471
|
+
* @param pool The pool account from flash_trade
|
|
472
|
+
* @param feeCustody The fee custody account from flash_trade
|
|
473
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
474
|
+
* @param feeCustodyTokenAccount The fee custody token account from flash_trade
|
|
475
|
+
* @param eventAuthority The event authority from flash_trade
|
|
476
|
+
* @param programPda The program PDA from flash_trade
|
|
477
|
+
* @param ixSysvar The instruction sysvar
|
|
478
|
+
* @returns Transaction instruction for claiming flash trade fees
|
|
479
|
+
*/
|
|
480
|
+
claimFlashTradeFees(lttId: PublicKey, authority: PublicKey, fundingTokenMint: PublicKey, flashTradeProgramId: PublicKey, transferAuthority: PublicKey, perpetuals: PublicKey, pool: PublicKey, feeCustody: PublicKey, flpStakeAccount: PublicKey, feeCustodyTokenAccount: PublicKey, eventAuthority: PublicKey, ixSysvar: PublicKey): Promise<TransactionInstruction>;
|
|
481
|
+
/**
|
|
482
|
+
* Withdraw stake from flash trade (unstake instant + withdraw stake)
|
|
483
|
+
* @param lttId The LTT ID
|
|
484
|
+
* @param authority The authority (manager or issuer) public key
|
|
485
|
+
* @param unstakeAmount The amount to unstake
|
|
486
|
+
* @param lpTokenMint The LP token mint
|
|
487
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
488
|
+
* @param transferAuthority The transfer authority account from flash_trade
|
|
489
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
490
|
+
* @param pool The pool account from flash_trade
|
|
491
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
492
|
+
* @param poolStakedLpVault The pool staked LP vault from flash_trade
|
|
493
|
+
* @param rewardCustody The reward custody account from flash_trade
|
|
494
|
+
* @param eventAuthority The event authority from flash_trade
|
|
495
|
+
* @returns Transaction instruction for withdrawing stake from flash trade
|
|
496
|
+
*/
|
|
497
|
+
withdrawStakeFlashTrade(lttId: PublicKey, authority: PublicKey, unstakeAmount: BN, lpTokenMint: PublicKey, flashTradeProgramId: PublicKey, transferAuthority: PublicKey, perpetuals: PublicKey, pool: PublicKey, flpStakeAccount: PublicKey, poolStakedLpVault: PublicKey, rewardCustody: PublicKey, eventAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
445
498
|
}
|
package/dist/sdk/src/program.js
CHANGED
|
@@ -165,7 +165,6 @@ class XitadelProgram {
|
|
|
165
165
|
*/
|
|
166
166
|
async fundLTT(lttId, investor, fundingAmount) {
|
|
167
167
|
const lttConfigPda = this.getLTTConfigPda(lttId);
|
|
168
|
-
const fundingRecordPda = this.getFundingRecordPda(lttConfigPda, investor);
|
|
169
168
|
const lttConfig = await this.program.account.lttConfiguration.fetch(lttConfigPda);
|
|
170
169
|
const fundingTokenMint = lttConfig.fundingTokenMint;
|
|
171
170
|
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(fundingTokenMint, lttConfigPda, true);
|
|
@@ -506,9 +505,6 @@ class XitadelProgram {
|
|
|
506
505
|
const lpAuthority = this.getLpAuthority();
|
|
507
506
|
const lttConfigPda = this.getLTTConfigPda(params.lttId);
|
|
508
507
|
const lttTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(params.lttId, lpAuthority, true);
|
|
509
|
-
const lpUsdcAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lpAuthority, true);
|
|
510
|
-
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lttConfigPda, true);
|
|
511
|
-
// console.log("lpAuthority", lpAuthority.toBase58());
|
|
512
508
|
const instructions = [];
|
|
513
509
|
// Create stable coin token account if it doesn't exist
|
|
514
510
|
const stableCoinVaultTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(params.stableCoinMint, lpAuthority, true);
|
|
@@ -572,29 +568,37 @@ class XitadelProgram {
|
|
|
572
568
|
recentSlot: await this.program.provider.connection.getSlot(),
|
|
573
569
|
});
|
|
574
570
|
const addresses = [
|
|
571
|
+
signer,
|
|
575
572
|
lttConfigPda,
|
|
576
573
|
lpAuthority,
|
|
577
574
|
poolAuthority,
|
|
575
|
+
pool,
|
|
576
|
+
poolb,
|
|
578
577
|
lpMint,
|
|
579
578
|
ammConfig,
|
|
580
579
|
ammConfigB,
|
|
581
580
|
params.lttId,
|
|
582
581
|
params.stableCoinMint,
|
|
583
|
-
|
|
584
|
-
lttVaultAta,
|
|
585
|
-
stableVaultAta,
|
|
586
|
-
lttTokenAccount,
|
|
587
|
-
lpUsdcAta,
|
|
582
|
+
fundingVaultTokenAccount,
|
|
588
583
|
lttVaultAta,
|
|
589
584
|
stableVaultAta,
|
|
590
585
|
lttVaultAtaB,
|
|
591
586
|
stableVaultAtaB,
|
|
592
|
-
|
|
593
|
-
|
|
587
|
+
payerLttTokenAccount,
|
|
588
|
+
payerStableCoinTokenAccount,
|
|
589
|
+
positionNftMintKeypair.publicKey,
|
|
590
|
+
positionNftMintKeypairB.publicKey,
|
|
591
|
+
positionNftAccount,
|
|
592
|
+
positionNftAccountB,
|
|
593
|
+
position,
|
|
594
|
+
positionB,
|
|
594
595
|
spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
595
596
|
web3_js_2.SystemProgram.programId,
|
|
597
|
+
collateralVaultAta,
|
|
598
|
+
spl_token_1.TOKEN_PROGRAM_ID,
|
|
596
599
|
spl_token_1.TOKEN_PROGRAM_ID,
|
|
597
600
|
spl_token_1.TOKEN_2022_PROGRAM_ID,
|
|
601
|
+
eventAuthority,
|
|
598
602
|
params.cpAmmProgramId,
|
|
599
603
|
web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
600
604
|
];
|
|
@@ -772,7 +776,6 @@ class XitadelProgram {
|
|
|
772
776
|
const managerFundingAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.fundingTokenMint, manager, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
773
777
|
const managerCollateralAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.collateralTokenMint, manager, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
774
778
|
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.fundingTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
775
|
-
const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.collateralTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
776
779
|
const interestVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lttConfig.fundingTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
777
780
|
const instructions = [];
|
|
778
781
|
// Create missing ATAs if needed
|
|
@@ -884,5 +887,141 @@ class XitadelProgram {
|
|
|
884
887
|
})
|
|
885
888
|
.instruction();
|
|
886
889
|
}
|
|
890
|
+
/**
|
|
891
|
+
* Deposit stake to flash trade from collateral vault
|
|
892
|
+
* @param lttId The LTT ID
|
|
893
|
+
* @param authority The authority (manager or issuer) public key
|
|
894
|
+
* @param amount The amount to stake
|
|
895
|
+
* @param lpTokenMint The LP token mint
|
|
896
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
897
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
898
|
+
* @param pool The pool account from flash_trade
|
|
899
|
+
* @param transferAuthority The transfer authority account from flash_trade
|
|
900
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
901
|
+
* @param poolStakedLpVault The pool staked LP vault from flash_trade
|
|
902
|
+
* @param eventAuthority The event authority from flash_trade
|
|
903
|
+
* @returns Transaction instruction for depositing stake to flash trade
|
|
904
|
+
*/
|
|
905
|
+
async depositStakeFlashTrade(lttId, authority, amount, lpTokenMint, flashTradeProgramId, perpetuals, pool, transferAuthority, flpStakeAccount, poolStakedLpVault, eventAuthority) {
|
|
906
|
+
const configPda = this.getConfigPda();
|
|
907
|
+
const lttConfigPda = this.getLTTConfigPda(lttId);
|
|
908
|
+
const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lpTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
909
|
+
return this.program.methods
|
|
910
|
+
.depositStakeFlashTrade(amount)
|
|
911
|
+
.accountsPartial({
|
|
912
|
+
lttConfiguration: lttConfigPda,
|
|
913
|
+
config: configPda,
|
|
914
|
+
authority: authority,
|
|
915
|
+
collateralVaultAta: collateralVaultAta,
|
|
916
|
+
lpTokenMint: lpTokenMint,
|
|
917
|
+
flashTradeProgram: flashTradeProgramId,
|
|
918
|
+
perpetuals: perpetuals,
|
|
919
|
+
pool: pool,
|
|
920
|
+
transferAuthority: transferAuthority,
|
|
921
|
+
flpStakeAccount: flpStakeAccount,
|
|
922
|
+
poolStakedLpVault: poolStakedLpVault,
|
|
923
|
+
eventAuthority: eventAuthority,
|
|
924
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
925
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
926
|
+
systemProgram: web3_js_2.SystemProgram.programId,
|
|
927
|
+
})
|
|
928
|
+
.instruction();
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Claim flash trade fees to funding vault
|
|
932
|
+
* @param lttId The LTT ID
|
|
933
|
+
* @param authority The authority (manager or issuer) public key
|
|
934
|
+
* @param fundingTokenMint The funding token mint
|
|
935
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
936
|
+
* @param transferAuthority The transfer authority (ltt_configuration PDA)
|
|
937
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
938
|
+
* @param pool The pool account from flash_trade
|
|
939
|
+
* @param feeCustody The fee custody account from flash_trade
|
|
940
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
941
|
+
* @param feeCustodyTokenAccount The fee custody token account from flash_trade
|
|
942
|
+
* @param eventAuthority The event authority from flash_trade
|
|
943
|
+
* @param programPda The program PDA from flash_trade
|
|
944
|
+
* @param ixSysvar The instruction sysvar
|
|
945
|
+
* @returns Transaction instruction for claiming flash trade fees
|
|
946
|
+
*/
|
|
947
|
+
async claimFlashTradeFees(lttId, authority, fundingTokenMint, flashTradeProgramId, transferAuthority, perpetuals, pool, feeCustody, flpStakeAccount, feeCustodyTokenAccount, eventAuthority, ixSysvar) {
|
|
948
|
+
const configPda = this.getConfigPda();
|
|
949
|
+
const lttConfigPda = this.getLTTConfigPda(lttId);
|
|
950
|
+
const fundingVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(fundingTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
951
|
+
return this.program.methods
|
|
952
|
+
.claimFlashTradeFees()
|
|
953
|
+
.accountsPartial({
|
|
954
|
+
lttConfiguration: lttConfigPda,
|
|
955
|
+
config: configPda,
|
|
956
|
+
authority: authority,
|
|
957
|
+
fundingVaultAta: fundingVaultAta,
|
|
958
|
+
fundingTokenMint: fundingTokenMint,
|
|
959
|
+
flashTradeProgram: flashTradeProgramId,
|
|
960
|
+
transferAuthority: transferAuthority,
|
|
961
|
+
perpetuals: perpetuals,
|
|
962
|
+
pool: pool,
|
|
963
|
+
feeCustody: feeCustody,
|
|
964
|
+
flpStakeAccount: flpStakeAccount,
|
|
965
|
+
feeCustodyTokenAccount: feeCustodyTokenAccount,
|
|
966
|
+
eventAuthority: eventAuthority,
|
|
967
|
+
ixSysvar: ixSysvar,
|
|
968
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
969
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
970
|
+
systemProgram: web3_js_2.SystemProgram.programId,
|
|
971
|
+
})
|
|
972
|
+
.instruction();
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Withdraw stake from flash trade (unstake instant + withdraw stake)
|
|
976
|
+
* @param lttId The LTT ID
|
|
977
|
+
* @param authority The authority (manager or issuer) public key
|
|
978
|
+
* @param unstakeAmount The amount to unstake
|
|
979
|
+
* @param lpTokenMint The LP token mint
|
|
980
|
+
* @param flashTradeProgramId The flash trade program ID
|
|
981
|
+
* @param transferAuthority The transfer authority account from flash_trade
|
|
982
|
+
* @param perpetuals The perpetuals account from flash_trade
|
|
983
|
+
* @param pool The pool account from flash_trade
|
|
984
|
+
* @param flpStakeAccount The FLP stake account from flash_trade
|
|
985
|
+
* @param poolStakedLpVault The pool staked LP vault from flash_trade
|
|
986
|
+
* @param rewardCustody The reward custody account from flash_trade
|
|
987
|
+
* @param eventAuthority The event authority from flash_trade
|
|
988
|
+
* @returns Transaction instruction for withdrawing stake from flash trade
|
|
989
|
+
*/
|
|
990
|
+
async withdrawStakeFlashTrade(lttId, authority, unstakeAmount, lpTokenMint, flashTradeProgramId, transferAuthority, perpetuals, pool, flpStakeAccount, poolStakedLpVault, rewardCustody, eventAuthority) {
|
|
991
|
+
const configPda = this.getConfigPda();
|
|
992
|
+
const lttConfigPda = this.getLTTConfigPda(lttId);
|
|
993
|
+
const collateralVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(lpTokenMint, lttConfigPda, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
994
|
+
const tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('token_stake'), lttConfigPda.toBuffer()], flashTradeProgramId)[0];
|
|
995
|
+
let tokenStakeAccounts = [];
|
|
996
|
+
if (tokenStakeAccount &&
|
|
997
|
+
(await (0, utils_1.checkIfAccountExists)(tokenStakeAccount, this.program.provider.connection))) {
|
|
998
|
+
tokenStakeAccounts.push({
|
|
999
|
+
pubkey: tokenStakeAccount,
|
|
1000
|
+
isSigner: false,
|
|
1001
|
+
isWritable: false,
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
return this.program.methods
|
|
1005
|
+
.withdrawStakeFlashTrade(unstakeAmount)
|
|
1006
|
+
.accountsPartial({
|
|
1007
|
+
lttConfiguration: lttConfigPda,
|
|
1008
|
+
config: configPda,
|
|
1009
|
+
authority: authority,
|
|
1010
|
+
collateralVaultAta: collateralVaultAta,
|
|
1011
|
+
lpTokenMint: lpTokenMint,
|
|
1012
|
+
flashTradeProgram: flashTradeProgramId,
|
|
1013
|
+
transferAuthority: transferAuthority,
|
|
1014
|
+
perpetuals: perpetuals,
|
|
1015
|
+
pool: pool,
|
|
1016
|
+
flpStakeAccount: flpStakeAccount,
|
|
1017
|
+
poolStakedLpVault: poolStakedLpVault,
|
|
1018
|
+
rewardCustody: rewardCustody,
|
|
1019
|
+
eventAuthority: eventAuthority,
|
|
1020
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1021
|
+
systemProgram: web3_js_2.SystemProgram.programId,
|
|
1022
|
+
})
|
|
1023
|
+
.remainingAccounts([...tokenStakeAccounts])
|
|
1024
|
+
.instruction();
|
|
1025
|
+
}
|
|
887
1026
|
}
|
|
888
1027
|
exports.XitadelProgram = XitadelProgram;
|
package/dist/sdk/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
|
1
|
+
import { PublicKey, Connection } from '@solana/web3.js';
|
|
2
2
|
import { BN } from '@coral-xyz/anchor';
|
|
3
3
|
export declare const getSqrtPriceFromPrice: (price: string, tokenADecimal: number, tokenBDecimal: number) => BN;
|
|
4
4
|
export declare const getFirstKey: (key1: PublicKey, key2: PublicKey) => PublicKey;
|
|
@@ -15,3 +15,4 @@ export declare const getLiquidityDelta: (params: {
|
|
|
15
15
|
sqrtPrice: BN;
|
|
16
16
|
}) => BN;
|
|
17
17
|
export declare function calculateTotalStableAmountRequiredForMaturity(lttSupply: any, lpSupplyAmount: any, stableInterestAmount: any, interestTokenDecimals: number): any;
|
|
18
|
+
export declare function checkIfAccountExists(account: PublicKey, connection: Connection): Promise<boolean>;
|
package/dist/sdk/src/utils.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.getLiquidityDelta = exports.getVaultPda = exports.derivePoolKey = export
|
|
|
7
7
|
exports.deriveProtocolFeeKey = deriveProtocolFeeKey;
|
|
8
8
|
exports.deriveMintMetadata = deriveMintMetadata;
|
|
9
9
|
exports.calculateTotalStableAmountRequiredForMaturity = calculateTotalStableAmountRequiredForMaturity;
|
|
10
|
+
exports.checkIfAccountExists = checkIfAccountExists;
|
|
10
11
|
const web3_js_1 = require("@solana/web3.js");
|
|
11
12
|
const constants_1 = require("./constants");
|
|
12
13
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
@@ -73,3 +74,12 @@ function calculateTotalStableAmountRequiredForMaturity(lttSupply, lpSupplyAmount
|
|
|
73
74
|
const initializeLpValue = normalizedLpSupply.mul(new anchor_1.BN(2));
|
|
74
75
|
return stableInterestAmount.add(normalizedLttSupply).sub(initializeLpValue);
|
|
75
76
|
}
|
|
77
|
+
async function checkIfAccountExists(account, connection) {
|
|
78
|
+
let bal = await connection.getBalance(account);
|
|
79
|
+
if (bal > 0) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|