-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.ts
48 lines (42 loc) · 1.07 KB
/
deploy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import fs from 'fs'
import Arweave from 'arweave'
import { ArweaveSigner, TurboFactory } from '@ardrive/turbo-sdk'
const arweave = Arweave.init({
protocol: 'https',
host: 'frostor.xyz',
port: 443
})
const jwk = JSON.parse(fs.readFileSync('./.secrets/wallet.json').toString())
const signer = new ArweaveSigner(jwk)
const turbo = TurboFactory.authenticated({
signer,
gatewayUrl: 'https://frostor.xyz',
uploadServiceConfig: {
url: 'https://frostor.xyz/bundler'
}
})
async function tryWithTurboSdk() {
const {
// fileResponses,
manifestResponse,
manifest,
errors
} = await turbo.uploadFolder({ folderPath: __dirname+'/.output/public' })
if (errors && errors.length > 0) {
console.error(errors)
} else {
console.log(`Manifest id ${manifestResponse?.id}`)
console.log('Manifest', manifest)
}
}
async function deploy() {
const address = await arweave.wallets.jwkToAddress(jwk)
console.log('uploading using address', address)
await tryWithTurboSdk()
}
deploy()
.then()
.catch(err => {
console.error(err)
process.exit(1)
})