Skip to content

Commit

Permalink
Initialize Arweave.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyusternie committed Oct 19, 2024
1 parent d049e20 commit 17f1147
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions studio-nft/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ watch([Profile.$state, System.$state, Wallet.$state], (_state) => {
})
const isShowingMenu = ref(false)
const showProfileMenu = ref(false)
// onMounted(() => {
// console.log('Mounted!')
Expand Down
42 changes: 26 additions & 16 deletions studio-nft/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
/* Import modules. */
import Arweave from 'arweave'
import * as fflate from 'fflate'
import numeral from 'numeral'
import { sha256 } from '@nexajs/crypto'
Expand All @@ -9,16 +10,16 @@ import { binToHex } from '@nexajs/utils'
import { useSystemStore } from '@/stores/system'
const System = useSystemStore()
const _jsonToArray = function(json) {
const str = JSON.stringify(json, null, 0)
const ret = new Uint8Array(str.length)
// const _jsonToArray = function(json) {
// const str = JSON.stringify(json, null, 0)
// const ret = new Uint8Array(str.length)
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i)
}
// for (var i = 0; i < str.length; i++) {
// ret[i] = str.charCodeAt(i)
// }
return ret
}
// return ret
// }
const ENDPOINT = 'https://nexa.garden/v1/asset'
Expand Down Expand Up @@ -102,15 +103,15 @@ const mint = async () => {
let cardPublic
let cardPublicId
let data
let gardenVer
let eternalVer
let hash256
let json
let license
let title
let zipped
/* Set garden version. */
gardenVer = '0.1'
/* Set EternalDB version. */
eternalVer = '0.1'
/* Set title. */
title = `A Builder's Breakfast`
Expand Down Expand Up @@ -179,7 +180,7 @@ const mint = async () => {
/* Build JSON package. */
json = {
gardenVer,
eternalVer,
title,
author,
series: `The Nexican Gallery`,
Expand Down Expand Up @@ -364,10 +365,19 @@ const build = async () => {
console.log('RESPONSE (upload):', response)
}
// onMounted(() => {
// console.log('Mounted!')
// // Now it's safe to perform setup operations.
// })
const init = async () => {
console.log('Arweave', Arweave)
/* Initialize locals. */
let arweave
arweave = Arweave.init({})
console.log('arweave', arweave)
}
onMounted(() => {
init()
})
// onBeforeUnmount(() => {
// console.log('Before Unmount!')
Expand Down

0 comments on commit 17f1147

Please sign in to comment.