Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnetwork committed Feb 29, 2024
1 parent ea78925 commit 366aaa3
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ void main() async {
authority: owner.address, recentSlot: BigInt.from(277777145));
final accountInfo = await QuickWalletForTest.rpc.request(
SolanaRPCGetAccountInfo(
account: tableAddress.address,
encoding: SolanaRPCEncoding.base64));
account: tableAddress.address, encoding: SolanaRPCEncoding.base64));
final tableAccount = AddressLookupTableAccount.fromBuffer(
accountData: accountInfo!.toBytesData(),
accountKey: tableAddress.address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ void main() async {
const SolanaRPCGetAccountInfo(
account: SolAddress.unchecked(
"527pWSWfeQGLM7SoyVXjCRkrSZBtDkH6ShEBJB3nUDkA")));
print(accountResponseInJson);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SolanaRPCGetTreeConfigAccount extends SolanaRPCRequest<TreeConfig?> {

@override
String get method => SolanaRPCMethods.getAccountInfo.value;
final SolAddress account;
final SolAddress account;

@override
List<dynamic> toJson() {
Expand Down
2 changes: 1 addition & 1 deletion lib/solana/src/instructions/name_service/name_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export 'utils/utils.dart';
export 'constant.dart';
export 'name_service_program_helper.dart';
export 'name_service_twitter_helper.dart';
export 'program.dart';
export 'program.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SolanaRPCGetMultisigAccount
if (result == null) return null;
final accountInfo = SolanaAccountInfo.fromJson(result);
return SolanaMultiSigAccount.fromBuffer(
address: account,
data: accountInfo.toBytesData());
address: account, data: accountInfo.toBytesData());
}
}
2 changes: 1 addition & 1 deletion lib/solana/src/instructions/spl_token/spl_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export 'types/types.dart';
export 'utils/utils.dart';
export 'spl_token_2022_extensions_program.dart';
export 'accounts/accounts.dart';
export 'rpcs/rpcs.dart';
export 'rpcs/rpcs.dart';
2 changes: 1 addition & 1 deletion lib/solana/src/instructions/stake/stake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export 'layouts/layouts.dart';
export 'constant.dart';
export 'accounts/accounts.dart';
export 'types/types.dart';
export 'rpcs/rpcs.dart';
export 'rpcs/rpcs.dart';
40 changes: 20 additions & 20 deletions lib/solana/src/instructions/stake_pool/program_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class StakePoolProgramHelper {
required SolAddress depositStake,
required SolAddress? poolTokenReceiverAccount,
}) async {
final stakePool = await rpc.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await rpc
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -92,8 +92,8 @@ class StakePoolProgramHelper {
throw MessageException('Not enough SOL to deposit into pool.');
}

final stakePool = await connection.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await connection
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -151,8 +151,8 @@ class StakePoolProgramHelper {
required BigInt poolAmountLamports,
SolAddress? solWithdrawAuthority,
}) async {
final stakePool = await connection.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await connection
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand All @@ -163,8 +163,8 @@ class StakePoolProgramHelper {
owner: tokenOwner,
);

final tokenAccount = await connection.request(
SolanaRPCGetAccountInfo(account: poolTokenAccount.address));
final tokenAccount = await connection
.request(SolanaRPCGetAccountInfo(account: poolTokenAccount.address));
if (tokenAccount == null) {
throw MessageException("Token account not found.");
}
Expand Down Expand Up @@ -224,8 +224,8 @@ class StakePoolProgramHelper {
required BigInt lamports,
BigInt? ephemeralStakeSeed,
}) async {
final stakePool = await connection.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await connection
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -314,8 +314,8 @@ class StakePoolProgramHelper {
BigInt lamports, {
BigInt? ephemeralStakeSeed,
}) async {
final stakePool = await connection.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await connection
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -478,8 +478,8 @@ class StakePoolProgramHelper {
required BigInt ephemeralStakeSeed,
required BigInt lamports,
}) async {
final stakePool = await connection.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await connection
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -553,8 +553,8 @@ class StakePoolProgramHelper {
required String symbol,
required String uri,
}) async {
final stakePool = await rpc.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await rpc
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -589,8 +589,8 @@ class StakePoolProgramHelper {
required String symbol,
required String uri,
}) async {
final stakePool = await rpc.request(
SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
final stakePool = await rpc
.request(SolanaRPCGetStakePoolAccount(address: stakePoolAddress));
if (stakePool == null) {
throw MessageException("Stake pool account does not found.");
}
Expand Down Expand Up @@ -685,8 +685,8 @@ class StakePoolProgramHelper {
// Sort from highest to lowest balance
accounts.sort(compareFn ?? (a, b) => b.lamports.compareTo(a.lamports));

final reserveStake = await connection.request(
SolanaRPCGetAccountInfo(account: stakePool.reserveStake));
final reserveStake = await connection
.request(SolanaRPCGetAccountInfo(account: stakePool.reserveStake));

final reserveStakeBalance =
(reserveStake?.lamports ?? BigInt.zero) - minBalanceForRentExemption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class SolanaRPCGetStakePoolAccount extends SolanaRPCRequest<StakePoolAccount?> {
if (result == null) return null;
final accountInfo = SolanaAccountInfo.fromJson(result);
return StakePoolAccount.fromBuffer(
data: accountInfo.toBytesData(),
address: address);
data: accountInfo.toBytesData(), address: address);
}
}
20 changes: 10 additions & 10 deletions test/solana/tests/address_table/compile_legacy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void _createLookupTable() {
type: TransactionType.legacy);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
// final decode = SolanaTransaction.decompile(transaction.serialize());

expect(unsigned,
Expand All @@ -61,8 +61,8 @@ void _freezeLookupTable() {
type: TransactionType.legacy);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"01000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc8901020201000401000000");
expect(signed,
Expand Down Expand Up @@ -95,8 +95,8 @@ void _extendLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"01000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc8901020201004c020000000200000000000000f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd763d0427568db5811754651851ae1b5823d52b700fc835078241871ab2b0ca505d");
expect(signed,
Expand All @@ -123,8 +123,8 @@ void _deactivateLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"01000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc8901020201000403000000");
expect(signed,
Expand Down Expand Up @@ -154,8 +154,8 @@ void _closeLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"01000104f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb3d0427568db5811754651851ae1b5823d52b700fc835078241871ab2b0ca505d0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc890103030100020404000000");
expect(signed,
Expand Down
20 changes: 10 additions & 10 deletions test/solana/tests/address_table/compile_v0_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void _createLookupTable() {
type: TransactionType.v0);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000204f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd767e2472c5129c3b712a778535721fc7490afae188b8719897cda512071501901e0277a6af97339b7ac88d1892c90446f50002309266f62e53c1182449820000000000000000000000000000000000000000000000000000000000000000000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc89010204010000030d00000000196c8e1000000000fe00");
expect(signed,
Expand All @@ -59,8 +59,8 @@ void _freezeLookupTable() {
type: TransactionType.v0);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc890102020100040100000000");
expect(signed,
Expand Down Expand Up @@ -93,8 +93,8 @@ void _extendLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc8901020201004c020000000200000000000000f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd763d0427568db5811754651851ae1b5823d52b700fc835078241871ab2b0ca505d00");
expect(signed,
Expand All @@ -121,8 +121,8 @@ void _deactivateLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000103f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc890102020100040300000000");
expect(signed,
Expand Down Expand Up @@ -152,8 +152,8 @@ void _closeLookupTable() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000104f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd760e662ddb6836d891e4d1d6d13086c47007011e0dbcc953c7f197de1c75a377bb3d0427568db5811754651851ae1b5823d52b700fc835078241871ab2b0ca505d0277a6af97339b7ac88d1892c90446f50002309266f62e53c118244982000000e66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc89010303010002040400000000");
expect(signed,
Expand Down
20 changes: 10 additions & 10 deletions test/solana/tests/name_service/compile_legacy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void _create() {
type: TransactionType.legacy);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -73,8 +73,8 @@ void _update() {
type: TransactionType.legacy);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -107,8 +107,8 @@ void _transfer() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -139,8 +139,8 @@ void _delete() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -172,8 +172,8 @@ void _realloc() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down
20 changes: 10 additions & 10 deletions test/solana/tests/name_service/compile_v0_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void _create() {
type: TransactionType.v0);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -73,8 +73,8 @@ void _update() {
type: TransactionType.v0);
final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -107,8 +107,8 @@ void _transfer() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down Expand Up @@ -139,8 +139,8 @@ void _delete() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
expect(unsigned,
"8001000104f6c1dacc8b174b10dac187bb1ee7fed819b77e84591dc1827dc38943a5dbbd763d0427568db5811754651851ae1b5823d52b700fc835078241871ab2b0ca505ded4b474820db73c8c296fccf275489da999d74ced22bd13a1cfa8b787857e9b30bad51f413c1f3a99460d900d8bf2ed6927eca34d7b7842bf810a973082d1edce66f07ae6ad93c9ea60272507db1a2d2089bbb67540ff6e291f98bcf5df4bc89010303010002010300");
expect(signed,
Expand Down Expand Up @@ -169,8 +169,8 @@ void _realloc() {

final unsigned = transaction.serializeMessageString();
transaction.sign([owner.privateKey]);
final signed = transaction.serializeString(
encoding: TransactionSerializeEncoding.hex);
final signed =
transaction.serializeString(encoding: TransactionSerializeEncoding.hex);
final decodeTransaction =
SolanaTransaction.deserialize(transaction.serialize());
expect(decodeTransaction.serialize(), transaction.serialize());
Expand Down
Loading

0 comments on commit 366aaa3

Please sign in to comment.