Skip to content

Commit a99fb61

Browse files
authored
Merge pull request #696 from kodadot/main
Bugs here and there
2 parents cbd95a5 + 3f4517d commit a99fb61

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,23 @@ export default class Summary extends Vue {
163163

164164
# 🏃‍♀️ Quick Setup
165165

166+
Here is a quick setup guide for the project.
167+
166168
```bash
167169
git clone https://github.com/kodadot/nft-gallery.git
168170
touch .env.local
169171
```
170172

171-
in `.env.local` add following urls:
173+
in `.env.local` add following properties:
172174
```bash
173175
VUE_APP_KEYRING=true
174176
VUE_APP_I18N_LOCALE=en
175177
VUE_APP_I18N_FALLBACK_LOCALE=en
176-
VUE_APP_SLATE_KEY=
177-
VUE_APP_SUBQUERY_URL=https://api.subquery.network/sq/vikiival/magick
178+
VUE_APP_SUBQUERY_URL=https://api.subquery.network/sq/vikiival/magick-west
178179
```
179-
you can obtain api key for slate [here](slate.host)
180+
[You can obtain some Westend (WND)](https://matrix.to/#/#westend_faucet:matrix.org)
181+
182+
If you want to access Kusama's GraphQL API, **remove** `-west` from `VUE_APP_SUBQUERY_URL`
180183

181184
> to run UI
182185
@@ -192,6 +195,13 @@ yarn start
192195
yarn lambda
193196
```
194197

198+
### Caveats:
199+
Netlify functions are **unable** to read `.env.local`.
200+
Therefore, you need to manually update pinata keys in each function.
201+
Functions are located in `src-functions/`
202+
203+
[You can obtain Master Pinata Keys here](https://app.pinata.cloud/keys)
204+
195205
## Running local Polkadot and subquery nodes
196206

197207
To run the full local environment we recommend you to run a [polkadot/Kusama node](https://github.com/paritytech/polkadot).

src/components/rmrk/Create/CreateCollection.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,13 @@ export default class CreateCollection extends Mixins(
199199
private async submit() {
200200
this.isLoading = true;
201201
this.status = 'loader.ipfs';
202-
const { api } = Connector.getInstance();
203-
const metadata = await this.constructMeta();
204-
const mint = this.constructRmrkMint(metadata);
205-
const mintString = NFTUtils.encodeCollection(mint, this.version);
206202
207203
try {
204+
const metadata = await this.constructMeta();
205+
const mint = this.constructRmrkMint(metadata);
206+
const mintString = NFTUtils.encodeCollection(mint, this.version);
207+
208+
const { api } = Connector.getInstance();
208209
showNotification(mintString);
209210
const cb = !this.hasSupport
210211
? api.tx.system.remark

src/components/rmrk/Create/CreateItem.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</b-switch>
5757
</b-field>
5858

59-
<BalanceInput v-model="vPrice" label="Price" />
59+
<BalanceInput @input="updateMeta" label="Price" />
6060
<b-message
6161
v-if="hasPrice"
6262
icon="exclamation-triangle"
@@ -101,6 +101,11 @@ export default class CreateItem extends Vue {
101101
@Prop(Number) public max!: number;
102102
@Prop(Number) public alreadyMinted!: number;
103103
104+
protected updateMeta(value: number) {
105+
console.log(typeof value, value);
106+
this.vPrice = value;
107+
}
108+
104109
get fileType() {
105110
return resolveMedia(this.vFile?.type);
106111
}

src/components/rmrk/Create/SimpleMint.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,6 @@ export default class SimpleMint extends Mixins(
437437
438438
public async listForSale(remarks: NFT[], originalBlockNumber: string) {
439439
try {
440-
const { api } = Connector.getInstance();
441-
this.isLoading = true;
442-
443440
const { price, version } = this;
444441
showNotification(
445442
`[APP] Listing NFT to sale for ${formatBalance(price, {
@@ -460,6 +457,9 @@ export default class SimpleMint extends Mixins(
460457
return;
461458
}
462459
460+
this.isLoading = true;
461+
const { api } = Connector.getInstance();
462+
463463
const cb = api.tx.utility.batchAll;
464464
const args = onlyNfts.map(this.toRemark);
465465

src/utils/WithKeyring.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export default class WithKeyring extends Vue {
2929
// console.log('keyring initX');
3030
}
3131

32-
public async loadKeyring(): Promise<void> {
32+
public async loadKeyring(ss58?: number): Promise<void> {
3333
this.keyringLoaded = true;
3434
// this.keys = keyring;
3535
this.mapAccounts();
36-
await this.extensionAccounts();
36+
await this.extensionAccounts(ss58);
3737
}
3838

3939
public mapAccounts(): void {
@@ -48,17 +48,20 @@ export default class WithKeyring extends Vue {
4848
return this.chainProperties?.ss58Format
4949
}
5050

51-
public async extensionAccounts() {
51+
public async extensionAccounts(ss58?: number) {
5252
if (!isWeb3Injected) {
5353
console.warn('Extension not working, reload might fix things')
5454
await enableExtension();
5555
}
5656

57-
this.importedAccounts = await web3Accounts({ ss58Format: correctFormat(this.ss58Format) >= 0 ? correctFormat(this.ss58Format) : correctFormat(this.prefixByStore) });
57+
const ss58Changed = typeof ss58 === 'number'
58+
const ss58Forever = ss58Changed ? ss58 : this.ss58Format
5859

59-
if (!this.accountId && this.importedAccounts?.length && !process.env.VUE_APP_KEYRING) {
60-
this.$store.dispatch('setAuth', { address: this.importedAccounts[0]?.address });
61-
}
60+
this.importedAccounts = await web3Accounts({ ss58Format: correctFormat(ss58Forever) >= 0 ? correctFormat(ss58Forever) : correctFormat(this.prefixByStore) });
61+
62+
// if ((!this.accountId || ss58Changed) && this.importedAccounts?.length && process.env.VUE_APP_KEYRING) {
63+
// this.$store.dispatch('setAuth', { address: this.importedAccounts[0]?.address });
64+
// }
6265
}
6366

6467
get accountId() {
@@ -90,7 +93,7 @@ export default class WithKeyring extends Vue {
9093
console.log('ss58Format', val)
9194
// https://github.com/polkadot-js/ui/pull/494
9295
keyring.setSS58Format(Number(val))
93-
this.loadKeyring();
96+
this.loadKeyring(Number(val));
9497
}
9598

9699
// public passwordRequired(address: string): boolean {

0 commit comments

Comments
 (0)