Skip to content

Commit

Permalink
Merge pull request #75 from ar-io/ao-cu-url
Browse files Browse the repository at this point in the history
chore(ao): add ao cu url from gh vars
  • Loading branch information
kunstmusik authored Sep 12, 2024
2 parents e16f3f5 + 52cd5cc commit ab992e8
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 23 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,6 +49,8 @@ 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 }}
# ao infra settings
VITE_AO_CU_URL: ${{ vars.VITE_AO_CU_URL }}
- name: Add CNAME Record
run: |
echo ${{ vars.DOMAIN_NAME }} > dist/CNAME
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
step: [
'lint:check',
'test',
'build',
]
step: ['lint:check', 'test', 'build']
steps:
- uses: actions/checkout@v3
- run: yarn install --frozen-lockfile
Expand Down Expand Up @@ -40,6 +36,7 @@ jobs:
VITE_SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}

VITE_GITHUB_HASH: ${{ github.sha }}
VITE_AO_CU_URL: ${{ vars.VITE_AO_CU_URL }}

# Disribute to Firebase
- name: Deploy 🚀
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,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@v3
Expand Down Expand Up @@ -51,6 +47,7 @@ jobs:
VITE_SENTRY_DSN_PROJECT_ID: ${{ secrets.SENTRY_DSN_PROJECT_ID }}
VITE_GITHUB_HASH: ${{ github.sha }}
VITE_IO_PROCESS_ID: ${{ secrets.IO_PROCESS_ID }}
VITE_AO_CU_URL: ${{ vars.VITE_AO_CU_URL }}

# Disribute to Firebase
- name: Deploy 🚀
Expand All @@ -63,7 +60,7 @@ jobs:
deploy-to-arweave:
runs-on: ubuntu-latest
needs: build
environment: production
environment: production
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -75,7 +72,7 @@ jobs:
- name: Install, Build, and Deploy 🔧
run: |
yarn install --frozen-lockfile
yarn deploy
yarn deploy
env:
# FOR BUILD
VITE_NODE_ENV: production
Expand Down
12 changes: 9 additions & 3 deletions src/components/WalletProvider.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`;

Expand Down
21 changes: 18 additions & 3 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -99,7 +114,7 @@ export class GlobalStateActionBase implements GlobalStateActions {

setTicker = (ticker: string) => {
this.set({ ticker });
}
};
}

export interface GlobalStateInterface extends GlobalState, GlobalStateActions {}
Expand Down
2 changes: 2 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ab992e8

Please sign in to comment.