ts: Add associated client code (#626)
This commit is contained in:
parent
541dbfbe37
commit
3be29425ac
|
@ -241,6 +241,25 @@ export class AccountClient {
|
|||
programId: this._programId,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Function returning the associated account. Args are keys to associate.
|
||||
* Order matters.
|
||||
*/
|
||||
async associated(...args: Array<PublicKey | Buffer>): Promise<any> {
|
||||
const addr = await this.associatedAddress(...args);
|
||||
return await this.fetch(addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function returning the associated address. Args are keys to associate.
|
||||
* Order matters.
|
||||
*/
|
||||
async associatedAddress(
|
||||
...args: Array<PublicKey | Buffer>
|
||||
): Promise<PublicKey> {
|
||||
return await pubkeyUtil.associated(this._programId, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue