-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
022fee7
commit 9ed6732
Showing
156 changed files
with
16,736 additions
and
1,280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[profile.default] | ||
retries = { backoff = "exponential", count = 5, delay = "1s", jitter = true, max-delay = "10s" } | ||
# retries = { backoff = "exponential", count = 3, delay = "10ms", jitter = true, max-delay = "100ms" } | ||
test-threads = "num-cpus" | ||
threads-required = 1 | ||
fail-fast = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/target | ||
|
||
.developer | ||
node_modules | ||
node_modules | ||
|
||
# Debugging | ||
program_errors.json | ||
test_errors.output | ||
tests.output |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
clients/js/jito_tip_router/accounts/baseRewardRouter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/kinobi-so/kinobi | ||
*/ | ||
|
||
import { | ||
assertAccountExists, | ||
assertAccountsExist, | ||
combineCodec, | ||
decodeAccount, | ||
fetchEncodedAccount, | ||
fetchEncodedAccounts, | ||
getAddressDecoder, | ||
getAddressEncoder, | ||
getArrayDecoder, | ||
getArrayEncoder, | ||
getStructDecoder, | ||
getStructEncoder, | ||
getU64Decoder, | ||
getU64Encoder, | ||
getU8Decoder, | ||
getU8Encoder, | ||
type Account, | ||
type Address, | ||
type Codec, | ||
type Decoder, | ||
type EncodedAccount, | ||
type Encoder, | ||
type FetchAccountConfig, | ||
type FetchAccountsConfig, | ||
type MaybeAccount, | ||
type MaybeEncodedAccount, | ||
} from '@solana/web3.js'; | ||
import { | ||
getBaseRewardRouterRewardsDecoder, | ||
getBaseRewardRouterRewardsEncoder, | ||
getNcnRewardRouteDecoder, | ||
getNcnRewardRouteEncoder, | ||
type BaseRewardRouterRewards, | ||
type BaseRewardRouterRewardsArgs, | ||
type NcnRewardRoute, | ||
type NcnRewardRouteArgs, | ||
} from '../types'; | ||
|
||
export type BaseRewardRouter = { | ||
discriminator: bigint; | ||
ncn: Address; | ||
ncnEpoch: bigint; | ||
bump: number; | ||
slotCreated: bigint; | ||
totalRewards: bigint; | ||
rewardPool: bigint; | ||
rewardsProcessed: bigint; | ||
reserved: Array<number>; | ||
baseFeeGroupRewards: Array<BaseRewardRouterRewards>; | ||
ncnFeeGroupRewards: Array<BaseRewardRouterRewards>; | ||
ncnFeeGroupRewardRoutes: Array<NcnRewardRoute>; | ||
}; | ||
|
||
export type BaseRewardRouterArgs = { | ||
discriminator: number | bigint; | ||
ncn: Address; | ||
ncnEpoch: number | bigint; | ||
bump: number; | ||
slotCreated: number | bigint; | ||
totalRewards: number | bigint; | ||
rewardPool: number | bigint; | ||
rewardsProcessed: number | bigint; | ||
reserved: Array<number>; | ||
baseFeeGroupRewards: Array<BaseRewardRouterRewardsArgs>; | ||
ncnFeeGroupRewards: Array<BaseRewardRouterRewardsArgs>; | ||
ncnFeeGroupRewardRoutes: Array<NcnRewardRouteArgs>; | ||
}; | ||
|
||
export function getBaseRewardRouterEncoder(): Encoder<BaseRewardRouterArgs> { | ||
return getStructEncoder([ | ||
['discriminator', getU64Encoder()], | ||
['ncn', getAddressEncoder()], | ||
['ncnEpoch', getU64Encoder()], | ||
['bump', getU8Encoder()], | ||
['slotCreated', getU64Encoder()], | ||
['totalRewards', getU64Encoder()], | ||
['rewardPool', getU64Encoder()], | ||
['rewardsProcessed', getU64Encoder()], | ||
['reserved', getArrayEncoder(getU8Encoder(), { size: 128 })], | ||
[ | ||
'baseFeeGroupRewards', | ||
getArrayEncoder(getBaseRewardRouterRewardsEncoder(), { size: 8 }), | ||
], | ||
[ | ||
'ncnFeeGroupRewards', | ||
getArrayEncoder(getBaseRewardRouterRewardsEncoder(), { size: 8 }), | ||
], | ||
[ | ||
'ncnFeeGroupRewardRoutes', | ||
getArrayEncoder(getNcnRewardRouteEncoder(), { size: 32 }), | ||
], | ||
]); | ||
} | ||
|
||
export function getBaseRewardRouterDecoder(): Decoder<BaseRewardRouter> { | ||
return getStructDecoder([ | ||
['discriminator', getU64Decoder()], | ||
['ncn', getAddressDecoder()], | ||
['ncnEpoch', getU64Decoder()], | ||
['bump', getU8Decoder()], | ||
['slotCreated', getU64Decoder()], | ||
['totalRewards', getU64Decoder()], | ||
['rewardPool', getU64Decoder()], | ||
['rewardsProcessed', getU64Decoder()], | ||
['reserved', getArrayDecoder(getU8Decoder(), { size: 128 })], | ||
[ | ||
'baseFeeGroupRewards', | ||
getArrayDecoder(getBaseRewardRouterRewardsDecoder(), { size: 8 }), | ||
], | ||
[ | ||
'ncnFeeGroupRewards', | ||
getArrayDecoder(getBaseRewardRouterRewardsDecoder(), { size: 8 }), | ||
], | ||
[ | ||
'ncnFeeGroupRewardRoutes', | ||
getArrayDecoder(getNcnRewardRouteDecoder(), { size: 32 }), | ||
], | ||
]); | ||
} | ||
|
||
export function getBaseRewardRouterCodec(): Codec< | ||
BaseRewardRouterArgs, | ||
BaseRewardRouter | ||
> { | ||
return combineCodec( | ||
getBaseRewardRouterEncoder(), | ||
getBaseRewardRouterDecoder() | ||
); | ||
} | ||
|
||
export function decodeBaseRewardRouter<TAddress extends string = string>( | ||
encodedAccount: EncodedAccount<TAddress> | ||
): Account<BaseRewardRouter, TAddress>; | ||
export function decodeBaseRewardRouter<TAddress extends string = string>( | ||
encodedAccount: MaybeEncodedAccount<TAddress> | ||
): MaybeAccount<BaseRewardRouter, TAddress>; | ||
export function decodeBaseRewardRouter<TAddress extends string = string>( | ||
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress> | ||
): | ||
| Account<BaseRewardRouter, TAddress> | ||
| MaybeAccount<BaseRewardRouter, TAddress> { | ||
return decodeAccount( | ||
encodedAccount as MaybeEncodedAccount<TAddress>, | ||
getBaseRewardRouterDecoder() | ||
); | ||
} | ||
|
||
export async function fetchBaseRewardRouter<TAddress extends string = string>( | ||
rpc: Parameters<typeof fetchEncodedAccount>[0], | ||
address: Address<TAddress>, | ||
config?: FetchAccountConfig | ||
): Promise<Account<BaseRewardRouter, TAddress>> { | ||
const maybeAccount = await fetchMaybeBaseRewardRouter(rpc, address, config); | ||
assertAccountExists(maybeAccount); | ||
return maybeAccount; | ||
} | ||
|
||
export async function fetchMaybeBaseRewardRouter< | ||
TAddress extends string = string, | ||
>( | ||
rpc: Parameters<typeof fetchEncodedAccount>[0], | ||
address: Address<TAddress>, | ||
config?: FetchAccountConfig | ||
): Promise<MaybeAccount<BaseRewardRouter, TAddress>> { | ||
const maybeAccount = await fetchEncodedAccount(rpc, address, config); | ||
return decodeBaseRewardRouter(maybeAccount); | ||
} | ||
|
||
export async function fetchAllBaseRewardRouter( | ||
rpc: Parameters<typeof fetchEncodedAccounts>[0], | ||
addresses: Array<Address>, | ||
config?: FetchAccountsConfig | ||
): Promise<Account<BaseRewardRouter>[]> { | ||
const maybeAccounts = await fetchAllMaybeBaseRewardRouter( | ||
rpc, | ||
addresses, | ||
config | ||
); | ||
assertAccountsExist(maybeAccounts); | ||
return maybeAccounts; | ||
} | ||
|
||
export async function fetchAllMaybeBaseRewardRouter( | ||
rpc: Parameters<typeof fetchEncodedAccounts>[0], | ||
addresses: Array<Address>, | ||
config?: FetchAccountsConfig | ||
): Promise<MaybeAccount<BaseRewardRouter>[]> { | ||
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); | ||
return maybeAccounts.map((maybeAccount) => | ||
decodeBaseRewardRouter(maybeAccount) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.