Skip to content

Commit

Permalink
Add script to fund deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
kanshi committed Jul 12, 2024
1 parent bef70a8 commit 7af7364
Show file tree
Hide file tree
Showing 2 changed files with 573 additions and 0 deletions.
25 changes: 25 additions & 0 deletions operations/fund-deployer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Irys from '@irys/sdk'

// Requires: PERMAWEB_KEY
// $ node operations/fund-deployer.mjs

const IRYS_NODE = 'https://node2.irys.xyz/'
const jwk = JSON.parse(
Buffer.from(process.env.PERMAWEB_KEY || 'NO_KEY', 'base64').toString('utf-8')
)
const irys = new Irys({ url: IRYS_NODE, token: 'arweave', key: jwk })

async function fundDeployer() {
try {
// const preBalance = await irys.getBalance('jp0QaS_Zai2hGaB-yRvAIMEtodmH_iHr0drpZxAZQtU')
const preBalance = await irys.getLoadedBalance()
console.log(`Irys loaded balance: ${preBalance}`)
// const fundTx = await irys.fund(irys.utils.toAtomic(0.1))
// console.log(`Successfully funded ${irys.utils.fromAtomic(fundTx.quantity)} ${irys.token}`)
} catch (e) {
console.log('Error interacting with permadata ', e)
}

}

fundDeployer().then().catch(err => console.error(err))
Loading

0 comments on commit 7af7364

Please sign in to comment.