@@ -10,6 +10,7 @@ import {
10
10
TransactionInstruction ,
11
11
} from "@solana/web3.js" ;
12
12
import { PRICE_FEED_OPS_KEY } from "./multisig" ;
13
+ import { isRemoteCluster } from "./cluster" ;
13
14
14
15
/**
15
16
* Get seed for deterministic creation of a price/product account
@@ -33,10 +34,17 @@ function getSeed(accountType: AccountType, symbol: string): string {
33
34
* @param accountType Type of the account
34
35
* @returns
35
36
*/
36
- function getAccountTypeSize ( accountType : AccountType ) : number {
37
+ function getAccountTypeSize (
38
+ accountType : AccountType ,
39
+ cluster : PythCluster
40
+ ) : number {
37
41
switch ( accountType ) {
38
42
case AccountType . Price :
39
- return 3312 ;
43
+ if ( isRemoteCluster ( cluster ) ) {
44
+ return 12576 ;
45
+ } else {
46
+ return 3312 ;
47
+ }
40
48
case AccountType . Product :
41
49
return 512 ;
42
50
default :
@@ -88,9 +96,9 @@ export async function getCreateAccountWithSeedInstruction(
88
96
basePubkey : base ,
89
97
newAccountPubkey : address ,
90
98
seed : seed ,
91
- space : getAccountTypeSize ( accountType ) ,
99
+ space : getAccountTypeSize ( accountType , cluster ) ,
92
100
lamports : await connection . getMinimumBalanceForRentExemption (
93
- getAccountTypeSize ( accountType )
101
+ getAccountTypeSize ( accountType , cluster )
94
102
) ,
95
103
programId : getPythProgramKeyForCluster ( cluster ) ,
96
104
} ) ;
0 commit comments