diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 2f1e656b..c29bb014 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -10,11 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - step: [ - 'lint:check', - 'test', - 'build', - ] + step: ['lint:check', 'test', 'build'] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v2 @@ -53,6 +49,7 @@ jobs: VITE_SENTRY_DSN_PROJECT_URI: ${{ secrets.SENTRY_DSN_PROJECT_URI }} VITE_SENTRY_DSN_PROJECT_ID: ${{ secrets.SENTRY_DSN_PROJECT_ID }} VITE_GITHUB_HASH: ${{ github.sha }} + VITE_AO_CU_URL: ${{ vars.VITE_AO_CU_URL }} - name: Add CNAME Record run: | echo ${{ vars.DOMAIN_NAME }} > dist/CNAME diff --git a/src/components/WalletProvider.tsx b/src/components/WalletProvider.tsx index 20ce9b5b..56a3912f 100644 --- a/src/components/WalletProvider.tsx +++ b/src/components/WalletProvider.tsx @@ -1,5 +1,6 @@ -import { IO, mIOToken } from '@ar.io/sdk/web'; -import { IO_PROCESS_ID } from '@src/constants'; +import { AOProcess, IO, mIOToken } from '@ar.io/sdk/web'; +import { connect } from '@permaweb/aoconnect'; +import { AO_CU_URL, IO_PROCESS_ID } from '@src/constants'; import { useEffectOnce } from '@src/hooks/useEffectOnce'; import { ArConnectWalletConnector } from '@src/services/wallets/ArConnectWalletConnector'; import { useGlobalState } from '@src/store'; @@ -70,8 +71,13 @@ const WalletProvider = ({ children }: { children: ReactElement }) => { if (signer) { const writeable = IO.init({ - processId: IO_PROCESS_ID.toString(), signer, + process: new AOProcess({ + processId: IO_PROCESS_ID.toString(), + ao: connect({ + CU_URL: AO_CU_URL, + }), + }), }); setArIOWriteableSDK(writeable); } diff --git a/src/constants.ts b/src/constants.ts index 35ebeabd..34820e0e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -19,6 +19,8 @@ export const ARIO_DOCS_URL = 'https://docs.ar.io'; export const IO_PROCESS_ID = new ArweaveTransactionID( process.env.VITE_IO_PROCESS_ID ?? ioDevnetProcessId, ); +export const AO_CU_URL = + process.env.VITE_AO_CU_URL || 'https://cu.ao-testnet.xyz'; export const IO_PROCESS_INFO_URL = `https://www.ao.link/#/entity/${IO_PROCESS_ID.toString()}`; diff --git a/src/store/index.ts b/src/store/index.ts index d1d446db..241116a6 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,5 +1,13 @@ -import { AoEpochData, AoIORead, AoIOWrite, IO } from '@ar.io/sdk/web'; import { + AOProcess, + AoEpochData, + AoIORead, + AoIOWrite, + IO, +} from '@ar.io/sdk/web'; +import { connect } from '@permaweb/aoconnect'; +import { + AO_CU_URL, DEFAULT_ARWEAVE_HOST, DEFAULT_ARWEAVE_PORT, DEFAULT_ARWEAVE_PROTOCOL, @@ -51,7 +59,14 @@ export const initialGlobalState: GlobalState = { protocol: DEFAULT_ARWEAVE_PROTOCOL, port: DEFAULT_ARWEAVE_PORT, }), - arIOReadSDK: IO.init({ processId: IO_PROCESS_ID.toString() }), + arIOReadSDK: IO.init({ + process: new AOProcess({ + processId: IO_PROCESS_ID.toString(), + ao: connect({ + CU_URL: AO_CU_URL, + }), + }), + }), balances: { ar: 0, io: 0, @@ -99,7 +114,7 @@ export class GlobalStateActionBase implements GlobalStateActions { setTicker = (ticker: string) => { this.set({ ticker }); - } + }; } export interface GlobalStateInterface extends GlobalState, GlobalStateActions {} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 9118ff80..d90faa2b 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -8,6 +8,8 @@ interface ImportMetaEnv { readonly VITE_SENTRY_DSN_PROJECT_ID: string; readonly VITE_NODE_ENV: string; readonly VITE_GITHUB_HASH: string; + readonly VITE_IO_PROCESS_ID: string; + readonly VITE_AO_CU_URL: string; } interface ImportMeta {