-
Notifications
You must be signed in to change notification settings - Fork 18
feat(svmSpokeUtils): get fill deadline buffer implementation #978
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
Changes from 4 commits
7cd664b
9cf2918
fe2b225
d7e3dd6
d37346b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,4 +209,8 @@ export class SvmSpokeEventsClient { | |
|
||
return events; | ||
} | ||
|
||
public getSvmSpokeAddress(): Address { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
return this.svmSpokeAddress; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { BN, BorshEventCoder, Idl } from "@coral-xyz/anchor"; | ||
import web3, { address, RpcTransport } from "@solana/kit"; | ||
import web3, { address, getProgramDerivedAddress, getU64Encoder, Address, RpcTransport } from "@solana/kit"; | ||
|
||
import { EventName, EventData, SVMEventNames } from "./types"; | ||
|
||
/** | ||
|
@@ -64,3 +65,19 @@ export function getEventName(rawName: string): EventName { | |
if (Object.values(SVMEventNames).some((name) => rawName.includes(name))) return rawName as EventName; | ||
throw new Error(`Unknown event name: ${rawName}`); | ||
} | ||
|
||
/** | ||
* Returns the PDA for the State account. | ||
* @param programId The SpokePool program ID. | ||
* @param extraSeed An optional extra seed. Defaults to 0. | ||
* @returns The PDA for the State account. | ||
*/ | ||
export async function getStatePda(programId: Address, extraSeed = 0): Promise<Address> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OOC how often is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for state pda it'll always be zero. I removed it here: d37346b |
||
const seedEncoder = getU64Encoder(); | ||
const encodedExtraSeed = seedEncoder.encode(extraSeed); | ||
const [statePda] = await getProgramDerivedAddress({ | ||
programAddress: programId, | ||
seeds: ["state", encodedExtraSeed], | ||
}); | ||
return statePda; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.