@@ -10,6 +10,7 @@ import {
1010 TransactionInstruction ,
1111} from "@solana/web3.js" ;
1212import { PRICE_FEED_OPS_KEY } from "./multisig" ;
13+ import { isRemoteCluster } from "./cluster" ;
1314
1415/**
1516 * Get seed for deterministic creation of a price/product account
@@ -33,10 +34,17 @@ function getSeed(accountType: AccountType, symbol: string): string {
3334 * @param accountType Type of the account
3435 * @returns
3536 */
36- function getAccountTypeSize ( accountType : AccountType ) : number {
37+ function getAccountTypeSize (
38+ accountType : AccountType ,
39+ cluster : PythCluster
40+ ) : number {
3741 switch ( accountType ) {
3842 case AccountType . Price :
39- return 3312 ;
43+ if ( isRemoteCluster ( cluster ) ) {
44+ return 12576 ;
45+ } else {
46+ return 3312 ;
47+ }
4048 case AccountType . Product :
4149 return 512 ;
4250 default :
@@ -88,9 +96,9 @@ export async function getCreateAccountWithSeedInstruction(
8896 basePubkey : base ,
8997 newAccountPubkey : address ,
9098 seed : seed ,
91- space : getAccountTypeSize ( accountType ) ,
99+ space : getAccountTypeSize ( accountType , cluster ) ,
92100 lamports : await connection . getMinimumBalanceForRentExemption (
93- getAccountTypeSize ( accountType )
101+ getAccountTypeSize ( accountType , cluster )
94102 ) ,
95103 programId : getPythProgramKeyForCluster ( cluster ) ,
96104 } ) ;
0 commit comments