-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add step to update ArNS for cookbook_ao #1
- Loading branch information
1 parent
70ae525
commit b580fbc
Showing
4 changed files
with
1,010 additions
and
325 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { readFileSync } from "node:fs"; | ||
|
||
import { WarpFactory, defaultCacheOptions } from "warp-contracts"; | ||
import Arweave from "arweave"; | ||
|
||
function env(key) { | ||
if (!process.env[key]) { | ||
throw new Error(`Error with ENV VAR: ${key}`); | ||
} | ||
return process.env[key]; | ||
} | ||
|
||
const actions = { | ||
async UPDATE_ARNS() { | ||
const WALLET = env("WALLET"); | ||
const MANIFEST_ID = env("MANIFEST_ID"); | ||
|
||
const jwk = JSON.parse(readFileSync(WALLET)); | ||
|
||
/** | ||
* The ao ANT Contract | ||
* See https://sonar.warp.cc/?#/app/contract/uOf4TMgQxdaSXgcZ778PZR13UQPKJoZVK2ZvLAE90Xg?network=mainnet%23 | ||
*/ | ||
const ANT = "uOf4TMgQxdaSXgcZ778PZR13UQPKJoZVK2ZvLAE90Xg"; | ||
|
||
const arweave = Arweave.init({ | ||
host: "arweave.net", | ||
port: 443, | ||
protocol: "https", | ||
}); | ||
const warp = WarpFactory.custom(arweave, defaultCacheOptions, "mainnet") | ||
.useArweaveGateway() | ||
.build(); | ||
|
||
// Update the ao ANT Contract to point to the new install script | ||
const aoAntContract = warp.contract(ANT).connect(jwk); | ||
const antUpdate = await aoAntContract.writeInteraction({ | ||
function: "setRecord", | ||
subDomain: "cookbook", | ||
transactionId: MANIFEST_ID, | ||
}); | ||
|
||
console.log("Updated ao ANT record", antUpdate.interactionTx); | ||
|
||
return MANIFEST_ID; | ||
}, | ||
}; | ||
|
||
const ACTION = env("ACTION"); | ||
if (!actions[ACTION]) throw new Error(`'${ACTION}' is not a valid action`); | ||
|
||
actions[ACTION]().catch(console.error); |
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 |
---|---|---|
|
@@ -2,28 +2,31 @@ | |
"name": "docs", | ||
"version": "0.0.1", | ||
"description": "ao Cookbook", | ||
"type": "module", | ||
"authors": { | ||
"name": "Tyler Hall", | ||
"email": "[email protected]" | ||
}, | ||
"repository": "https://github.com/permaweb/ao-cookbook", | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"scripts": { | ||
"prepare": "husky install", | ||
"staged": "lint-staged --allow-empty --concurrent false", | ||
"dev": "vitepress dev src", | ||
"arns": "ACTION=UPDATE_ARNS node deploy.js", | ||
"build": "vitepress build src", | ||
"preview": "vitepress preview src" | ||
"dev": "vitepress dev src", | ||
"prepare": "husky install", | ||
"preview": "vitepress preview src", | ||
"staged": "lint-staged --allow-empty --concurrent false" | ||
}, | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@commitlint/cli": "^18.4.4", | ||
"@commitlint/config-conventional": "^18.4.4", | ||
"arweave": "^1.14.4", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^15.2.0", | ||
"markdown-toc-gen": "^1.0.1", | ||
"prettier": "^3.1.1", | ||
"vitepress": "1.0.0-rc.36", | ||
"vue": "^3.4.6" | ||
"vue": "^3.4.6", | ||
"warp-contracts": "^1.4.32" | ||
}, | ||
"authors": { | ||
"name": "Tyler Hall", | ||
"email": "[email protected]" | ||
} | ||
} |
Oops, something went wrong.