Updates to dev
This commit is contained in:
parent
0e348289ee
commit
84625ab12b
@ -61,7 +61,7 @@
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@crustio/crust-pin": "^1.0.0",
|
||||
"@pinata/sdk": "^1.1.23",
|
||||
"@polkadot/dev": "^0.63.25",
|
||||
"@polkadot/dev": "^0.63.26",
|
||||
"@polkadot/ts": "^0.4.13",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.34",
|
||||
|
||||
@ -88,7 +88,7 @@ export function createPolkadot (t: TFunction): EndpointOption {
|
||||
{
|
||||
info: 'moonbeam',
|
||||
homepage: 'https://moonbeam.foundation',
|
||||
isUnreachable: false,
|
||||
isUnreachable: true,
|
||||
paraId: 2004,
|
||||
text: t('rpc.polkadot.moonbeam', 'Moonbeam', { ns: 'apps-config' }),
|
||||
providers: {
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@polkadot/dev": "^0.63.25",
|
||||
"@polkadot/dev": "^0.63.26",
|
||||
"@polkadot/react-components": "^0.98.2-42",
|
||||
"electron-log": "^4.4.1",
|
||||
"electron-updater": "^4.6.1"
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"@babel/runtime": "^7.16.0",
|
||||
"@polkadot/apps-config": "^0.98.2-42",
|
||||
"@polkadot/apps-routing": "^0.98.2-42",
|
||||
"@polkadot/dev": "^0.63.25",
|
||||
"@polkadot/dev": "^0.63.26",
|
||||
"@polkadot/react-api": "^0.98.2-42",
|
||||
"@polkadot/react-components": "^0.98.2-42",
|
||||
"@polkadot/react-hooks": "^0.98.2-42",
|
||||
|
||||
@ -10,7 +10,7 @@ import execSync from '@polkadot/dev/scripts/execSync.mjs';
|
||||
|
||||
import { createWsEndpoints } from '../packages/apps-config/build/endpoints/index.cjs';
|
||||
|
||||
const pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
||||
console.log('$ scripts/ipfsUpload.mjs', process.argv.slice(2).join(' '));
|
||||
|
||||
// https://gateway.pinata.cloud/ipfs/
|
||||
const GATEWAY = 'https://ipfs.io/ipfs/';
|
||||
@ -21,10 +21,30 @@ const WOPTS = { encoding: 'utf8', flag: 'w' };
|
||||
const PINMETA = { name: DOMAIN };
|
||||
|
||||
const repo = `https://${process.env.GH_PAT}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
||||
const pinata = pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY);
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
const crust = new CrustPinner.default(process.env.CRUST_SEEDS);
|
||||
function createPinata () {
|
||||
try {
|
||||
return pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY);
|
||||
} catch {
|
||||
console.error('Unable to create Pinata');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function createCrust () {
|
||||
try {
|
||||
// eslint-disable-next-line new-cap
|
||||
return new CrustPinner.default(process.env.CRUST_SEEDS);
|
||||
} catch {
|
||||
console.error('Unable to create Crust');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const pinata = createPinata();
|
||||
const crust = createCrust();
|
||||
|
||||
function writeFiles (name, content) {
|
||||
[DST, SRC].forEach((root) =>
|
||||
@ -42,6 +62,12 @@ skip-checks: true"`);
|
||||
}
|
||||
|
||||
async function pin () {
|
||||
if (!pinata) {
|
||||
console.error('Pinata not available, cannot pin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Pin on pinata
|
||||
const result = await pinata.pinFromFS(DST, { pinataMetadata: PINMETA });
|
||||
const url = `${GATEWAY}${result.IpfsHash}/`;
|
||||
@ -66,7 +92,9 @@ async function pin () {
|
||||
updateGh(result.IpfsHash);
|
||||
|
||||
// 2. Decentralized pin on Crust
|
||||
await crust.pin(result.IpfsHash);
|
||||
if (crust) {
|
||||
await crust.pin(result.IpfsHash);
|
||||
}
|
||||
|
||||
console.log(`Pinned ${result.IpfsHash}`);
|
||||
|
||||
@ -74,6 +102,12 @@ async function pin () {
|
||||
}
|
||||
|
||||
async function unpin (exclude) {
|
||||
if (!pinata) {
|
||||
console.error('Pinata not available, cannot unpin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await pinata.pinList({ metadata: PINMETA, status: 'pinned' });
|
||||
|
||||
if (result.count > 1) {
|
||||
@ -121,12 +155,20 @@ async function dnslink (hash) {
|
||||
}
|
||||
|
||||
async function main () {
|
||||
const pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
||||
|
||||
// only run on non-beta versions
|
||||
if (!pkgJson.version.includes('-')) {
|
||||
console.log('Pinning');
|
||||
|
||||
const hash = await pin();
|
||||
|
||||
await dnslink(hash);
|
||||
await unpin(hash);
|
||||
|
||||
console.log('Completed');
|
||||
} else {
|
||||
console.log('Skipping');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
yarn.lock
14
yarn.lock
@ -2849,7 +2849,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@babel/core": ^7.16.0
|
||||
"@babel/polyfill": ^7.12.1
|
||||
"@polkadot/dev": ^0.63.25
|
||||
"@polkadot/dev": ^0.63.26
|
||||
"@polkadot/react-components": ^0.98.2-42
|
||||
"@types/react-dom": ^17.0.11
|
||||
"@types/tmp": ^0.2.2
|
||||
@ -2883,7 +2883,7 @@ __metadata:
|
||||
"@babel/runtime": ^7.16.0
|
||||
"@polkadot/apps-config": ^0.98.2-42
|
||||
"@polkadot/apps-routing": ^0.98.2-42
|
||||
"@polkadot/dev": ^0.63.25
|
||||
"@polkadot/dev": ^0.63.26
|
||||
"@polkadot/react-api": ^0.98.2-42
|
||||
"@polkadot/react-components": ^0.98.2-42
|
||||
"@polkadot/react-hooks": ^0.98.2-42
|
||||
@ -2920,9 +2920,9 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/dev@npm:^0.63.25":
|
||||
version: 0.63.25
|
||||
resolution: "@polkadot/dev@npm:0.63.25"
|
||||
"@polkadot/dev@npm:^0.63.26":
|
||||
version: 0.63.26
|
||||
resolution: "@polkadot/dev@npm:0.63.26"
|
||||
dependencies:
|
||||
"@babel/cli": ^7.16.0
|
||||
"@babel/core": ^7.16.0
|
||||
@ -3007,7 +3007,7 @@ __metadata:
|
||||
polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs
|
||||
polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs
|
||||
polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs
|
||||
checksum: 1822a142f911f1489fe718a4da71379c4fa082d27be416b6b050d1e32d1559580d59c99c3f947b713100e2995536d4203669b7d518abb3cc7e75ae618f08eacc
|
||||
checksum: 531714b546187b96ed0481275088b8929b8a93b7f74ed14ee838a31c380b21867e88242c546ab948947eed783d719d703dabf4529d8a08e0b54df01e0f4f3aff
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -15818,7 +15818,7 @@ __metadata:
|
||||
"@babel/runtime": ^7.16.0
|
||||
"@crustio/crust-pin": ^1.0.0
|
||||
"@pinata/sdk": ^1.1.23
|
||||
"@polkadot/dev": ^0.63.25
|
||||
"@polkadot/dev": ^0.63.26
|
||||
"@polkadot/ts": ^0.4.13
|
||||
"@types/bn.js": ^4.11.6
|
||||
"@types/chart.js": ^2.9.34
|
||||
|
||||
Loading…
Reference in New Issue
Block a user