File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11export interface Market {
2- id : u64 ;
2+ id : number ;
33 creator : string ;
44 title : string ;
55 description : string ;
6- end_time : u64 ;
6+ end_time : number ;
77 outcomes : string [ ] ;
88 resolved : boolean ;
99}
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ export const STELLAR_NETWORK = {
44 rpcUrl : "https://soroban-testnet.stellar.org" ,
55} ;
66
7+ // Access environment variable safely at runtime
78// NEXT_PUBLIC_ variables are injected at build time by Next.js
8- const getContractId = ( ) => {
9- // @ts -expect-error - process.env is injected by Next.js
10- return typeof process !== "undefined" ? process . env . NEXT_PUBLIC_CONTRACT_ID : "" ;
11- } ;
12-
13- export const CONTRACT_ID = getContractId ( ) || "" ;
9+ export const CONTRACT_ID = ( ( ) => {
10+ if ( typeof globalThis === "undefined" ) return "" ;
11+ const env = ( globalThis as any ) . process ?. env ;
12+ return env ?. NEXT_PUBLIC_CONTRACT_ID || "" ;
13+ } ) ( ) ;
Original file line number Diff line number Diff line change @@ -5,14 +5,18 @@ export type FreighterConnection = {
55} ;
66
77export async function isFreighterInstalled ( ) : Promise < boolean > {
8- return await FreighterApi . isConnected ( ) ;
8+ try {
9+ return await FreighterApi . isAllowed ( ) ;
10+ } catch {
11+ return false ;
12+ }
913}
1014
1115export async function connectFreighter ( ) : Promise < FreighterConnection | null > {
1216 try {
1317 const installed = await isFreighterInstalled ( ) ;
1418 if ( ! installed ) {
15- throw new Error ( "Freighter wallet is not installed" ) ;
19+ throw new Error ( "Freighter wallet is not installed or not allowed " ) ;
1620 }
1721
1822 const publicKey = await FreighterApi . getPublicKey ( ) ;
@@ -36,10 +40,10 @@ export async function signTransaction(
3640 transactionXdr : string
3741) : Promise < string | null > {
3842 try {
39- const signedXdr = await FreighterApi . signTransaction ( transactionXdr , {
40- network : "TESTNET " ,
43+ const signedTxXdr = await FreighterApi . signTransaction ( transactionXdr , {
44+ networkPassphrase : "Test SDF Network ; September 2015 " ,
4145 } ) ;
42- return signedXdr ;
46+ return signedTxXdr ;
4347 } catch ( error ) {
4448 console . error ( "Transaction signing error:" , error ) ;
4549 return null ;
You can’t perform that action at this time.
0 commit comments