( auth: web3.PublicKey, appId: number, programId: web3.PublicKey )
| 32 | } |
| 33 | |
| 34 | export function findAppAddress( |
| 35 | auth: web3.PublicKey, |
| 36 | appId: number, |
| 37 | programId: web3.PublicKey |
| 38 | ) { |
| 39 | return web3.PublicKey.findProgramAddressSync( |
| 40 | [ |
| 41 | Buffer.from("APP"), |
| 42 | auth.toBuffer(), |
| 43 | new BN(appId).toArrayLike(Buffer, "be", 1), |
| 44 | ], |
| 45 | programId |
| 46 | ) |
| 47 | } |
| 48 | |
| 49 | export function numberToAppId(appId: number): Buffer { |
| 50 | return new BN(appId).toArrayLike(Buffer, "be", 1) |