-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup widgets and bootstrap account (#214)
I have setup 4 accounts `widgets.treasury-factory.near` for all widgets `bootstrap.treasury-factory.near` for initial/template (app.jsx) widgets and for testing: `test-widgets.treasury-factory.near` `test-bootstrap.treasury-factory.near` Things to note: 1) The testing accounts folder is symlinked to the prod account, so we only need to make changes in prod account folder 2) The testing instances is linked to testing widgets account (`test-widgets.treasury-factory.near`) while prod instances are linked to prod 3) After merging this PR, we should start raising PR against `staging` branch (I will change the rules of the repo), which will deploy to testing instances, widget and bootstrap account, and once everything is tested we can create PR against `main` which will deploy to all prod accounts 4) The reference widget for the self create flow will be `bootstrap.treasury-factory.near` for prod and `test-bootstrap.treasury-factory.near` for testing.
- Loading branch information
1 parent
b80b765
commit c9c82e4
Showing
116 changed files
with
454 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Deploy Components to Staging | ||
|
||
on: | ||
push: | ||
branches: [staging] | ||
|
||
jobs: | ||
deploy-widgets: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target_account: | ||
- environment: treasury-testing.near | ||
deploy_command: npm run deploy:testing | ||
- environment: treasury-testing-infinex.near | ||
deploy_command: npm run deploy:infinex-testing | ||
- environment: test-widgets.treasury-factory.near | ||
deploy_command: npm run deploy:test-widgets | ||
- environment: test-bootstrap.treasury-factory.near | ||
deploy_command: npm run deploy:test-bootstrap | ||
environment: ${{ matrix.target_account.environment }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/bos-cli-rs/bos-cli-rs/releases/download/v0.3.15/bos-cli-installer.sh | sh | ||
- name: Deploy widgets | ||
run: | | ||
${{ matrix.target_account.deploy_command }} -- '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Dry-run staging | ||
|
||
on: | ||
pull_request: | ||
branches: [staging] | ||
|
||
jobs: | ||
deploy-widgets: | ||
name: Diff from PR | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target_account: | ||
- dry_run_command: npm run dry-run:testing | ||
- dry_run_command: npm run dry-run:infinex-testing | ||
- dry_run_command: npm run dry-run:test-widgets | ||
- dry_run_command: npm run dry-run:test-bootstrap | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/bos-cli-rs/bos-cli-rs/releases/download/v0.3.15/bos-cli-installer.sh | sh | ||
- name: Dry-run widgets | ||
run: | | ||
${{ matrix.target_account.dry_run_command }} |
3 changes: 3 additions & 0 deletions
3
instances/bootstrap.treasury-factory.near/aliases.mainnet.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "widgets.treasury-factory.near" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"account": "bootstrap.treasury-factory.near", | ||
"aliasPrefix": "REPL", | ||
"aliasesContainsPrefix": true, | ||
"aliases": ["./aliases.mainnet.json"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"bootstrap.treasury-factory.near": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
widget |
108 changes: 108 additions & 0 deletions
108
instances/bootstrap.treasury-factory.near/widget/app.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* This is the main entry point for the Treasury application. | ||
* Page route gets passed in through params, along with all other page props. | ||
*/ | ||
|
||
const { page, ...passProps } = props; | ||
|
||
// Import our modules | ||
const { AppLayout } = VM.require( | ||
"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/components.templates.AppLayout" | ||
) || { AppLayout: () => <></> }; | ||
|
||
const instance = context.widgetSrc?.split("/")[0] ?? "treasury-testing.near"; | ||
const treasuryDaoID = | ||
instance.split(".near")[0] ?? "testing-astradao" + "sputnik-dao.near"; | ||
const { Theme } = VM.require(`${instance}/widget/config.css`) || { | ||
Theme: () => <></>, | ||
}; | ||
|
||
if (!page) { | ||
// If no page is specified, we default to the feed page TEMP | ||
page = "dashboard"; | ||
} | ||
|
||
const propsToSend = { ...passProps, instance: instance }; | ||
|
||
// This is our navigation, rendering the page based on the page parameter | ||
function Page() { | ||
const routes = page.split("."); | ||
switch (routes[0]) { | ||
case "dashboard": { | ||
return ( | ||
<Widget | ||
src="${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.dashboard.index" | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
// ?page=settings | ||
case "settings": { | ||
return ( | ||
<Widget | ||
src={"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.settings.index"} | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
case "payments": { | ||
return ( | ||
<Widget | ||
src={"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.payments.index"} | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
|
||
case "stake-delegation": { | ||
return ( | ||
<Widget | ||
src={ | ||
"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.stake-delegation.index" | ||
} | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
|
||
case "asset-exchange": { | ||
return ( | ||
<Widget | ||
src={ | ||
"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.asset-exchange.index" | ||
} | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
|
||
case "proposals-feed": { | ||
return ( | ||
<Widget | ||
src={ | ||
"${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/pages.proposals-feed.index" | ||
} | ||
props={propsToSend} | ||
/> | ||
); | ||
} | ||
|
||
default: { | ||
// TODO: 404 page | ||
return <p>404</p>; | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<Theme> | ||
<AppLayout | ||
page={page} | ||
instance={instance} | ||
treasuryDaoID={treasuryDaoID} | ||
accountId={context.accountId} | ||
> | ||
<Page /> | ||
</AppLayout> | ||
</Theme> | ||
); |
27 changes: 27 additions & 0 deletions
27
instances/bootstrap.treasury-factory.near/widget/config/data.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const sputnikAccount = | ||
context.widgetSrc?.split("/")[0].split(".near")[0] ?? | ||
"testing-astradao" + "sputnik-dao.near"; | ||
return { | ||
navbarLinks: [ | ||
{ | ||
title: "Dashboard", | ||
href: "?page=dashboard", | ||
}, | ||
{ | ||
title: "Payments", | ||
href: "?page=payments", | ||
}, | ||
{ | ||
title: "Stake Delegation", | ||
href: "?page=stake-delegation", | ||
}, | ||
{ | ||
title: "Settings", | ||
href: "?page=settings", | ||
}, | ||
], | ||
treasuryDaoID: sputnikAccount, | ||
showProposalSelection: false, | ||
showKYC: false, | ||
showReferenceProposal: false, | ||
}; |
3 changes: 3 additions & 0 deletions
3
instances/test-bootstrap.treasury-factory.near/aliases.mainnet.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "test-widgets.treasury-factory.near" | ||
} |
6 changes: 6 additions & 0 deletions
6
instances/test-bootstrap.treasury-factory.near/bos.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"account": "test-bootstrap.treasury-factory.near", | ||
"aliasPrefix": "REPL", | ||
"aliasesContainsPrefix": true, | ||
"aliases": ["./aliases.mainnet.json"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"test-bootstrap.treasury-factory.near": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
widget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../instances/bootstrap.treasury-factory.near/widget |
14 changes: 14 additions & 0 deletions
14
instances/test-widgets.treasury-factory.near/aliases.mainnet.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"REPL_DEVHUB": "devhub.near", | ||
"REPL_DEVHUB_CONTRACT": "devhub.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "test-widgets.treasury-factory.near", | ||
"REPL_INSTANCE": "treasury-testing.near", | ||
"REPL_TREASURY": "testing-astradao.sputnik-dao.near", | ||
"REPL_NEAR": "near", | ||
"REPL_MOB": "mob.near", | ||
"REPL_SOCIAL_CONTRACT": "social.near", | ||
"REPL_RPC_URL": "https://rpc.mainnet.near.org", | ||
"REPL_PROPOSALS_CACHE_URL": "https://devhub-cache-api-rs.fly.dev", | ||
"REPL_PIKESPEAK_KEY": "36f2b87a-7ee6-40d8-80b9-5e68e587a5b5", | ||
"REPL_NEARBLOCKS_KEY": "DA2570E26C0242FF897A463F4DCAACA6" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"account": "test-widgets.treasury-factory.near", | ||
"aliasPrefix": "REPL", | ||
"aliasesContainsPrefix": true, | ||
"aliases": ["./aliases.mainnet.json"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"test-widgets.treasury-factory.near": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
widget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../instances/widgets.treasury-factory.near/widget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,6 @@ | ||
{ | ||
"REPL_DEVHUB": "devhub.near", | ||
"REPL_DEVHUB_CONTRACT": "devhub.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "treasury-devdao.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "widgets.treasury-factory.near", | ||
"REPL_INSTANCE": "treasury-devdao.near", | ||
"REPL_TREASURY": "devdao.sputnik-dao.near", | ||
"REPL_NEAR": "near", | ||
"REPL_MOB": "mob.near", | ||
"REPL_SOCIAL_CONTRACT": "social.near", | ||
"REPL_RPC_URL": "https://rpc.mainnet.near.org", | ||
"REPL_PROPOSALS_CACHE_URL": "https://devhub-cache-api-rs.fly.dev", | ||
"REPL_PIKESPEAK_KEY": "36f2b87a-7ee6-40d8-80b9-5e68e587a5b5", | ||
"REPL_NEARBLOCKS_KEY": "DA2570E26C0242FF897A463F4DCAACA6" | ||
"REPL_PROPOSALS_CACHE_URL": "https://devhub-cache-api-rs.fly.dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
return { | ||
appName: "Treasury", | ||
navbarLinks: [ | ||
{ | ||
title: "Dashboard", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "treasury-devdao.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "widgets.treasury-factory.near", | ||
"REPL_INSTANCE": "treasury-infinex.near", | ||
"REPL_TREASURY": "infinex.sputnik-dao.near" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
return { | ||
appName: "Treasury", | ||
navbarLinks: [ | ||
{ | ||
title: "Dashboard", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "treasury-devdao.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "widgets.treasury-factory.near", | ||
"REPL_INSTANCE": "treasury-templar.near", | ||
"REPL_TREASURY": "templar.sputnik-dao.near" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "treasury-devdao.near", | ||
"REPL_BASE_DEPLOYMENT_ACCOUNT": "test-widgets.treasury-factory.near", | ||
"REPL_INSTANCE": "treasury-testing-infinex.near", | ||
"REPL_TREASURY": "testing-treasury.sputnik-dao.near" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
return { | ||
appName: "Treasury", | ||
navbarLinks: [ | ||
{ | ||
title: "Dashboard", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.