@visualizevalue/mint-app-base 0.1.113 → 0.1.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/app.config.ts +19 -6
- package/components/Account.client.vue +7 -5
- package/components/Mint/Detail.client.vue +2 -1
- package/components/Mint/Renderer/Code.client.vue +83 -0
- package/components/Mint/Renderer/P5.client.vue +19 -24
- package/components/Token/DetailHeader.vue +1 -0
- package/composables/createMint.ts +52 -46
- package/locales/en.json +5 -1
- package/nuxt.config.ts +18 -27
- package/package.json +1 -1
- package/plugins/2.wagmi.ts +32 -16
package/.env.example
CHANGED
|
@@ -30,6 +30,9 @@ NUXT_PUBLIC_ARWEAVE_GATEWAY=
|
|
|
30
30
|
# NUXT_PUBLIC_RPC2=https://eth.drpc.org
|
|
31
31
|
# NUXT_PUBLIC_RPC3=https://1rpc.io/eth
|
|
32
32
|
|
|
33
|
+
# This should always be present if on other networks, so we can fetch ENS data
|
|
34
|
+
NUXT_PUBLIC_MAINNET_RPC1=https://eth.llamarpc.com
|
|
35
|
+
|
|
33
36
|
# =========================
|
|
34
37
|
# SEPOLIA
|
|
35
38
|
# =========================
|
package/app.config.ts
CHANGED
|
@@ -2,19 +2,26 @@ export default defineAppConfig({
|
|
|
2
2
|
knownRenderers: {
|
|
3
3
|
// Mainnet
|
|
4
4
|
1: [
|
|
5
|
+
{
|
|
6
|
+
component: 'Base',
|
|
7
|
+
name: 'Base Renderer',
|
|
8
|
+
version: 1n,
|
|
9
|
+
address: '0xe5d2da253c7d4b7609afce15332bb1a1fb461d09',
|
|
10
|
+
description: 'The default renderer',
|
|
11
|
+
},
|
|
5
12
|
{
|
|
6
13
|
component: 'P5',
|
|
7
14
|
name: 'P5 Renderer',
|
|
8
15
|
version: 2n,
|
|
9
16
|
address: '0xbf42cabb7d46bfa290dcc6223477c6afe6a83174',
|
|
10
|
-
description: 'Allows using P5 scripts as the artifact content'
|
|
17
|
+
description: 'Allows using P5 scripts as the artifact content',
|
|
11
18
|
},
|
|
12
19
|
{
|
|
13
20
|
component: 'Animation',
|
|
14
21
|
name: 'Animation Renderer',
|
|
15
22
|
version: 1n,
|
|
16
23
|
address: '0xcb681409046e45e6187ec2205498e4adbe19749c',
|
|
17
|
-
description: 'Allows linking to both an image and an animation url'
|
|
24
|
+
description: 'Allows linking to both an image and an animation url',
|
|
18
25
|
},
|
|
19
26
|
{
|
|
20
27
|
component: 'P5',
|
|
@@ -27,19 +34,26 @@ export default defineAppConfig({
|
|
|
27
34
|
],
|
|
28
35
|
// Sepolia
|
|
29
36
|
11155111: [
|
|
37
|
+
{
|
|
38
|
+
component: 'Base',
|
|
39
|
+
name: 'Base Renderer',
|
|
40
|
+
version: 1n,
|
|
41
|
+
address: '0x901603b81aae5eb2a1dc3cec77280bf6e4727bfe',
|
|
42
|
+
description: 'The default renderer',
|
|
43
|
+
},
|
|
30
44
|
{
|
|
31
45
|
component: 'P5',
|
|
32
46
|
name: 'P5 Renderer (Sepolia)',
|
|
33
47
|
version: 2n,
|
|
34
48
|
address: '0x55b69a4f2db99417c1b211151181ed48b39df438',
|
|
35
|
-
description: 'Allows using P5 scripts as the artifact content'
|
|
49
|
+
description: 'Allows using P5 scripts as the artifact content',
|
|
36
50
|
},
|
|
37
51
|
{
|
|
38
52
|
component: 'Animation',
|
|
39
53
|
name: 'Animation Renderer',
|
|
40
54
|
version: 1n,
|
|
41
55
|
address: '0xeeaf428251c477002d52c69e022b357a91f36517',
|
|
42
|
-
description: 'Allows linking to both an image and an animation url'
|
|
56
|
+
description: 'Allows linking to both an image and an animation url',
|
|
43
57
|
},
|
|
44
58
|
{
|
|
45
59
|
component: 'P5',
|
|
@@ -50,6 +64,5 @@ export default defineAppConfig({
|
|
|
50
64
|
deprecated: true,
|
|
51
65
|
},
|
|
52
66
|
],
|
|
53
|
-
}
|
|
67
|
+
},
|
|
54
68
|
})
|
|
55
|
-
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</span>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script setup>
|
|
7
|
+
<script lang="ts" setup>
|
|
8
8
|
import { useAccount, useEnsName } from '@wagmi/vue'
|
|
9
9
|
|
|
10
10
|
const props = defineProps(['address'])
|
|
@@ -12,14 +12,16 @@ const props = defineProps(['address'])
|
|
|
12
12
|
const address = computed(() => props.address?.value || props.address)
|
|
13
13
|
|
|
14
14
|
const { address: currentAddress } = useAccount()
|
|
15
|
-
const isCurrent = computed(
|
|
15
|
+
const isCurrent = computed(
|
|
16
|
+
() => currentAddress.value?.toLowerCase() === address.value.toLowerCase(),
|
|
17
|
+
)
|
|
16
18
|
|
|
17
19
|
const { data: ens } = useEnsName({
|
|
18
20
|
address,
|
|
19
21
|
chainId: 1,
|
|
20
22
|
})
|
|
21
23
|
|
|
22
|
-
const display = computed(
|
|
23
|
-
isCurrent.value ? `You` : shortAddress(address.value)
|
|
24
|
-
)
|
|
24
|
+
const display = computed(
|
|
25
|
+
() => ens.value || (isCurrent.value ? `You` : shortAddress(address.value)),
|
|
26
|
+
)
|
|
25
27
|
</script>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import Animation from './Renderer/Animation.client.vue'
|
|
3
3
|
import Base from './Renderer/Base.client.vue'
|
|
4
|
+
import Code from './Renderer/Code.client.vue'
|
|
4
5
|
import P5 from './Renderer/P5.client.vue'
|
|
5
6
|
|
|
6
7
|
const components = {
|
|
7
8
|
Animation,
|
|
8
9
|
Base,
|
|
10
|
+
Code,
|
|
9
11
|
P5,
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -54,4 +56,3 @@ const { component } = useCreateMintRendererComponent(props.collection)
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
</style>
|
|
57
|
-
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mint-renderer-p5">
|
|
3
|
+
<Tabs initial="base">
|
|
4
|
+
<template #menu="{ active, select }">
|
|
5
|
+
<Button @click="select('base')" :class="{ active: active === 'base' }">
|
|
6
|
+
{{ $t('mint.code.static') }}
|
|
7
|
+
</Button>
|
|
8
|
+
<Button @click="select('script')" :class="{ active: active === 'script' }">
|
|
9
|
+
{{ $t('mint.code.script') }}
|
|
10
|
+
</Button>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<template #content="{ active }">
|
|
14
|
+
<!-- We only hide the form to maintain the file select state -->
|
|
15
|
+
<MintRendererBase v-show="active === 'base'" decouple-artifact />
|
|
16
|
+
<!-- We force rerender the code editor on active -->
|
|
17
|
+
<CodeEditor
|
|
18
|
+
v-if="active === 'script'"
|
|
19
|
+
v-model="script"
|
|
20
|
+
class="full"
|
|
21
|
+
ref="codeEditor"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
24
|
+
</Tabs>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { watchDebounced } from '@vueuse/core'
|
|
30
|
+
|
|
31
|
+
const { artifact, image, animationUrl } = useCreateMintData()
|
|
32
|
+
|
|
33
|
+
const script = ref(DEFAULT_P5_SCRIPT)
|
|
34
|
+
|
|
35
|
+
// Keep the animationURL (for the preview) up to date
|
|
36
|
+
const updateUrl = () => {
|
|
37
|
+
animationUrl.value = getP5HtmlUri('Preview', script.value)
|
|
38
|
+
}
|
|
39
|
+
watchDebounced(script, updateUrl, { debounce: 500, maxWait: 3000 })
|
|
40
|
+
onMounted(updateUrl)
|
|
41
|
+
|
|
42
|
+
// Encode the artifact as per how the P5Renderer.sol contract expects it.
|
|
43
|
+
watchEffect(() => {
|
|
44
|
+
artifact.value = encodeAbiParameters(
|
|
45
|
+
[
|
|
46
|
+
{ type: 'string', name: 'image' },
|
|
47
|
+
{ type: 'string', name: 'script' },
|
|
48
|
+
],
|
|
49
|
+
[image.value, script.value],
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
.mint-renderer-p5 {
|
|
56
|
+
padding: 0 !important;
|
|
57
|
+
border: 0 !important;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: 0;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
width: 100%;
|
|
63
|
+
|
|
64
|
+
> .tabs {
|
|
65
|
+
height: min-content;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
> .tabs-content {
|
|
69
|
+
border: var(--border);
|
|
70
|
+
border-radius: var(--card-border-radius);
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
height: 100%;
|
|
73
|
+
|
|
74
|
+
> * {
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
> *:not(.full) {
|
|
79
|
+
padding: var(--spacer);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="mint-renderer-p5">
|
|
3
3
|
<Tabs initial="base">
|
|
4
|
-
|
|
5
4
|
<template #menu="{ active, select }">
|
|
6
|
-
<Button
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:class="{ active: active === 'script' }"
|
|
13
|
-
>{{ $t('mint.p5.p5_script') }}</Button>
|
|
5
|
+
<Button @click="select('base')" :class="{ active: active === 'base' }">
|
|
6
|
+
{{ $t('mint.p5.static') }}
|
|
7
|
+
</Button>
|
|
8
|
+
<Button @click="select('script')" :class="{ active: active === 'script' }">
|
|
9
|
+
{{ $t('mint.p5.script') }}
|
|
10
|
+
</Button>
|
|
14
11
|
</template>
|
|
15
12
|
|
|
16
13
|
<template #content="{ active }">
|
|
17
14
|
<!-- We only hide the form to maintain the file select state -->
|
|
18
15
|
<MintRendererBase v-show="active === 'base'" decouple-artifact />
|
|
19
16
|
<!-- We force rerender the code editor on active -->
|
|
20
|
-
<CodeEditor
|
|
17
|
+
<CodeEditor
|
|
18
|
+
v-if="active === 'script'"
|
|
19
|
+
v-model="script"
|
|
20
|
+
class="full"
|
|
21
|
+
ref="codeEditor"
|
|
22
|
+
/>
|
|
21
23
|
</template>
|
|
22
|
-
|
|
23
24
|
</Tabs>
|
|
24
25
|
</div>
|
|
25
26
|
</template>
|
|
@@ -27,11 +28,7 @@
|
|
|
27
28
|
<script setup>
|
|
28
29
|
import { watchDebounced } from '@vueuse/core'
|
|
29
30
|
|
|
30
|
-
const {
|
|
31
|
-
artifact,
|
|
32
|
-
image,
|
|
33
|
-
animationUrl,
|
|
34
|
-
} = useCreateMintData()
|
|
31
|
+
const { artifact, image, animationUrl } = useCreateMintData()
|
|
35
32
|
|
|
36
33
|
const script = ref(DEFAULT_P5_SCRIPT)
|
|
37
34
|
|
|
@@ -39,18 +36,17 @@ const script = ref(DEFAULT_P5_SCRIPT)
|
|
|
39
36
|
const updateUrl = () => {
|
|
40
37
|
animationUrl.value = getP5HtmlUri('Preview', script.value)
|
|
41
38
|
}
|
|
42
|
-
watchDebounced(
|
|
43
|
-
script,
|
|
44
|
-
updateUrl,
|
|
45
|
-
{ debounce: 500, maxWait: 3000 },
|
|
46
|
-
)
|
|
39
|
+
watchDebounced(script, updateUrl, { debounce: 500, maxWait: 3000 })
|
|
47
40
|
onMounted(updateUrl)
|
|
48
41
|
|
|
49
42
|
// Encode the artifact as per how the P5Renderer.sol contract expects it.
|
|
50
43
|
watchEffect(() => {
|
|
51
44
|
artifact.value = encodeAbiParameters(
|
|
52
|
-
[
|
|
53
|
-
|
|
45
|
+
[
|
|
46
|
+
{ type: 'string', name: 'image' },
|
|
47
|
+
{ type: 'string', name: 'script' },
|
|
48
|
+
],
|
|
49
|
+
[image.value, script.value],
|
|
54
50
|
)
|
|
55
51
|
})
|
|
56
52
|
</script>
|
|
@@ -85,4 +81,3 @@ watchEffect(() => {
|
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
</style>
|
|
88
|
-
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { TransactionReceipt } from
|
|
1
|
+
import type { TransactionReceipt } from 'viem'
|
|
2
2
|
|
|
3
3
|
// Base token data
|
|
4
|
-
const name
|
|
5
|
-
const artifact
|
|
4
|
+
const name = ref('')
|
|
5
|
+
const artifact = ref('')
|
|
6
6
|
const description = ref('')
|
|
7
7
|
|
|
8
8
|
// Derived data based on artifact // renderer
|
|
9
|
-
const image
|
|
9
|
+
const image = ref('')
|
|
10
10
|
const animationUrl = ref('')
|
|
11
11
|
|
|
12
12
|
// Renderer data
|
|
13
|
-
const renderer: Ref<number>
|
|
13
|
+
const renderer: Ref<number> = ref(0)
|
|
14
14
|
const extraData: Ref<bigint> = ref(0n)
|
|
15
15
|
|
|
16
16
|
// Main token creation composable
|
|
@@ -45,15 +45,16 @@ export const useCreateMintRendererComponent = (collection: Collection) => {
|
|
|
45
45
|
const appConfig = useAppConfig()
|
|
46
46
|
const mainChainId = useMainChainId()
|
|
47
47
|
const rendererAddress: Ref<string | null> = computed(() => {
|
|
48
|
-
if (!
|
|
48
|
+
if (!collection.renderers?.length) return null
|
|
49
49
|
|
|
50
50
|
return collection.renderers[renderer.value].address.toLowerCase()
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
const component = computed(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const component = computed(
|
|
54
|
+
() =>
|
|
55
|
+
appConfig.knownRenderers[mainChainId].find(
|
|
56
|
+
(r) => r.address.toLowerCase() === rendererAddress.value,
|
|
57
|
+
)?.component || 'Code',
|
|
57
58
|
)
|
|
58
59
|
|
|
59
60
|
return {
|
|
@@ -71,7 +72,7 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
71
72
|
// Mint flow
|
|
72
73
|
const txFlowKey = ref(0)
|
|
73
74
|
const mint = async () => {
|
|
74
|
-
if (!
|
|
75
|
+
if (!artifact.value) {
|
|
75
76
|
alert(`Empty artifact data. Please try again.`)
|
|
76
77
|
return
|
|
77
78
|
}
|
|
@@ -82,7 +83,11 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
82
83
|
|
|
83
84
|
try {
|
|
84
85
|
if (multiTransactionPrepare) {
|
|
85
|
-
if (
|
|
86
|
+
if (
|
|
87
|
+
!confirm(
|
|
88
|
+
`Due to the large artifact size, we have to split it into ${artifactChunks.length} chunks and store them in separate transactions. You will be prompted with multiple transaction requests before minting the final token.`,
|
|
89
|
+
)
|
|
90
|
+
) {
|
|
86
91
|
return
|
|
87
92
|
}
|
|
88
93
|
|
|
@@ -90,39 +95,39 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
90
95
|
let clearExisting = true
|
|
91
96
|
|
|
92
97
|
for (const chunk of artifactChunks) {
|
|
93
|
-
await txFlow.value.initializeRequest(() =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
collection.latestTokenId + 1n,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
}))
|
|
98
|
+
await txFlow.value.initializeRequest(() =>
|
|
99
|
+
writeContract($wagmi, {
|
|
100
|
+
abi: MINT_ABI,
|
|
101
|
+
chainId,
|
|
102
|
+
address: collection.address,
|
|
103
|
+
functionName: 'prepareArtifact',
|
|
104
|
+
args: [collection.latestTokenId + 1n, chunk, clearExisting],
|
|
105
|
+
}),
|
|
106
|
+
)
|
|
104
107
|
|
|
105
108
|
// Make sure to rerender the tx flow component
|
|
106
|
-
txFlowKey.value
|
|
109
|
+
txFlowKey.value++
|
|
107
110
|
|
|
108
111
|
// On following iterations we want to keep existing artifact data
|
|
109
112
|
clearExisting = false
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
await txFlow.value.initializeRequest(() =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
await txFlow.value.initializeRequest(() =>
|
|
117
|
+
writeContract($wagmi, {
|
|
118
|
+
abi: MINT_ABI,
|
|
119
|
+
chainId,
|
|
120
|
+
address: collection.address,
|
|
121
|
+
functionName: 'create',
|
|
122
|
+
args: [
|
|
123
|
+
sanitizeForJson(name.value),
|
|
124
|
+
sanitizeForJson(description.value),
|
|
125
|
+
multiTransactionPrepare ? [] : artifactByteArray,
|
|
126
|
+
renderer.value,
|
|
127
|
+
0n, // Additional Data
|
|
128
|
+
],
|
|
129
|
+
}),
|
|
130
|
+
)
|
|
126
131
|
} catch (e) {
|
|
127
132
|
console.error(e)
|
|
128
133
|
}
|
|
@@ -130,14 +135,16 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
130
135
|
|
|
131
136
|
// On created
|
|
132
137
|
const mintCreated = async (receipt: TransactionReceipt) => {
|
|
133
|
-
const logs = receipt.logs.map(log =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const logs = receipt.logs.map((log) =>
|
|
139
|
+
decodeEventLog({
|
|
140
|
+
abi: MINT_ABI,
|
|
141
|
+
data: log.data,
|
|
142
|
+
topics: log.topics,
|
|
143
|
+
strict: false,
|
|
144
|
+
}),
|
|
145
|
+
)
|
|
139
146
|
|
|
140
|
-
const mintedEvent = logs.find(log => log.eventName === 'TransferSingle')
|
|
147
|
+
const mintedEvent = logs.find((log) => log.eventName === 'TransferSingle')
|
|
141
148
|
|
|
142
149
|
await store.fetchToken(collection.address, mintedEvent.args.id)
|
|
143
150
|
|
|
@@ -146,7 +153,7 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
146
153
|
|
|
147
154
|
await navigateTo({
|
|
148
155
|
name: 'id-collection-tokenId',
|
|
149
|
-
params: { id: id.value, collection: collection.address, tokenId: mintedEvent.args.id }
|
|
156
|
+
params: { id: id.value, collection: collection.address, tokenId: mintedEvent.args.id },
|
|
150
157
|
})
|
|
151
158
|
}
|
|
152
159
|
|
|
@@ -155,4 +162,3 @@ export const useCreateMintFlow = (collection: Collection, txFlow: Ref) => {
|
|
|
155
162
|
mintCreated,
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
|
-
|
package/locales/en.json
CHANGED
|
@@ -50,9 +50,13 @@
|
|
|
50
50
|
"title_placeholder": "Title",
|
|
51
51
|
"description_placeholder": "Description"
|
|
52
52
|
},
|
|
53
|
+
"code": {
|
|
54
|
+
"static": "Static",
|
|
55
|
+
"script": "Script"
|
|
56
|
+
},
|
|
53
57
|
"p5": {
|
|
54
58
|
"static": "Static",
|
|
55
|
-
"
|
|
59
|
+
"script": "P5 Script"
|
|
56
60
|
},
|
|
57
61
|
"preview": {
|
|
58
62
|
"title": "Preview",
|
package/nuxt.config.ts
CHANGED
|
@@ -7,11 +7,7 @@ const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
|
7
7
|
export default defineNuxtConfig({
|
|
8
8
|
ssr: process.env.NUXT_SSR !== 'false',
|
|
9
9
|
|
|
10
|
-
modules: [
|
|
11
|
-
'@pinia/nuxt',
|
|
12
|
-
'@pinia-plugin-persistedstate/nuxt',
|
|
13
|
-
'@nuxtjs/i18n',
|
|
14
|
-
],
|
|
10
|
+
modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt', '@nuxtjs/i18n'],
|
|
15
11
|
|
|
16
12
|
runtimeConfig: {
|
|
17
13
|
public: {
|
|
@@ -22,6 +18,7 @@ export default defineNuxtConfig({
|
|
|
22
18
|
description: 'To mint is a human right.',
|
|
23
19
|
factoryAddress: '0xd717Fe677072807057B03705227EC3E3b467b670',
|
|
24
20
|
platformUrl: 'https://networked.art',
|
|
21
|
+
mainnetRpc1: 'https://eth.llamarpc.com',
|
|
25
22
|
rpc1: 'https://eth.llamarpc.com',
|
|
26
23
|
rpc2: 'https://ethereum-rpc.publicnode.com',
|
|
27
24
|
rpc3: 'https://eth.drpc.org',
|
|
@@ -29,7 +26,7 @@ export default defineNuxtConfig({
|
|
|
29
26
|
arweaveGateway: 'https://arweave.net/',
|
|
30
27
|
title: 'Mint',
|
|
31
28
|
walletConnectProjectId: '',
|
|
32
|
-
}
|
|
29
|
+
},
|
|
33
30
|
},
|
|
34
31
|
|
|
35
32
|
app: {
|
|
@@ -37,15 +34,11 @@ export default defineNuxtConfig({
|
|
|
37
34
|
viewport: 'width=device-width, initial-scale=1, viewport-fit=cover',
|
|
38
35
|
htmlAttrs: { lang: 'en' },
|
|
39
36
|
title: process.env.NUXT_PUBLIC_TITLE,
|
|
40
|
-
link: [
|
|
41
|
-
{ rel: 'icon', href: '/icon.svg', type: 'image/svg+xml' },
|
|
42
|
-
]
|
|
37
|
+
link: [{ rel: 'icon', href: '/icon.svg', type: 'image/svg+xml' }],
|
|
43
38
|
},
|
|
44
39
|
},
|
|
45
40
|
|
|
46
|
-
css: [
|
|
47
|
-
join(currentDir, './assets/styles/index.css'),
|
|
48
|
-
],
|
|
41
|
+
css: [join(currentDir, './assets/styles/index.css')],
|
|
49
42
|
|
|
50
43
|
postcss: {
|
|
51
44
|
plugins: {
|
|
@@ -53,7 +46,7 @@ export default defineNuxtConfig({
|
|
|
53
46
|
files: [
|
|
54
47
|
join(currentDir, './assets/styles/custom-selectors.css'),
|
|
55
48
|
join(currentDir, './assets/styles/custom-media.css'),
|
|
56
|
-
]
|
|
49
|
+
],
|
|
57
50
|
},
|
|
58
51
|
'postcss-nested': {},
|
|
59
52
|
'postcss-custom-selectors': {},
|
|
@@ -62,7 +55,7 @@ export default defineNuxtConfig({
|
|
|
62
55
|
stage: 3,
|
|
63
56
|
features: {},
|
|
64
57
|
},
|
|
65
|
-
|
|
58
|
+
autoprefixer: {},
|
|
66
59
|
},
|
|
67
60
|
},
|
|
68
61
|
|
|
@@ -73,16 +66,18 @@ export default defineNuxtConfig({
|
|
|
73
66
|
config.optimizeDeps.include.push('@visualizevalue/mint-app-base > eventemitter3')
|
|
74
67
|
config.optimizeDeps.include.push('@visualizevalue/mint-app-base > buffer/')
|
|
75
68
|
config.optimizeDeps.include.push('@visualizevalue/mint-app-base > codemirror')
|
|
76
|
-
config.optimizeDeps.include.push(
|
|
77
|
-
|
|
69
|
+
config.optimizeDeps.include.push(
|
|
70
|
+
'@visualizevalue/mint-app-base > codemirror-editor-vue3',
|
|
71
|
+
)
|
|
72
|
+
},
|
|
78
73
|
},
|
|
79
74
|
|
|
80
75
|
nitro: {
|
|
81
76
|
preset: 'node-cluster',
|
|
82
77
|
esbuild: {
|
|
83
78
|
options: {
|
|
84
|
-
target: 'esnext'
|
|
85
|
-
}
|
|
79
|
+
target: 'esnext',
|
|
80
|
+
},
|
|
86
81
|
},
|
|
87
82
|
},
|
|
88
83
|
|
|
@@ -90,11 +85,7 @@ export default defineNuxtConfig({
|
|
|
90
85
|
presets: [
|
|
91
86
|
{
|
|
92
87
|
from: '@wagmi/core',
|
|
93
|
-
imports: [
|
|
94
|
-
'readContract',
|
|
95
|
-
'waitForTransactionReceipt',
|
|
96
|
-
'writeContract',
|
|
97
|
-
]
|
|
88
|
+
imports: ['readContract', 'waitForTransactionReceipt', 'writeContract'],
|
|
98
89
|
},
|
|
99
90
|
{
|
|
100
91
|
from: 'viem',
|
|
@@ -108,13 +99,13 @@ export default defineNuxtConfig({
|
|
|
108
99
|
'encodeAbiParameters',
|
|
109
100
|
'parseAbiParameters',
|
|
110
101
|
'parseAbiParameter',
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
]
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
114
105
|
},
|
|
115
106
|
|
|
116
107
|
piniaPersistedstate: {
|
|
117
|
-
storage: 'localStorage'
|
|
108
|
+
storage: 'localStorage',
|
|
118
109
|
},
|
|
119
110
|
|
|
120
111
|
i18n: {
|
package/package.json
CHANGED
package/plugins/2.wagmi.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { VueQueryPlugin } from '@tanstack/vue-query'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
http,
|
|
4
|
+
cookieStorage,
|
|
5
|
+
createConfig,
|
|
6
|
+
createStorage,
|
|
7
|
+
WagmiPlugin,
|
|
8
|
+
fallback,
|
|
9
|
+
type Config,
|
|
10
|
+
type CreateConnectorFn,
|
|
11
|
+
} from '@wagmi/vue'
|
|
3
12
|
import { mainnet, sepolia, holesky, localhost } from '@wagmi/vue/chains'
|
|
4
13
|
import { coinbaseWallet, injected, metaMask, walletConnect } from '@wagmi/vue/connectors'
|
|
5
14
|
import type { CustomTransport, Transport } from 'viem'
|
|
6
15
|
|
|
7
|
-
export default defineNuxtPlugin(nuxtApp => {
|
|
16
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
8
17
|
const title = nuxtApp.$config.public.title || 'Mint'
|
|
9
18
|
const mainChainId = nuxtApp.$config.public.chainId
|
|
10
19
|
|
|
@@ -19,19 +28,25 @@ export default defineNuxtPlugin(nuxtApp => {
|
|
|
19
28
|
name: title,
|
|
20
29
|
iconUrl: '',
|
|
21
30
|
url: '',
|
|
22
|
-
}
|
|
31
|
+
},
|
|
23
32
|
}),
|
|
24
33
|
]
|
|
25
34
|
|
|
26
|
-
if (nuxtApp.$config.public.walletConnectProjectId)
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
if (nuxtApp.$config.public.walletConnectProjectId)
|
|
36
|
+
connectors.push(
|
|
37
|
+
walletConnect({
|
|
38
|
+
projectId: nuxtApp.$config.public.walletConnectProjectId,
|
|
39
|
+
}),
|
|
40
|
+
)
|
|
29
41
|
|
|
30
|
-
const transportDefinitions: CustomTransport|Transport[] = []
|
|
42
|
+
const transportDefinitions: CustomTransport | Transport[] = []
|
|
31
43
|
|
|
32
|
-
if (nuxtApp.$config.public.rpc1)
|
|
33
|
-
|
|
34
|
-
if (nuxtApp.$config.public.
|
|
44
|
+
if (nuxtApp.$config.public.rpc1)
|
|
45
|
+
transportDefinitions.push(http(nuxtApp.$config.public.rpc1 as string))
|
|
46
|
+
if (nuxtApp.$config.public.rpc2)
|
|
47
|
+
transportDefinitions.push(http(nuxtApp.$config.public.rpc2 as string))
|
|
48
|
+
if (nuxtApp.$config.public.rpc3)
|
|
49
|
+
transportDefinitions.push(http(nuxtApp.$config.public.rpc3 as string))
|
|
35
50
|
transportDefinitions.push(http())
|
|
36
51
|
|
|
37
52
|
const transports = fallback(transportDefinitions)
|
|
@@ -47,11 +62,12 @@ export default defineNuxtPlugin(nuxtApp => {
|
|
|
47
62
|
}),
|
|
48
63
|
ssr: true,
|
|
49
64
|
transports: {
|
|
50
|
-
[mainnet.id]:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
[mainnet.id]:
|
|
66
|
+
mainChainId == 1
|
|
67
|
+
? // Use configured transports if we're on mainnet
|
|
68
|
+
transports
|
|
69
|
+
: // Default to viem public rpc if not on mainnet
|
|
70
|
+
http(nuxtApp.$config.public.mainnetRpc1),
|
|
55
71
|
[sepolia.id]: transports,
|
|
56
72
|
[holesky.id]: transports,
|
|
57
73
|
[localhost.id]: transports,
|
|
@@ -63,6 +79,6 @@ export default defineNuxtPlugin(nuxtApp => {
|
|
|
63
79
|
return {
|
|
64
80
|
provide: {
|
|
65
81
|
wagmi: wagmiConfig,
|
|
66
|
-
}
|
|
82
|
+
},
|
|
67
83
|
}
|
|
68
84
|
})
|