diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..8b8b7b9
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,6 @@
+{
+ "trailingComma": "es5",
+ "tabWidth": 4,
+ "semi": false,
+ "singleQuote": true
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index dd6769b..4f5e8c7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# Community Voice
-This project uses [bos-loader](https://github.com/near/bos-loader) v0.10.0 to keep track of the widgets required to implement Community Voice on BOS.
+
+This project uses [bos-loader](https://github.com/near/bos-loader) v0.10.0 to keep track of the widgets required to implement Community Voice on BOS.
# How to use
-To use it, download bos-loader as [instructed](https://github.com/near/bos-loader/releases/tag/v0.10.0) and run `npm start`. Then, open https://near.org/flags and paste the following: `http://127.0.0.1:3030` and save flags. Then go to the desired widget, assuming user communityvoice.ndctools.near. As an example, https://near.org/communityvoice.ndctools.near/widget/HelloCV should work, printing `Hello Community Voice`
\ No newline at end of file
+
+To use it, download bos-loader as [instructed](https://github.com/near/bos-loader/releases/tag/v0.10.0) and run `npm start`. Then, open https://near.org/flags and paste the following: `http://127.0.0.1:3030` and save flags. Then go to the desired widget, assuming user chatter.cheddar.near. As an example, https://near.org/chatter.cheddar.near/widget/HelloCV should work, printing `Hello Community Voice`
diff --git a/context.json b/context.json
index a9962ff..be97c6c 100644
--- a/context.json
+++ b/context.json
@@ -1 +1,5 @@
-{"wrapperSrc":"near/widget/DIG.Theme","wrapperProps":{},"networkId":"mainnet"}
\ No newline at end of file
+{
+ "wrapperSrc": "near/widget/DIG.Theme",
+ "wrapperProps": {},
+ "networkId": "mainnet"
+}
diff --git a/deploy.js b/deploy.js
index 37a4d8d..7a3fdd0 100644
--- a/deploy.js
+++ b/deploy.js
@@ -1,23 +1,24 @@
-const path = require("path");
-const { readdirSync, readFileSync, writeFileSync } = require("fs");
-const { keyStores, connect, Contract } = require("near-api-js");
-const { homedir } = require("os");
+const path = require('path')
+const { readdirSync, readFileSync, writeFileSync } = require('fs')
+const { keyStores, connect, Contract } = require('near-api-js')
+const { homedir } = require('os')
-const ACCOUNT = "communityvoice.ndctools.near"
+const ACCOUNT = 'chatter.cheddar.near'
// const ACCOUNT = "silkking.near"
-function getAllFilesNames(addedPath = "") {
- const pathToSearch = path.join("./src", addedPath)
- const foldersToExclude = ["bosTests", "testingWidgets", "tests"]
- const filesToExclude = ["HelloCV.jsx"]
+function getAllFilesNames(addedPath = '') {
+ const pathToSearch = path.join('./src', addedPath)
+ const foldersToExclude = ['bosTests', 'testingWidgets', 'tests']
+ const filesToExclude = ['HelloCV.jsx']
const files = []
- readdirSync(pathToSearch).forEach(file => {
- if(filesToExclude.includes(file) || foldersToExclude.includes(file)) return
+ readdirSync(pathToSearch).forEach((file) => {
+ if (filesToExclude.includes(file) || foldersToExclude.includes(file))
+ return
- const isFile = file.endsWith(".jsx")
- if(isFile) {
+ const isFile = file.endsWith('.jsx')
+ if (isFile) {
files.push(path.join(addedPath, file))
} else {
files.push(...getAllFilesNames(path.join(addedPath, file)))
@@ -27,87 +28,93 @@ function getAllFilesNames(addedPath = "") {
}
async function getContract() {
- const CREDENTIALS_DIR = ".near-credentials";
- const credentialsPath = path.join(homedir(), CREDENTIALS_DIR);
- console.log("credentialsPath", credentialsPath )
- const myKeyStore = new keyStores.UnencryptedFileSystemKeyStore(credentialsPath);
+ const CREDENTIALS_DIR = '.near-credentials'
+ const credentialsPath = path.join(homedir(), CREDENTIALS_DIR)
+ console.log('credentialsPath', credentialsPath)
+ const myKeyStore = new keyStores.UnencryptedFileSystemKeyStore(
+ credentialsPath
+ )
const connectionConfig = {
- networkId: "mainnet",
+ networkId: 'mainnet',
keyStore: myKeyStore, // first create a key store
- nodeUrl: "https://rpc.mainnet.near.org",
- walletUrl: "https://wallet.mainnet.near.org",
- helperUrl: "https://helper.mainnet.near.org",
- explorerUrl: "https://nearblocks.io",
- };
- const nearConnection = await connect(connectionConfig);
+ nodeUrl: 'https://rpc.mainnet.near.org',
+ walletUrl: 'https://wallet.mainnet.near.org',
+ helperUrl: 'https://helper.mainnet.near.org',
+ explorerUrl: 'https://nearblocks.io',
+ }
+ const nearConnection = await connect(connectionConfig)
// const walletConnection = new WalletConnection(nearConnection);
- const account = await nearConnection.account(ACCOUNT);
+ const account = await nearConnection.account(ACCOUNT)
const contract = new Contract(
- account , // the account object that is connecting
- "social.near",
+ account, // the account object that is connecting
+ 'social.near',
{
// name of contract you're connecting to
viewMethods: [], // view methods do not change state but usually return a value
- changeMethods: ["set"], // change methods modify state
+ changeMethods: ['set'], // change methods modify state
}
- );
+ )
return contract
}
function getWidgetsJsons(files) {
- return files.map(file => {
- const fileContent = readFileSync(path.join("./src", file), "utf-8").toString()
-
- const widgetName = file.replace(".jsx", "").split("/").join(".")
+ return files.map((file) => {
+ const fileContent = readFileSync(
+ path.join('./src', file),
+ 'utf-8'
+ ).toString()
+
+ const widgetName = file.replace('.jsx', '').split('/').join('.')
return {
[ACCOUNT]: {
widget: {
[widgetName]: {
- "": fileContent
- }
- }
- }
+ '': fileContent,
+ },
+ },
+ },
}
})
}
-function sleep(ms){
- return new Promise(resolve => setTimeout(resolve, ms));
-};
+function sleep(ms) {
+ return new Promise((resolve) => setTimeout(resolve, ms))
+}
async function run() {
const indexesToDeploy = []
const indexesWithError = []
const files = getAllFilesNames()
-
+
const widgetJsons = getWidgetsJsons(files)
-
+
const socialContract = await getContract()
- for(let i = 29; i < widgetJsons.length; i++) {
- if(indexesToDeploy.length > 0 && !indexesToDeploy.includes(i)) continue
+ for (let i = 0; i < widgetJsons.length; i++) {
+ if (indexesToDeploy.length > 0 && !indexesToDeploy.includes(i)) continue
const json = widgetJsons[i]
const widgetName = Object.keys(json[ACCOUNT].widget)[0]
- console.log("Deploying widget with index", i, widgetName)
+ console.log('Deploying widget with index', i, widgetName)
try {
- await socialContract.set({
- data: json
- },
- "300000000000000",
- "1" + "0".repeat(21))
- console.log("Deployed", widgetName)
- } catch(err) {
- console.log("Error deploying widget with index", i)
+ await socialContract.set(
+ {
+ data: json,
+ },
+ '300000000000000',
+ '1' + '0'.repeat(21)
+ )
+ console.log('Deployed', widgetName)
+ } catch (err) {
+ console.log('Error deploying widget with index', i)
console.log(err)
indexesWithError.push(i)
} finally {
await sleep(1521)
}
}
- console.log("Indexes with error", indexesWithError)
-
+ console.log('Indexes with error', indexesWithError)
}
-run()
\ No newline at end of file
+run()
diff --git a/flags.json b/flags.json
index 33c7ec2..7c1cb51 100644
--- a/flags.json
+++ b/flags.json
@@ -1 +1 @@
-{"components":{}}
\ No newline at end of file
+{ "components": {} }
diff --git a/package-lock.json b/package-lock.json
index a8fa629..1b90c4c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,490 +1,490 @@
{
- "name": "community_voice",
- "version": "1.0.0",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {
- "": {
- "name": "community_voice",
- "version": "1.0.0",
- "license": "ISC",
- "dependencies": {
- "fs": "^0.0.1-security",
- "near-api-js": "^3.0.4",
- "path": "^0.12.7"
- }
- },
- "node_modules/@near-js/accounts": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@near-js/accounts/-/accounts-1.0.4.tgz",
- "integrity": "sha512-6zgSwq/rQ9ggPOIkGUx9RoEurbJiojqA/axeh6o1G+46GqUBI7SUcDooyVvZjeiOvUPObnTQptDYpbV+XZji8g==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/providers": "0.1.1",
- "@near-js/signers": "0.1.1",
- "@near-js/transactions": "1.1.2",
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "ajv": "8.11.2",
- "ajv-formats": "2.1.1",
- "bn.js": "5.2.1",
- "borsh": "1.0.0",
- "depd": "2.0.0",
- "lru_map": "0.4.1",
- "near-abi": "0.1.1"
- }
- },
- "node_modules/@near-js/crypto": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@near-js/crypto/-/crypto-1.2.1.tgz",
- "integrity": "sha512-iJOHaGKvdudYfR8nEtRhGlgcTEHeVmxMoT0JVXmuP3peG96v/sSnA03CE6MZBeCC8txKAQOffagxE7oU6hJp9g==",
- "dependencies": {
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "@noble/curves": "1.2.0",
- "bn.js": "5.2.1",
- "borsh": "1.0.0",
- "randombytes": "2.1.0"
- }
- },
- "node_modules/@near-js/keystores": {
- "version": "0.0.9",
- "resolved": "https://registry.npmjs.org/@near-js/keystores/-/keystores-0.0.9.tgz",
- "integrity": "sha512-j8ySgVEcm2Gg6zxkSdadNtPlIqhJZdPGfWWM3tPtEoowNS9snhwZn5NRFPrgmX0+MzpF7E091CRcY90MvRVhsg==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/types": "0.0.4"
- }
- },
- "node_modules/@near-js/keystores-browser": {
- "version": "0.0.9",
- "resolved": "https://registry.npmjs.org/@near-js/keystores-browser/-/keystores-browser-0.0.9.tgz",
- "integrity": "sha512-JzPj+RHJN2G3CEm/LyfbtZDQy/wxgOlqfh52voqPGijUHg93b27KBqtZShazAgJNkhzRbWcoluWQnd2jL8vF7A==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/keystores": "0.0.9"
- }
- },
- "node_modules/@near-js/keystores-node": {
- "version": "0.0.9",
- "resolved": "https://registry.npmjs.org/@near-js/keystores-node/-/keystores-node-0.0.9.tgz",
- "integrity": "sha512-2B9MYz6uIhysG1fhQSjvaPYCM7gM+UAeDchX0J8QRauXIeN8TGzpcdgkdkMUnWNTIdt3Iblh0ZuCs+FY02dTXg==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/keystores": "0.0.9"
- }
- },
- "node_modules/@near-js/providers": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@near-js/providers/-/providers-0.1.1.tgz",
- "integrity": "sha512-0M/Vz2Ac34ShKVoe2ftVJ5Qg4eSbEqNXDbCDOdVj/2qbLWZa7Wpe+me5ei4TMY2ZhGdawhgJUPrYwdJzOCyf8w==",
- "dependencies": {
- "@near-js/transactions": "1.1.2",
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "bn.js": "5.2.1",
- "borsh": "1.0.0",
- "http-errors": "1.7.2"
- },
- "optionalDependencies": {
- "node-fetch": "2.6.7"
- }
- },
- "node_modules/@near-js/signers": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@near-js/signers/-/signers-0.1.1.tgz",
- "integrity": "sha512-focJgs04dBUfawMnyGg3yIjaMawuVz2OeLRKC4t5IQDmO4PLfdIraEuwgS7tckMq3GdrJ7nqkwkpSNYpdt7I5Q==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/keystores": "0.0.9",
- "@noble/hashes": "1.3.3"
- }
- },
- "node_modules/@near-js/transactions": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@near-js/transactions/-/transactions-1.1.2.tgz",
- "integrity": "sha512-AqYA56ncwgrWjIu+bNaWjTPRZb0O+SfpWIP7U+1FKNKxNYMCtkt6zp7SlQeZn743shKVq9qMzA9+ous/KCb0QQ==",
- "dependencies": {
- "@near-js/crypto": "1.2.1",
- "@near-js/signers": "0.1.1",
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "@noble/hashes": "1.3.3",
- "bn.js": "5.2.1",
- "borsh": "1.0.0"
- }
- },
- "node_modules/@near-js/types": {
- "version": "0.0.4",
- "resolved": "https://registry.npmjs.org/@near-js/types/-/types-0.0.4.tgz",
- "integrity": "sha512-8TTMbLMnmyG06R5YKWuS/qFG1tOA3/9lX4NgBqQPsvaWmDsa+D+QwOkrEHDegped0ZHQwcjAXjKML1S1TyGYKg==",
- "dependencies": {
- "bn.js": "5.2.1"
- }
- },
- "node_modules/@near-js/utils": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@near-js/utils/-/utils-0.1.0.tgz",
- "integrity": "sha512-kOVAXmJzaC8ElJD3RLEoBuqOK+d5s7jc0JkvhyEtbuEmXYHHAy9Q17/YkDcX9tyr01L85iOt66z0cODqzgtQwA==",
- "dependencies": {
- "@near-js/types": "0.0.4",
- "bn.js": "5.2.1",
- "bs58": "4.0.0",
- "depd": "2.0.0",
- "mustache": "4.0.0"
- }
- },
- "node_modules/@near-js/wallet-account": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@near-js/wallet-account/-/wallet-account-1.1.1.tgz",
- "integrity": "sha512-NnoJKtogBQ7Qz+AP+LdF70BP8Az6UXQori7OjPqJLMo73bn6lh5Ywvegwd1EB7ZEVe4BRt9+f9QkbU5M8ANfAw==",
- "dependencies": {
- "@near-js/accounts": "1.0.4",
- "@near-js/crypto": "1.2.1",
- "@near-js/keystores": "0.0.9",
- "@near-js/signers": "0.1.1",
- "@near-js/transactions": "1.1.2",
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "bn.js": "5.2.1",
- "borsh": "1.0.0"
- }
- },
- "node_modules/@noble/curves": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
- "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
- "dependencies": {
- "@noble/hashes": "1.3.2"
- },
- "funding": {
- "url": "https://paulmillr.com/funding/"
- }
- },
- "node_modules/@noble/curves/node_modules/@noble/hashes": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
- "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
- "engines": {
- "node": ">= 16"
- },
- "funding": {
- "url": "https://paulmillr.com/funding/"
- }
- },
- "node_modules/@noble/hashes": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz",
- "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==",
- "engines": {
- "node": ">= 16"
- },
- "funding": {
- "url": "https://paulmillr.com/funding/"
- }
- },
- "node_modules/@types/json-schema": {
- "version": "7.0.15",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
- "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
- },
- "node_modules/ajv": {
- "version": "8.11.2",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz",
- "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==",
- "dependencies": {
- "fast-deep-equal": "^3.1.1",
- "json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/epoberezkin"
- }
- },
- "node_modules/ajv-formats": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
- "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
- "dependencies": {
- "ajv": "^8.0.0"
- },
- "peerDependencies": {
- "ajv": "^8.0.0"
- },
- "peerDependenciesMeta": {
- "ajv": {
- "optional": true
- }
- }
- },
- "node_modules/base-x": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/base-x/-/base-x-2.0.6.tgz",
- "integrity": "sha512-UAmjxz9KbK+YIi66xej+pZVo/vxUOh49ubEvZW5egCbxhur05pBb+hwuireQwKO4nDpsNm64/jEei17LEpsr5g==",
- "deprecated": "use 3.0.0 instead, safe-buffer has been merged and release for compatability",
- "dependencies": {
- "safe-buffer": "^5.0.1"
- },
- "engines": {
- "node": ">=4.5.0"
- }
- },
- "node_modules/bn.js": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
- "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="
- },
- "node_modules/borsh": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/borsh/-/borsh-1.0.0.tgz",
- "integrity": "sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ=="
- },
- "node_modules/bs58": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.0.tgz",
- "integrity": "sha512-/jcGuUuSebyxwLLfKrbKnCJttxRf9PM51EnHTwmFKBxl4z1SGkoAhrfd6uZKE0dcjQTfm6XzTP8DPr1tzE4KIw==",
- "dependencies": {
- "base-x": "^2.0.1"
- }
- },
- "node_modules/depd": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
- "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/fast-deep-equal": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
- "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
- },
- "node_modules/fs": {
- "version": "0.0.1-security",
- "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
- "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
- },
- "node_modules/http-errors": {
- "version": "1.7.2",
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
- "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
- "dependencies": {
- "depd": "~1.1.2",
- "inherits": "2.0.3",
- "setprototypeof": "1.1.1",
- "statuses": ">= 1.5.0 < 2",
- "toidentifier": "1.0.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/http-errors/node_modules/depd": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
- "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/inherits": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
- "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
- },
- "node_modules/json-schema-traverse": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
- "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
- },
- "node_modules/lru_map": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.4.1.tgz",
- "integrity": "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg=="
- },
- "node_modules/mustache": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.0.0.tgz",
- "integrity": "sha512-FJgjyX/IVkbXBXYUwH+OYwQKqWpFPLaLVESd70yHjSDunwzV2hZOoTBvPf4KLoxesUzzyfTH6F784Uqd7Wm5yA==",
- "bin": {
- "mustache": "bin/mustache"
- },
- "engines": {
- "npm": ">=1.4.0"
- }
- },
- "node_modules/near-abi": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/near-abi/-/near-abi-0.1.1.tgz",
- "integrity": "sha512-RVDI8O+KVxRpC3KycJ1bpfVj9Zv+xvq9PlW1yIFl46GhrnLw83/72HqHGjGDjQ8DtltkcpSjY9X3YIGZ+1QyzQ==",
- "dependencies": {
- "@types/json-schema": "^7.0.11"
- }
- },
- "node_modules/near-api-js": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/near-api-js/-/near-api-js-3.0.4.tgz",
- "integrity": "sha512-qKWjnugoB7kSFhzZ5GXyH/eABspCQYWBmWnM4hpV5ctnQBt89LqgEu9yD1z4sa89MvUu8BuCxwb1m00BE8iofg==",
- "dependencies": {
- "@near-js/accounts": "1.0.4",
- "@near-js/crypto": "1.2.1",
- "@near-js/keystores": "0.0.9",
- "@near-js/keystores-browser": "0.0.9",
- "@near-js/keystores-node": "0.0.9",
- "@near-js/providers": "0.1.1",
- "@near-js/signers": "0.1.1",
- "@near-js/transactions": "1.1.2",
- "@near-js/types": "0.0.4",
- "@near-js/utils": "0.1.0",
- "@near-js/wallet-account": "1.1.1",
- "@noble/curves": "1.2.0",
- "ajv": "8.11.2",
- "ajv-formats": "2.1.1",
- "bn.js": "5.2.1",
- "borsh": "1.0.0",
- "depd": "2.0.0",
- "http-errors": "1.7.2",
- "near-abi": "0.1.1",
- "node-fetch": "2.6.7"
- }
- },
- "node_modules/node-fetch": {
- "version": "2.6.7",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
- "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
- "dependencies": {
- "whatwg-url": "^5.0.0"
- },
- "engines": {
- "node": "4.x || >=6.0.0"
- },
- "peerDependencies": {
- "encoding": "^0.1.0"
- },
- "peerDependenciesMeta": {
- "encoding": {
- "optional": true
- }
- }
- },
- "node_modules/path": {
- "version": "0.12.7",
- "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
- "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
- "dependencies": {
- "process": "^0.11.1",
- "util": "^0.10.3"
- }
- },
- "node_modules/process": {
- "version": "0.11.10",
- "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
- "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
- "engines": {
- "node": ">= 0.6.0"
- }
- },
- "node_modules/punycode": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
- "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/randombytes": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
- "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
- "dependencies": {
- "safe-buffer": "^5.1.0"
- }
- },
- "node_modules/require-from-string": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
- "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
+ "name": "community_voice",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "community_voice",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "fs": "^0.0.1-security",
+ "near-api-js": "^3.0.4",
+ "path": "^0.12.7"
+ }
+ },
+ "node_modules/@near-js/accounts": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@near-js/accounts/-/accounts-1.0.4.tgz",
+ "integrity": "sha512-6zgSwq/rQ9ggPOIkGUx9RoEurbJiojqA/axeh6o1G+46GqUBI7SUcDooyVvZjeiOvUPObnTQptDYpbV+XZji8g==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/providers": "0.1.1",
+ "@near-js/signers": "0.1.1",
+ "@near-js/transactions": "1.1.2",
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "ajv": "8.11.2",
+ "ajv-formats": "2.1.1",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0",
+ "depd": "2.0.0",
+ "lru_map": "0.4.1",
+ "near-abi": "0.1.1"
+ }
+ },
+ "node_modules/@near-js/crypto": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@near-js/crypto/-/crypto-1.2.1.tgz",
+ "integrity": "sha512-iJOHaGKvdudYfR8nEtRhGlgcTEHeVmxMoT0JVXmuP3peG96v/sSnA03CE6MZBeCC8txKAQOffagxE7oU6hJp9g==",
+ "dependencies": {
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "@noble/curves": "1.2.0",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0",
+ "randombytes": "2.1.0"
+ }
+ },
+ "node_modules/@near-js/keystores": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/@near-js/keystores/-/keystores-0.0.9.tgz",
+ "integrity": "sha512-j8ySgVEcm2Gg6zxkSdadNtPlIqhJZdPGfWWM3tPtEoowNS9snhwZn5NRFPrgmX0+MzpF7E091CRcY90MvRVhsg==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/types": "0.0.4"
+ }
+ },
+ "node_modules/@near-js/keystores-browser": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/@near-js/keystores-browser/-/keystores-browser-0.0.9.tgz",
+ "integrity": "sha512-JzPj+RHJN2G3CEm/LyfbtZDQy/wxgOlqfh52voqPGijUHg93b27KBqtZShazAgJNkhzRbWcoluWQnd2jL8vF7A==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/keystores": "0.0.9"
+ }
+ },
+ "node_modules/@near-js/keystores-node": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/@near-js/keystores-node/-/keystores-node-0.0.9.tgz",
+ "integrity": "sha512-2B9MYz6uIhysG1fhQSjvaPYCM7gM+UAeDchX0J8QRauXIeN8TGzpcdgkdkMUnWNTIdt3Iblh0ZuCs+FY02dTXg==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/keystores": "0.0.9"
+ }
+ },
+ "node_modules/@near-js/providers": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/@near-js/providers/-/providers-0.1.1.tgz",
+ "integrity": "sha512-0M/Vz2Ac34ShKVoe2ftVJ5Qg4eSbEqNXDbCDOdVj/2qbLWZa7Wpe+me5ei4TMY2ZhGdawhgJUPrYwdJzOCyf8w==",
+ "dependencies": {
+ "@near-js/transactions": "1.1.2",
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0",
+ "http-errors": "1.7.2"
+ },
+ "optionalDependencies": {
+ "node-fetch": "2.6.7"
+ }
+ },
+ "node_modules/@near-js/signers": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/@near-js/signers/-/signers-0.1.1.tgz",
+ "integrity": "sha512-focJgs04dBUfawMnyGg3yIjaMawuVz2OeLRKC4t5IQDmO4PLfdIraEuwgS7tckMq3GdrJ7nqkwkpSNYpdt7I5Q==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/keystores": "0.0.9",
+ "@noble/hashes": "1.3.3"
+ }
+ },
+ "node_modules/@near-js/transactions": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@near-js/transactions/-/transactions-1.1.2.tgz",
+ "integrity": "sha512-AqYA56ncwgrWjIu+bNaWjTPRZb0O+SfpWIP7U+1FKNKxNYMCtkt6zp7SlQeZn743shKVq9qMzA9+ous/KCb0QQ==",
+ "dependencies": {
+ "@near-js/crypto": "1.2.1",
+ "@near-js/signers": "0.1.1",
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "@noble/hashes": "1.3.3",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0"
+ }
+ },
+ "node_modules/@near-js/types": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/@near-js/types/-/types-0.0.4.tgz",
+ "integrity": "sha512-8TTMbLMnmyG06R5YKWuS/qFG1tOA3/9lX4NgBqQPsvaWmDsa+D+QwOkrEHDegped0ZHQwcjAXjKML1S1TyGYKg==",
+ "dependencies": {
+ "bn.js": "5.2.1"
+ }
+ },
+ "node_modules/@near-js/utils": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@near-js/utils/-/utils-0.1.0.tgz",
+ "integrity": "sha512-kOVAXmJzaC8ElJD3RLEoBuqOK+d5s7jc0JkvhyEtbuEmXYHHAy9Q17/YkDcX9tyr01L85iOt66z0cODqzgtQwA==",
+ "dependencies": {
+ "@near-js/types": "0.0.4",
+ "bn.js": "5.2.1",
+ "bs58": "4.0.0",
+ "depd": "2.0.0",
+ "mustache": "4.0.0"
+ }
+ },
+ "node_modules/@near-js/wallet-account": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@near-js/wallet-account/-/wallet-account-1.1.1.tgz",
+ "integrity": "sha512-NnoJKtogBQ7Qz+AP+LdF70BP8Az6UXQori7OjPqJLMo73bn6lh5Ywvegwd1EB7ZEVe4BRt9+f9QkbU5M8ANfAw==",
+ "dependencies": {
+ "@near-js/accounts": "1.0.4",
+ "@near-js/crypto": "1.2.1",
+ "@near-js/keystores": "0.0.9",
+ "@near-js/signers": "0.1.1",
+ "@near-js/transactions": "1.1.2",
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0"
+ }
+ },
+ "node_modules/@noble/curves": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
+ "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
+ "dependencies": {
+ "@noble/hashes": "1.3.2"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/curves/node_modules/@noble/hashes": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
+ "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/hashes": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz",
+ "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==",
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
+ },
+ "node_modules/ajv": {
+ "version": "8.11.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz",
+ "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ajv-formats": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
+ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/base-x": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-2.0.6.tgz",
+ "integrity": "sha512-UAmjxz9KbK+YIi66xej+pZVo/vxUOh49ubEvZW5egCbxhur05pBb+hwuireQwKO4nDpsNm64/jEei17LEpsr5g==",
+ "deprecated": "use 3.0.0 instead, safe-buffer has been merged and release for compatability",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=4.5.0"
+ }
+ },
+ "node_modules/bn.js": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
+ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="
+ },
+ "node_modules/borsh": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/borsh/-/borsh-1.0.0.tgz",
+ "integrity": "sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ=="
+ },
+ "node_modules/bs58": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.0.tgz",
+ "integrity": "sha512-/jcGuUuSebyxwLLfKrbKnCJttxRf9PM51EnHTwmFKBxl4z1SGkoAhrfd6uZKE0dcjQTfm6XzTP8DPr1tzE4KIw==",
+ "dependencies": {
+ "base-x": "^2.0.1"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
+ },
+ "node_modules/fs": {
+ "version": "0.0.1-security",
+ "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
+ "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
+ },
+ "node_modules/http-errors": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
+ "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
+ "dependencies": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.1",
+ "statuses": ">= 1.5.0 < 2",
+ "toidentifier": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/http-errors/node_modules/depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
+ "node_modules/lru_map": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.4.1.tgz",
+ "integrity": "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg=="
+ },
+ "node_modules/mustache": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.0.0.tgz",
+ "integrity": "sha512-FJgjyX/IVkbXBXYUwH+OYwQKqWpFPLaLVESd70yHjSDunwzV2hZOoTBvPf4KLoxesUzzyfTH6F784Uqd7Wm5yA==",
+ "bin": {
+ "mustache": "bin/mustache"
+ },
+ "engines": {
+ "npm": ">=1.4.0"
+ }
+ },
+ "node_modules/near-abi": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/near-abi/-/near-abi-0.1.1.tgz",
+ "integrity": "sha512-RVDI8O+KVxRpC3KycJ1bpfVj9Zv+xvq9PlW1yIFl46GhrnLw83/72HqHGjGDjQ8DtltkcpSjY9X3YIGZ+1QyzQ==",
+ "dependencies": {
+ "@types/json-schema": "^7.0.11"
+ }
+ },
+ "node_modules/near-api-js": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/near-api-js/-/near-api-js-3.0.4.tgz",
+ "integrity": "sha512-qKWjnugoB7kSFhzZ5GXyH/eABspCQYWBmWnM4hpV5ctnQBt89LqgEu9yD1z4sa89MvUu8BuCxwb1m00BE8iofg==",
+ "dependencies": {
+ "@near-js/accounts": "1.0.4",
+ "@near-js/crypto": "1.2.1",
+ "@near-js/keystores": "0.0.9",
+ "@near-js/keystores-browser": "0.0.9",
+ "@near-js/keystores-node": "0.0.9",
+ "@near-js/providers": "0.1.1",
+ "@near-js/signers": "0.1.1",
+ "@near-js/transactions": "1.1.2",
+ "@near-js/types": "0.0.4",
+ "@near-js/utils": "0.1.0",
+ "@near-js/wallet-account": "1.1.1",
+ "@noble/curves": "1.2.0",
+ "ajv": "8.11.2",
+ "ajv-formats": "2.1.1",
+ "bn.js": "5.2.1",
+ "borsh": "1.0.0",
+ "depd": "2.0.0",
+ "http-errors": "1.7.2",
+ "near-abi": "0.1.1",
+ "node-fetch": "2.6.7"
+ }
+ },
+ "node_modules/node-fetch": {
+ "version": "2.6.7",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/path": {
+ "version": "0.12.7",
+ "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
+ "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
+ "dependencies": {
+ "process": "^0.11.1",
+ "util": "^0.10.3"
+ }
+ },
+ "node_modules/process": {
+ "version": "0.11.10",
+ "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
+ "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
+ "engines": {
+ "node": ">= 0.6.0"
+ }
+ },
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dependencies": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "node_modules/require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
+ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
+ },
+ "node_modules/statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
+ "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/util": {
+ "version": "0.10.4",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
+ "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
+ "dependencies": {
+ "inherits": "2.0.3"
+ }
+ },
+ "node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
+ },
+ "node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
}
- ]
- },
- "node_modules/setprototypeof": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
- "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
- },
- "node_modules/statuses": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
- "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/toidentifier": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
- "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
- "engines": {
- "node": ">=0.6"
- }
- },
- "node_modules/tr46": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
- "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
- },
- "node_modules/uri-js": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
- "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
- "dependencies": {
- "punycode": "^2.1.0"
- }
- },
- "node_modules/util": {
- "version": "0.10.4",
- "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
- "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
- "dependencies": {
- "inherits": "2.0.3"
- }
- },
- "node_modules/webidl-conversions": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
- "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
- },
- "node_modules/whatwg-url": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
- "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
- "dependencies": {
- "tr46": "~0.0.3",
- "webidl-conversions": "^3.0.0"
- }
}
- }
}
diff --git a/package.json b/package.json
index 283b30c..d0890c5 100644
--- a/package.json
+++ b/package.json
@@ -1,18 +1,19 @@
{
- "name": "community_voice",
- "version": "1.0.0",
- "description": "This project uses [bos-loader](https://github.com/near/bos-loader)v0.10.0 to keep track of the widgets required to implement Community Voice on BOS.",
- "main": "index.js",
- "scripts": {
- "start": "bos-loader communityvoice.ndctools.near --path ./src",
- "test": "echo \"Error: no test specified\" && exit 1",
- "deploy": "node deploy.js"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "fs": "^0.0.1-security",
- "near-api-js": "^3.0.4",
- "path": "^0.12.7"
- }
+ "name": "community_voice",
+ "version": "1.0.0",
+ "description": "This project uses [bos-loader](https://github.com/near/bos-loader)v0.10.0 to keep track of the widgets required to implement Community Voice on BOS.",
+ "main": "index.js",
+ "scripts": {
+ "start": "bos-loader chatter.cheddar.near --path ./src",
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "deploy": "node deploy.js",
+ "fmt": "prettier --write '**/*.{js,jsx,ts,tsx,json}'"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "fs": "^0.0.1-security",
+ "near-api-js": "^3.0.4",
+ "path": "^0.12.7"
+ }
}
diff --git a/props.json b/props.json
index 9e26dfe..0967ef4 100644
--- a/props.json
+++ b/props.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{}
diff --git a/src/Cheddar/AddComment.jsx b/src/Cheddar/AddComment.jsx
new file mode 100644
index 0000000..28d6003
--- /dev/null
+++ b/src/Cheddar/AddComment.jsx
@@ -0,0 +1,502 @@
+// Cheddar.AddComment
+const { createComment, editComment } = VM.require(
+ 'chatter.cheddar.near/widget/lib.comment'
+) || { createComment: () => {}, editComment: () => {} }
+const { getConfig } = VM.require(
+ 'chatter.cheddar.near/widget/config.CommunityVoice'
+) || { getConfig: () => {} }
+
+const {
+ widgets,
+ isTest,
+ article,
+ onCloseModal,
+ originalComment,
+ isReplying,
+ username,
+ placement,
+ rootCommentId,
+ replyingTo,
+ baseActions,
+ editionData,
+ loadComments,
+ setLoadingComments,
+} = props
+
+const rootId = rootCommentId ?? article.value.metadata.id //To render in the proper location
+
+const commentId = editionData ? editionData.value.metadata.id : undefined //(OPTIONAL) to edit comment
+
+const isEdition = commentId !== undefined
+
+const ModalCard = styled.div`
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: rgba(0, 0, 0, 0.7);
+`
+const CommentCard = styled.div`
+ display: flex;
+ width: 400px;
+ padding: 20px;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 16px;
+ border-radius: 10px;
+ background: #fff;
+ border: 1px solid transparent;
+ margin-left: auto;
+ margin-right: auto;
+ margin-buttom: 50%;
+ @media only screen and (max-width: 480px) {
+ width: 90%;
+ }
+`
+const H1 = styled.h1`
+ color: black;
+ font-size: 14px;
+ font-weight: 500;
+`
+const Container = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 20px;
+ align-self: stretch;
+`
+const CommentBody = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 16px;
+ align-self: stretch;
+`
+const BComment = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 8px;
+ align-self: stretch;
+`
+const BCommentmessage = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 8px;
+ align-self: stretch;
+`
+const BCMHeader = styled.div`
+ display: flex;
+ width: 100%;
+ align-items: center;
+ gap: 8px;
+`
+const BCMProfile = styled.div`
+ width: 28px;
+ height: 28px;
+ flex-shrink: 0;
+ flex-direction: row;
+ border-radius: 29px;
+ background: #d0d6d9;
+ text-align: center;
+`
+const BCMProfileimg = styled.img`
+ width: 28px;
+ height: 28px;
+ flex-shrink: 0;
+ vertical-align: initial;
+`
+const BCMProfileUsername = styled.label`
+ display: flex;
+ width: 100%;
+ flex-direction: column;
+ justify-content: center;
+ flex-shrink: 0;
+ color: #000;
+ font-size: 14px;
+
+ font-style: normal;
+ font-weight: 500;
+ line-height: 120%;
+`
+const BCMMessage = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-self: stretch;
+ color: #686b6d;
+ font-size: 14px;
+
+ font-style: normal;
+ font-weight: 400;
+ line-height: 120%;
+`
+const BFooter = styled.div`
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-start;
+ gap: 4px;
+ align-self: stretch;
+`
+const BFootercont = styled.div`
+ display: flex;
+ align-items: center;
+ align-self: stretch;
+`
+const BFootercontTime = styled.div`
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ flex: 1 0 0;
+`
+const BFCTimetext = styled.div`
+ display: flex;
+ height: 19.394px;
+ flex-direction: column;
+ justify-content: center;
+ flex: 1 0 0;
+ color: #000;
+ font-size: 14px;
+
+ font-style: normal;
+ font-weight: 300;
+ line-height: normal;
+`
+const BFCButton = styled.div`
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ gap: 4px;
+`
+const BFCButtonitem = styled.button`
+ display: flex;
+ padding: 2px 12px;
+ align-items: center;
+ gap: 6px;
+ border-radius: 4px;
+ border-width: 1px;
+ border: solid 1px #9333ea;
+
+ background-image: linear-gradient(#fff, #fff),
+ radial-gradient(circle at top left, #f0e1ce, #f0e1ce);
+ background-origin: border-box;
+ background-clip: padding-box, border-box;
+`
+const BFCBIText = styled.label`
+ font-size: 12px;
+
+ font-style: normal;
+ font-weight: 500;
+ line-height: 24px;
+ color: #9333ea;
+ cursor: pointer;
+`
+const NewComment = styled.textarea`
+ width: 100%;
+ display: flex;
+ height: 100px;
+ padding: 9px 10px 0px 10px;
+ align-items: flex-start;
+
+ gap: 10px;
+ align-self: stretch;
+ border-radius: 8px;
+ border: 1px solid #d0d6d9;
+ background: #fff;
+
+ font-size: 12px;
+
+ font-style: normal;
+ font-weight: 400;
+ line-height: 120%;
+`
+const CommentFooter = styled.div`
+ display: flex;
+ flex-direction: row;
+ align-items: flex-end;
+ justify-content: end;
+ gap: 16px;
+ align-self: stretch;
+`
+const CFCancel = styled.button`
+ display: flex;
+ width: 107px;
+ padding: 8px 12px;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ color: #9333ea;
+ border-radius: 10px;
+ border-width: 1px;
+ border: solid 1px #9333ea;
+
+ background-image: linear-gradient(#fff, #fff),
+ radial-gradient(circle at top left, #f0e1ce, #f0e1ce);
+ background-origin: border-box;
+ background-clip: padding-box, border-box;
+ @media only screen and (max-width: 480px) {
+ width: 100%;
+ }
+`
+
+const CFSubmit = styled.button`
+ display: flex;
+ width: 107px;
+ padding: 8px 12px;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ color: #000;
+ display: flex;
+ width: 107px;
+ padding: 8px 12px;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ border-radius: 10px;
+ border-width: 1px;
+ border: solid 1px transparent;
+
+ background-image: linear-gradient(#ffd50d, #ffd50d),
+ radial-gradient(circle at top left, #f0e1ce, #f0e1ce);
+ background-origin: border-box;
+ background-clip: padding-box, border-box;
+ @media only screen and (max-width: 480px) {
+ width: 100%;
+ }
+`
+
+const Spinner = styled.div`
+ height: 1rem;
+ width: 1rem;
+`
+
+const CallLibrary = styled.div`
+ display: none;
+`
+
+State.init({
+ theme,
+ reply: '',
+ cancel: false,
+ e_message: '',
+})
+
+function getShouldDisplayOriginalComment() {
+ return (
+ (!editionData && replyingTo) ||
+ (editionData &&
+ replyingTo &&
+ editionData.value.metadata.id !== editionData.value.metadata.rootId)
+ )
+}
+
+function getInitialText() {
+ if (editionData) {
+ if (
+ !state.reply ||
+ editionData.value.commentData.text === state.reply
+ ) {
+ return editionData.value.commentData.text
+ }
+ } else if (replyingTo) {
+ return `@${replyingTo} `
+ } else if (
+ state.reply &&
+ state.reply !== editionData.value.commentData.text
+ ) {
+ return state.reply
+ } else {
+ return 'Reply here'
+ }
+}
+
+const SetText = (txt) => {
+ State.update({ shareText: txt })
+}
+
+const renderSpinner = () => {
+ return
+ {isReplying
+ ? 'Reply to comment'
+ : isEdition
+ ? 'Edit comment'
+ : 'Add a Comment'}
+
+
+ >
+ )}
+
+ Topics for Community SBT Holders. +
+ + } + > + +Button passed wrong
+ // ) : ( + //Topics for Community SBT Holders.
- - } - > - -Button passed wrong
- // ) : ( - //{JSON.stringify(state.tags)}-
{JSON.stringify(state.tags)}+
{error}
- ) : Array.isArray(error) ? ( - error.map((e) => ( -{e}
- )) - ) : ( -- Error passed wrongly -
- )} - {filteredErrorResults[fn].errorList.length > 1 && ( -+ {error} +
+ ) : Array.isArray( + error + ) ? ( + error.map( + (e) => ( ++ {e} +
+ ) + ) + ) : ( ++ Error passed + wrongly +
+ )} + {filteredErrorResults[ + fn + ].errorList.length > + 1 &&Loading...
); +const [asyncComponent, setAsyncComponent] = useState(Loading...
) // displayTestsAsyncResults(/*[ // { @@ -473,73 +476,74 @@ const [asyncComponent, setAsyncComponent] = useState(Loading...
); // }); displayTestsAsyncResults([ - { - fnName: "testGetArticlesIndexes", - fn: testGetArticlesIndexes, - description: "Should get an array of article index", - }, + { + fnName: 'testGetArticlesIndexes', + fn: testGetArticlesIndexes, + description: 'Should get an array of article index', + }, ]).then((res) => { - setAsyncComponent(res); -}); + setAsyncComponent(res) +}) return ( - <> - {displayTestsSyncResults([ - // { - // fnName: "testLatestEditsRepeatedArticle", - // fn: testLatestEditsRepeatedArticle, - // description: "Should remove repeated articles keeping newest", - // }, - { - fnName: "testLatestEditEmptyIndex", - fn: testLatestEditEmptyIndex, - }, - // { - // fnName: "testGetArticleNormalized", - // fn: testGetArticleNormalized, - // }, - { - fnName: "testGetActionInIsTestPassingParameters", - fn: testGetActionInIsTestPassingParameters, - description: "Should get the propper action", - }, - { - fnName: "testGetActionInIsTestNotPassingParameters", - fn: testGetActionInIsTestNotPassingParameters, - description: "Should get the propper action", - }, - { - fnName: "testGetActionPassingParameters", - fn: testGetActionPassingParameters, - description: "Should get the propper action", - }, - { - fnName: "testGetActionNotPassingParameters", - fn: testGetActionNotPassingParameters, - description: "Should get the propper action", - }, - { - fnName: "testFilterFakeAuthorsMatchAuthor", - fn: testFilterFakeAuthorsMatchAuthor, - description: "Test if filtering is working propperly", - }, - { - fnName: "testFilterFakeAuthorsAuthorDoesntMatch", - fn: testFilterFakeAuthorsAuthorDoesntMatch, - description: "Test if filtering is working propperly", - }, - { - fnName: "testGetArticleBlackListByArticleIdReturnValidAccountIds", - fn: testGetArticleBlackListByArticleIdReturnValidAccountIds, - description: - "Test if getArticleBlackListByArticle returns valid articleId's", - }, - { - fnName: "testGetArticleBlackListByBlockHeightReturnsNumbers", - fn: testGetArticleBlackListByBlockHeightReturnsNumbers, - description: "Test if getArticleBlackListByBlockHeight returns numbers", - }, - ])} - {asyncComponent} - > -); + <> + {displayTestsSyncResults([ + // { + // fnName: "testLatestEditsRepeatedArticle", + // fn: testLatestEditsRepeatedArticle, + // description: "Should remove repeated articles keeping newest", + // }, + { + fnName: 'testLatestEditEmptyIndex', + fn: testLatestEditEmptyIndex, + }, + // { + // fnName: "testGetArticleNormalized", + // fn: testGetArticleNormalized, + // }, + { + fnName: 'testGetActionInIsTestPassingParameters', + fn: testGetActionInIsTestPassingParameters, + description: 'Should get the propper action', + }, + { + fnName: 'testGetActionInIsTestNotPassingParameters', + fn: testGetActionInIsTestNotPassingParameters, + description: 'Should get the propper action', + }, + { + fnName: 'testGetActionPassingParameters', + fn: testGetActionPassingParameters, + description: 'Should get the propper action', + }, + { + fnName: 'testGetActionNotPassingParameters', + fn: testGetActionNotPassingParameters, + description: 'Should get the propper action', + }, + { + fnName: 'testFilterFakeAuthorsMatchAuthor', + fn: testFilterFakeAuthorsMatchAuthor, + description: 'Test if filtering is working propperly', + }, + { + fnName: 'testFilterFakeAuthorsAuthorDoesntMatch', + fn: testFilterFakeAuthorsAuthorDoesntMatch, + description: 'Test if filtering is working propperly', + }, + { + fnName: 'testGetArticleBlackListByArticleIdReturnValidAccountIds', + fn: testGetArticleBlackListByArticleIdReturnValidAccountIds, + description: + "Test if getArticleBlackListByArticle returns valid articleId's", + }, + { + fnName: 'testGetArticleBlackListByBlockHeightReturnsNumbers', + fn: testGetArticleBlackListByBlockHeightReturnsNumbers, + description: + 'Test if getArticleBlackListByBlockHeight returns numbers', + }, + ])} + {asyncComponent} + > +) diff --git a/src/tests/testLibComment.jsx b/src/tests/testLibComment.jsx index c64a5af..17b2828 100644 --- a/src/tests/testLibComment.jsx +++ b/src/tests/testLibComment.jsx @@ -1,19 +1,21 @@ -const { functionsToTest } = VM.require("communityvoice.ndctools.near/widget/lib.comment"); +const { functionsToTest } = VM.require( + 'chatter.cheddar.near/widget/lib.comment' +) const { displayTestsSyncResults, displayTestsAsyncResults } = VM.require( - "communityvoice.ndctools.near/widget/tests.lib.tester" -); + 'chatter.cheddar.near/widget/tests.lib.tester' +) //=======================================================================Start consts======================================================================= -const isTest = true; -const baseAction = "sayALotComment"; -const currentVersion = "v0.0.3"; // EDIT: Set version +const isTest = true +const baseAction = 'sayALotComment' +const currentVersion = 'v0.0.3' // EDIT: Set version -const prodAction = `${baseAction}_${currentVersion}`; -const testAction = `test_${prodAction}`; -const action = isTest ? testAction : prodAction; +const prodAction = `${baseAction}_${currentVersion}` +const testAction = `test_${prodAction}` +const action = isTest ? testAction : prodAction -const config = { baseActions: { comment: baseAction }, isTest }; -const userNameRegEx = /^[a-zA-Z0-9._-]/; +const config = { baseActions: { comment: baseAction }, isTest } +const userNameRegEx = /^[a-zA-Z0-9._-]/ // const commentIdToTestSplit1 = "c_NEAR.near-12312323123"; // // const commentIdToTestSplit2 = "c-NEAR-near-12312323123" @@ -44,215 +46,221 @@ const userNameRegEx = /^[a-zA-Z0-9._-]/; // testGetSplittedCommentId(); function doesCommentIdHavePropperStructure(id) { - let splittedCommentId = functionsToTest.getSplittedCommentIdV0_0_3(id); - const timeStampPartOfCommentId = splittedCommentId.pop(); + let splittedCommentId = functionsToTest.getSplittedCommentIdV0_0_3(id) + const timeStampPartOfCommentId = splittedCommentId.pop() - const commentIdPrefix = splittedCommentId.shift(); + const commentIdPrefix = splittedCommentId.shift() - const commentIdUserNamePart = splittedCommentId; + const commentIdUserNamePart = splittedCommentId - const isTimeStampANumber = !isNaN(Number(timeStampPartOfCommentId)); - const isPrefixCorrect = commentIdPrefix === "c/"; - const isValidUserName = userNameRegEx.test(commentIdUserNamePart); + const isTimeStampANumber = !isNaN(Number(timeStampPartOfCommentId)) + const isPrefixCorrect = commentIdPrefix === 'c/' + const isValidUserName = userNameRegEx.test(commentIdUserNamePart) - if(!isTimeStampANumber) { - console.log("Timestamp is not a number: ", timeStampPartOfCommentId) - } + if (!isTimeStampANumber) { + console.log('Timestamp is not a number: ', timeStampPartOfCommentId) + } - if(!isPrefixCorrect) { - console.log("Prefix is not correct. Expected: 'c/'. Result: ", commentIdPrefix) - } + if (!isPrefixCorrect) { + console.log( + "Prefix is not correct. Expected: 'c/'. Result: ", + commentIdPrefix + ) + } - if(!isValidUserName) { - console.log("Not a valid userName: ", commentIdUserNamePart) - } + if (!isValidUserName) { + console.log('Not a valid userName: ', commentIdUserNamePart) + } - return isTimeStampANumber && isPrefixCorrect && isValidUserName; + return isTimeStampANumber && isPrefixCorrect && isValidUserName } function doesArticleIdHavePropperStructure(articleId) { - let splittedArticleId = articleId.includes("/") - ? articleId.split("/") - : articleId.split("-"); + let splittedArticleId = articleId.includes('/') + ? articleId.split('/') + : articleId.split('-') - const timeStampPartOfArticleId = splittedArticleId.pop(); + const timeStampPartOfArticleId = splittedArticleId.pop() - const articleIdUserNamePart = articleId.includes("/") - ? splittedArticleId - : splittedArticleId.join("-"); + const articleIdUserNamePart = articleId.includes('/') + ? splittedArticleId + : splittedArticleId.join('-') - const isTimeStampANumber = !isNaN(Number(timeStampPartOfArticleId)); - const isValidUserName = userNameRegEx.test(articleIdUserNamePart); + const isTimeStampANumber = !isNaN(Number(timeStampPartOfArticleId)) + const isValidUserName = userNameRegEx.test(articleIdUserNamePart) - return isTimeStampANumber && isValidUserName; + return isTimeStampANumber && isValidUserName } function doesRootIdHaveAValidFormat(rootId) { - if (rootId.startsWith("c_")) { - return doesCommentIdHavePropperStructure(rootId); - } else { - return doesArticleIdHavePropperStructure(rootId); - } + if (rootId.startsWith('c_')) { + return doesCommentIdHavePropperStructure(rootId) + } else { + return doesArticleIdHavePropperStructure(rootId) + } } function isResponseStructureWrong(res) { - // const resExample = [ - // { - // accountId: "ayelen.near", - // blockHeight: 109989354, - // value: { - // type: "md", - // comment: { - // text: "a verr", - // timestamp: 1704812207512, - // commentId: "c_ayelen.near-1704812207512", - // rootId: "ayelen.near-1699406465524", - // }, - // }, - // isEdition: true, - // }, - // ]; - - if (Array.isArray(res) && res.length === 0) { - console.log("res is an empty array"); - return false; - } - - let errorInStructure = false; - for (let i = 0; i < res.length; i++) { - const commentData = res[i]; - const commentAccountId = commentData.accountId; - const commentBlockHeight = Number(commentData.blockHeight); - const isEdition = commentData.isEdition; - - if (typeof commentAccountId !== "string") { - console.log(`In the commentData of index ${i} the accountId is not a string`); - errorInStructure = true; - } else if (!(typeof commentBlockHeight === "number")) { - console.log( - `In the commentData of index ${i} the blockHeight is not a Number` - ); - errorInStructure = true; - } else if (isEdition && typeof isEdition !== "boolean") { - console.log( - `In the commentData of index ${i} the isEdition property is not a booean` - ); - errorInStructure = true; - } else if ( - commentData.value.metadata && - !doesCommentIdHavePropperStructure(commentData.value.metadata.id) - ) { - console.log( - `In the commentData of index ${i} doesCommentIdHavePropperStructure is returning false` - ); - errorInStructure = true; - } else if (typeof commentData.value.metadata.author !== "string") { - console.log( - `In the commentData of index ${i} the author property in the metadata is not a string`, commentData - ); - errorInStructure = true; - } else if ( - typeof commentData.value.metadata.createdTimestamp !== "number" || - typeof commentData.value.metadata.lastEditTimestamp !== "number" - ) { - console.log( - `In the commentData of index ${i} the timestamps in the metadata are not a number` - ); - errorInStructure = true; - } else if (typeof commentData.value.metadata.versionKey !== "string") { - console.log( - `In the commentData of index ${i} the versionKey in the metadata is not a string` - ); - errorInStructure = true; - } else if (!doesRootIdHaveAValidFormat(commentData.value.metadata.rootId)) { - console.log( - `In the commentData of index ${i} doesRootIdHaveAValidFormat is returning false` - ); - errorInStructure = true; + // const resExample = [ + // { + // accountId: "ayelen.near", + // blockHeight: 109989354, + // value: { + // type: "md", + // comment: { + // text: "a verr", + // timestamp: 1704812207512, + // commentId: "c_ayelen.near-1704812207512", + // rootId: "ayelen.near-1699406465524", + // }, + // }, + // isEdition: true, + // }, + // ]; + + if (Array.isArray(res) && res.length === 0) { + console.log('res is an empty array') + return false } - } - return errorInStructure; + let errorInStructure = false + for (let i = 0; i < res.length; i++) { + const commentData = res[i] + const commentAccountId = commentData.accountId + const commentBlockHeight = Number(commentData.blockHeight) + const isEdition = commentData.isEdition + + if (typeof commentAccountId !== 'string') { + console.log( + `In the commentData of index ${i} the accountId is not a string` + ) + errorInStructure = true + } else if (!(typeof commentBlockHeight === 'number')) { + console.log( + `In the commentData of index ${i} the blockHeight is not a Number` + ) + errorInStructure = true + } else if (isEdition && typeof isEdition !== 'boolean') { + console.log( + `In the commentData of index ${i} the isEdition property is not a booean` + ) + errorInStructure = true + } else if ( + commentData.value.metadata && + !doesCommentIdHavePropperStructure(commentData.value.metadata.id) + ) { + console.log( + `In the commentData of index ${i} doesCommentIdHavePropperStructure is returning false` + ) + errorInStructure = true + } else if (typeof commentData.value.metadata.author !== 'string') { + console.log( + `In the commentData of index ${i} the author property in the metadata is not a string`, + commentData + ) + errorInStructure = true + } else if ( + typeof commentData.value.metadata.createdTimestamp !== 'number' || + typeof commentData.value.metadata.lastEditTimestamp !== 'number' + ) { + console.log( + `In the commentData of index ${i} the timestamps in the metadata are not a number` + ) + errorInStructure = true + } else if (typeof commentData.value.metadata.versionKey !== 'string') { + console.log( + `In the commentData of index ${i} the versionKey in the metadata is not a string` + ) + errorInStructure = true + } else if ( + !doesRootIdHaveAValidFormat(commentData.value.metadata.rootId) + ) { + console.log( + `In the commentData of index ${i} doesRootIdHaveAValidFormat is returning false` + ) + errorInStructure = true + } + } + + return errorInStructure } //=======================================================================End lib functions========================================================================= //=======================================================================Start tests======================================================================= -function testCreateComment() { - -} +function testCreateComment() {} async function testGetComments() { - const fnName = "testGetComments"; - const articleId = "ayelen.near-1699406465524"; - - // const articleId = "test-1"; - - // const articleId = "ayelen.near-1708014044488"; - // const articleId = "ayelen.near-1696980478217"; - // const articleId = "ayelen.near-1707407808397"; - // const articleId = "ayelen.near-1697150785479"; - // const articleId = "ayelen.near-1697152421776"; - - const getCommentsDataResult = functionsToTest.getComments(articleId, config); - - let isError = false; - let msg = ""; - return getCommentsDataResult.then((res) => { - try { - if (isResponseStructureWrong(res)) { - isError = true; - msg = [ - "One or more elements on the array have an invalid structure", - "Expected structure example: [{'accountId': accountId, 'blockHeight': number, isEdition: bool, 'value': 'comment': {'commentId': 'c-accountId-timestamp', rootId: commentId || articleId, text: string, timestamp: number}}]", - `Returned: ${JSON.stringify(res)}`, - ]; - } - - return { - isError, - msg, - fnName, - }; - } catch (err) { - return { - isError: true, - msg: err.message, - fnName, - }; - } - }); + const fnName = 'testGetComments' + const articleId = 'ayelen.near-1699406465524' + + // const articleId = "test-1"; + + // const articleId = "ayelen.near-1708014044488"; + // const articleId = "ayelen.near-1696980478217"; + // const articleId = "ayelen.near-1707407808397"; + // const articleId = "ayelen.near-1697150785479"; + // const articleId = "ayelen.near-1697152421776"; + + const getCommentsDataResult = functionsToTest.getComments(articleId, config) + + let isError = false + let msg = '' + return getCommentsDataResult.then((res) => { + try { + if (isResponseStructureWrong(res)) { + isError = true + msg = [ + 'One or more elements on the array have an invalid structure', + "Expected structure example: [{'accountId': accountId, 'blockHeight': number, isEdition: bool, 'value': 'comment': {'commentId': 'c-accountId-timestamp', rootId: commentId || articleId, text: string, timestamp: number}}]", + `Returned: ${JSON.stringify(res)}`, + ] + } + + return { + isError, + msg, + fnName, + } + } catch (err) { + return { + isError: true, + msg: err.message, + fnName, + } + } + }) } //========================================================================End tests================================================================================ -const [asyncComponent, setAsyncComponent] = useState(Loading...
); +const [asyncComponent, setAsyncComponent] = useState(Loading...
) displayTestsAsyncResults([ - // { - // fnName: "testGetCommentsData", - // fn: testGetCommentsData, - // description: - // "Should get the upVotesData asociated with the article that have the passed ID", - // }, - { - fnName: "testGetComments", - fn: testGetComments, - description: - "Should get the commentsData asociated with the article that have the passed ID", - }, + // { + // fnName: "testGetCommentsData", + // fn: testGetCommentsData, + // description: + // "Should get the upVotesData asociated with the article that have the passed ID", + // }, + { + fnName: 'testGetComments', + fn: testGetComments, + description: + 'Should get the commentsData asociated with the article that have the passed ID', + }, ]).then((res) => { - setAsyncComponent(res); -}); + setAsyncComponent(res) +}) return ( - <> - {displayTestsSyncResults([ - // { - // fnName: "testComposeDataIsWorkingAsExpected", - // fn: testComposeDataIsWorkingAsExpected, - // description: "Check if the structure is as the expected one", - // }, - ])} - {asyncComponent} - > -); + <> + {displayTestsSyncResults([ + // { + // fnName: "testComposeDataIsWorkingAsExpected", + // fn: testComposeDataIsWorkingAsExpected, + // description: "Check if the structure is as the expected one", + // }, + ])} + {asyncComponent} + > +) diff --git a/src/tests/testLibSBT.jsx b/src/tests/testLibSBT.jsx index cdfab40..ab409e3 100644 --- a/src/tests/testLibSBT.jsx +++ b/src/tests/testLibSBT.jsx @@ -1,106 +1,108 @@ const { getSBTWhiteList, isValidUser, getUserSBTs } = VM.require( - "communityvoice.ndctools.near/widget/lib.SBT" -); + 'chatter.cheddar.near/widget/lib.SBT' +) const { displayTestsResults } = VM.require( - "communityvoice.ndctools.near/widget/tests.lib.tester" -); + 'chatter.cheddar.near/widget/tests.lib.tester' +) function testGetSBTWhiteListWorking() { - const fnName = "testGetSBTWhiteListWorking"; + const fnName = 'testGetSBTWhiteListWorking' - let functionGetSBTWhiteList; - try { - functionGetSBTWhiteList = getSBTWhiteList(); - } catch (err) { - return { - isError: true, - msg: err.message, - fnName, - }; - } + let functionGetSBTWhiteList + try { + functionGetSBTWhiteList = getSBTWhiteList() + } catch (err) { + return { + isError: true, + msg: err.message, + fnName, + } + } - const expectedWhiteList = [ - { - value: "fractal.i-am-human.near - class 1", - title: "General", - default: true, - }, - { value: "community.i-am-human.near - class 1", title: "OG" }, - { value: "community.i-am-human.near - class 2", title: "Contributor" }, - { - value: "community.i-am-human.near - class 3", - title: "Core Contributor", - }, - { value: "elections.ndc-gwg.near - class 2", title: "HoM" }, - { value: "elections.ndc-gwg.near - class 3", title: "CoA" }, - { value: "elections.ndc-gwg.near - class 4", title: "TC" }, - { value: "public", title: "Public" }, - ]; + const expectedWhiteList = [ + { + value: 'fractal.i-am-human.near - class 1', + title: 'General', + default: true, + }, + { value: 'community.i-am-human.near - class 1', title: 'OG' }, + { value: 'community.i-am-human.near - class 2', title: 'Contributor' }, + { + value: 'community.i-am-human.near - class 3', + title: 'Core Contributor', + }, + { value: 'elections.ndc-gwg.near - class 2', title: 'HoM' }, + { value: 'elections.ndc-gwg.near - class 3', title: 'CoA' }, + { value: 'elections.ndc-gwg.near - class 4', title: 'TC' }, + { value: 'public', title: 'Public' }, + ] - const isError = - JSON.stringify(functionGetSBTWhiteList) !== - JSON.stringify(expectedWhiteList); - return { - isError: isError, - msg: isError - ? `Items don't match output ${functionGetSBTWhiteList}, expected ${expectedWhiteList}` - : "", - fnName, - }; + const isError = + JSON.stringify(functionGetSBTWhiteList) !== + JSON.stringify(expectedWhiteList) + return { + isError: isError, + msg: isError + ? `Items don't match output ${functionGetSBTWhiteList}, expected ${expectedWhiteList}` + : '', + fnName, + } } function testIsValidUserReturningCorrectly() { - const fnName = "testIsValidUserReturningCorrectly"; + const fnName = 'testIsValidUserReturningCorrectly' - const selectedSBTToCheckCredentials = ["fractal.i-am-human.near - class 1"] + const selectedSBTToCheckCredentials = ['fractal.i-am-human.near - class 1'] - let functionIsValidUser; - try { - functionIsValidUser = isValidUser("blaze.near", selectedSBTToCheckCredentials); - } catch (err) { - return { - isError: true, - msg: err.message, - fnName, - }; - } + let functionIsValidUser + try { + functionIsValidUser = isValidUser( + 'blaze.near', + selectedSBTToCheckCredentials + ) + } catch (err) { + return { + isError: true, + msg: err.message, + fnName, + } + } - const expectedBlazeCredentials04D03M2024Y = { - "fractal.i-am-human.near - class 1": true, - "community.i-am-human.near - class 1": true, - "community.i-am-human.near - class 2": true, - "community.i-am-human.near - class 3": false, - "elections.ndc-gwg.near - class 2": false, - "elections.ndc-gwg.near - class 3": true, - "elections.ndc-gwg.near - class 4": false, - "public": true, - }; + const expectedBlazeCredentials04D03M2024Y = { + 'fractal.i-am-human.near - class 1': true, + 'community.i-am-human.near - class 1': true, + 'community.i-am-human.near - class 2': true, + 'community.i-am-human.near - class 3': false, + 'elections.ndc-gwg.near - class 2': false, + 'elections.ndc-gwg.near - class 3': true, + 'elections.ndc-gwg.near - class 4': false, + public: true, + } - const isError = - functionIsValidUser !== - expectedBlazeCredentials04D03M2024Y[selectedSBTToCheckCredentials]; - return { - isError: isError, - msg: isError - ? `Blaze ${expectedBlazeCredentials04D03M2024Y[selectedSBTToCheckCredentials] ? "do" : "doesn't"} have the following SBT: ${selectedSBTToCheckCredentials} and it's returning ${functionIsValidUser}` - : "", - fnName, - }; + const isError = + functionIsValidUser !== + expectedBlazeCredentials04D03M2024Y[selectedSBTToCheckCredentials] + return { + isError: isError, + msg: isError + ? `Blaze ${expectedBlazeCredentials04D03M2024Y[selectedSBTToCheckCredentials] ? 'do' : "doesn't"} have the following SBT: ${selectedSBTToCheckCredentials} and it's returning ${functionIsValidUser}` + : '', + fnName, + } } return ( - <> - {displayTestsResults([ - { - fnName: "testGetSBTWhiteListWorking", - fn: testGetSBTWhiteListWorking, - }, - { - fnName: "testIsValidUserReturningCorrectly", - fn: testIsValidUserReturningCorrectly, - }, - - ])} - > -); + <> + {displayTestsResults([ + { + fnName: 'testGetSBTWhiteListWorking', + fn: testGetSBTWhiteListWorking, + }, + { + fnName: 'testIsValidUserReturningCorrectly', + fn: testIsValidUserReturningCorrectly, + }, + ])} + > +) diff --git a/src/tests/testLibUpVotes.jsx b/src/tests/testLibUpVotes.jsx index ee5b249..e6e3112 100644 --- a/src/tests/testLibUpVotes.jsx +++ b/src/tests/testLibUpVotes.jsx @@ -1,270 +1,274 @@ -const { functionsToTest } = VM.require("communityvoice.ndctools.near/widget/lib.upVotes"); +const { functionsToTest } = VM.require( + 'chatter.cheddar.near/widget/lib.upVotes' +) const { displayTestsSyncResults, displayTestsAsyncResults } = VM.require( - "communityvoice.ndctools.near/widget/tests.lib.tester" -); + 'chatter.cheddar.near/widget/tests.lib.tester' +) //=======================================================================Start testLibUpVotes consts======================================================================= -const isTest = true; -const baseAction = "sayALotUpVote"; -const currentVersion = "v0.0.2"; // EDIT: Set version +const isTest = true +const baseAction = 'sayALotUpVote' +const currentVersion = 'v0.0.2' // EDIT: Set version -const prodAction = `${baseAction}_${currentVersion}`; -const testAction = `test_${prodAction}`; -const action = isTest ? testAction : prodAction; +const prodAction = `${baseAction}_${currentVersion}` +const testAction = `test_${prodAction}` +const action = isTest ? testAction : prodAction -const config = { baseActions: { upVote: baseAction }, isTest }; -const userNameRegEx = /^[a-zA-Z0-9._-]/; +const config = { baseActions: { upVote: baseAction }, isTest } +const userNameRegEx = /^[a-zA-Z0-9._-]/ //=======================================================================End testLibUpVotes consts========================================================================= //=======================================================================Start testLibUpVotes functions========================================================================= function doesUpVoteIdHavePropperStructure(upVoteData) { - const upVoteId = upVoteData.value.metadata.id; + const upVoteId = upVoteData.value.metadata.id - let splittedUpVoteId = upVoteId.includes("/") - ? upVoteId.split("/") - : upVoteId.split("-"); - const timeStampPartOfUpVoteId = splittedUpVoteId.pop(); + let splittedUpVoteId = upVoteId.includes('/') + ? upVoteId.split('/') + : upVoteId.split('-') + const timeStampPartOfUpVoteId = splittedUpVoteId.pop() - const upVoteIdPrefix = splittedUpVoteId.shift(); + const upVoteIdPrefix = splittedUpVoteId.shift() - const upVoteIdUserNamePart = upVoteId.includes("/") - ? splittedUpVoteId - : splittedUpVoteId.join("-"); + const upVoteIdUserNamePart = upVoteId.includes('/') + ? splittedUpVoteId + : splittedUpVoteId.join('-') - const isTimeStampANumber = !isNaN(Number(timeStampPartOfUpVoteId)); - const isPrefixCorrect = upVoteIdPrefix === "uv"; - const isValidUserName = userNameRegEx.test(upVoteIdUserNamePart); + const isTimeStampANumber = !isNaN(Number(timeStampPartOfUpVoteId)) + const isPrefixCorrect = upVoteIdPrefix === 'uv' + const isValidUserName = userNameRegEx.test(upVoteIdUserNamePart) - return isTimeStampANumber && isPrefixCorrect && isValidUserName; + return isTimeStampANumber && isPrefixCorrect && isValidUserName } function isResponseStructureWrong(res) { + if (Array.isArray(res) && res.length === 0) { + console.log('res is an empty array') + return false + } - if (Array.isArray(res) && res.length === 0) { - console.log("res is an empty array"); - return false; - } - - let errorInStructure = false; - for (let i = 0; i < res.length; i++) { - const upVoteData = res[i]; - const upVoteAccountId = upVoteData.accountId; - const upVoteBlockHeight = Number(upVoteData.blockHeight); - - if (typeof upVoteAccountId !== "string") { - console.log(`In the element of index ${i} the accountId is not a string`); - errorInStructure = true; - } else if (!(typeof upVoteBlockHeight === "number")) { - console.log( - `In the element of index ${i} the blockHeight is not a Number` - ); - errorInStructure = true; - } else if ( - upVoteData.value.metadata && - !doesUpVoteIdHavePropperStructure(upVoteData) && - typeof upVoteData.value.sbt !== "string" - ) { - console.log( - `In the element of index ${i} doesUpVoteIdHavePropperStructure is returning false` - ); - errorInStructure = true; + let errorInStructure = false + for (let i = 0; i < res.length; i++) { + const upVoteData = res[i] + const upVoteAccountId = upVoteData.accountId + const upVoteBlockHeight = Number(upVoteData.blockHeight) + + if (typeof upVoteAccountId !== 'string') { + console.log( + `In the element of index ${i} the accountId is not a string` + ) + errorInStructure = true + } else if (!(typeof upVoteBlockHeight === 'number')) { + console.log( + `In the element of index ${i} the blockHeight is not a Number` + ) + errorInStructure = true + } else if ( + upVoteData.value.metadata && + !doesUpVoteIdHavePropperStructure(upVoteData) && + typeof upVoteData.value.sbt !== 'string' + ) { + console.log( + `In the element of index ${i} doesUpVoteIdHavePropperStructure is returning false` + ) + errorInStructure = true + } } - } - return errorInStructure; + return errorInStructure } //========================================================================End testLibUpVotes functions=========================================================================== //=======================================================================Start testLibUpVotes tests============================================================================== async function testGetUpVotesData() { - const fnName = "testGetUpVotesData"; - // const articleId = "ayelen.near-1699406465524"; - const articleId = "test-1"; - - // const articleId = "ayelen.near-1708014044488"; - // const articleId = "ayelen.near-1696980478217"; - // const articleId = "ayelen.near-1707407808397"; - // const articleId = "ayelen.near-1697150785479"; - // const articleId = "ayelen.near-1697152421776"; - - const getUpVotesDataResult = functionsToTest.getUpVotesData( - articleId, - config - ); - - let isError = false; - let msg = ""; - return getUpVotesDataResult.then((res) => { - try { - if (isResponseStructureWrong(res)) { - isError = true; - msg = [ - "One or more elements on the array have an invalid structure", - "Expected structure example: [{'accountId': 'accountId', 'blockHeight': number, 'value': {'upVoteId': 'uv-accountId-timestamp', 'sbts': [sbt]}}]", - `Returned: ${JSON.stringify(res)}`, - ]; - } - - return { - isError, - msg, - fnName, - }; - } catch (err) { - return { - isError: true, - msg: err.message, - fnName, - }; - } - }); + const fnName = 'testGetUpVotesData' + // const articleId = "ayelen.near-1699406465524"; + const articleId = 'test-1' + + // const articleId = "ayelen.near-1708014044488"; + // const articleId = "ayelen.near-1696980478217"; + // const articleId = "ayelen.near-1707407808397"; + // const articleId = "ayelen.near-1697150785479"; + // const articleId = "ayelen.near-1697152421776"; + + const getUpVotesDataResult = functionsToTest.getUpVotesData( + articleId, + config + ) + + let isError = false + let msg = '' + return getUpVotesDataResult.then((res) => { + try { + if (isResponseStructureWrong(res)) { + isError = true + msg = [ + 'One or more elements on the array have an invalid structure', + "Expected structure example: [{'accountId': 'accountId', 'blockHeight': number, 'value': {'upVoteId': 'uv-accountId-timestamp', 'sbts': [sbt]}}]", + `Returned: ${JSON.stringify(res)}`, + ] + } + + return { + isError, + msg, + fnName, + } + } catch (err) { + return { + isError: true, + msg: err.message, + fnName, + } + } + }) } function testComposeDataIsWorkingAsExpected() { - const fnName = "testComposeData"; - - const articleId = "ayelen.near-1699406465524"; - // const id = "ayelen.near-1708014044488"; - // const id = "ayelen.near-1696980478217"; - // const id = "ayelen.near-1707407808397"; - // const id = "ayelen.near-1697150785479"; - // const id = "ayelen.near-1697152421776"; - - const upVote = { - isDelete: false, - sbts: ["public"], //For the moment should only have 1 sbt in the array - }; - - let isError = false; - let msg = ""; - try { - const getComposeData = functionsToTest.composeData( - articleId, - upVote, - currentVersion, - config - ); - // expectedStructure = { - // index: { - // [action]: JSON.stringify({ - // key: articleId, - // value: { - // ...upVote, - // }, - // }), - // }, - // } - - const expectedStructure = { - index: { - [action]: JSON.stringify({ - key: articleId, - value: { - ...upVote, - }, - }), - }, - }; - - if (JSON.stringify(getComposeData) !== JSON.stringify(expectedStructure)) { - isError = true; - msg = [ - "The result is not matching the expected result", - `Expected: ${JSON.stringify(expectedStructure)}`, - `Result: ${JSON.stringify(getComposeData)}`, - ]; + const fnName = 'testComposeData' + + const articleId = 'ayelen.near-1699406465524' + // const id = "ayelen.near-1708014044488"; + // const id = "ayelen.near-1696980478217"; + // const id = "ayelen.near-1707407808397"; + // const id = "ayelen.near-1697150785479"; + // const id = "ayelen.near-1697152421776"; + + const upVote = { + isDelete: false, + sbts: ['public'], //For the moment should only have 1 sbt in the array } - return { - isError, - msg, - fnName, - }; - } catch (err) { - return { - isError: true, - msg: err.message, - fnName, - }; - } + let isError = false + let msg = '' + try { + const getComposeData = functionsToTest.composeData( + articleId, + upVote, + currentVersion, + config + ) + // expectedStructure = { + // index: { + // [action]: JSON.stringify({ + // key: articleId, + // value: { + // ...upVote, + // }, + // }), + // }, + // } + + const expectedStructure = { + index: { + [action]: JSON.stringify({ + key: articleId, + value: { + ...upVote, + }, + }), + }, + } + + if ( + JSON.stringify(getComposeData) !== JSON.stringify(expectedStructure) + ) { + isError = true + msg = [ + 'The result is not matching the expected result', + `Expected: ${JSON.stringify(expectedStructure)}`, + `Result: ${JSON.stringify(getComposeData)}`, + ] + } + + return { + isError, + msg, + fnName, + } + } catch (err) { + return { + isError: true, + msg: err.message, + fnName, + } + } } function testExecuteSaveUpVote() { - const now = Date.now(); - functionsToTest.executeSaveUpVote( - "test-1", - { - upVoteData: { isDelete: false, sbts: ["public"] }, - metadata: { - id: `uv/f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb/${now}`, - author: - "f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb", - sbt: ["public"], - createdTimestamp: now, - lastEditTimestamp: now, - versionKey: "v0.0.2", - }, - }, - () => { - console.log("testExecuteSaveUpVote commited"); - }, - () => { - console.log("testExecuteSaveUpVote canceled"); - }, - currentVersion, - config - ); + const now = Date.now() + functionsToTest.executeSaveUpVote( + 'test-1', + { + upVoteData: { isDelete: false, sbts: ['public'] }, + metadata: { + id: `uv/f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb/${now}`, + author: 'f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb', + sbt: ['public'], + createdTimestamp: now, + lastEditTimestamp: now, + versionKey: 'v0.0.2', + }, + }, + () => { + console.log('testExecuteSaveUpVote commited') + }, + () => { + console.log('testExecuteSaveUpVote canceled') + }, + currentVersion, + config + ) } function testCreateUpVote() { - const articleId = `a/f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb/${Date.now()}`; - const upVoteData = { isDelete: false, sbt: "public" }; - const userMetadataHelper = { - author: "f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb", - sbt: "public", - }; - const onCommit = () => { - console.log("testCreateUpVote commited"); - }; - const onCancel = () => { - console.log("testCreateUpVote canceled"); - }; - functionsToTest.createUpVote( - config, - articleId, - upVoteData, - userMetadataHelper, - onCommit, - onCancel - ); + const articleId = `a/f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb/${Date.now()}` + const upVoteData = { isDelete: false, sbt: 'public' } + const userMetadataHelper = { + author: 'f2bc8abdb8ba64fe5aac9689ded9491ff0e6fdcd7a5c680b7cf364142d1789fb', + sbt: 'public', + } + const onCommit = () => { + console.log('testCreateUpVote commited') + } + const onCancel = () => { + console.log('testCreateUpVote canceled') + } + functionsToTest.createUpVote( + config, + articleId, + upVoteData, + userMetadataHelper, + onCommit, + onCancel + ) } //========================================================================End testLibUpVotes tests================================================================================ -const [asyncComponent, setAsyncComponent] = useState(Loading...
); +const [asyncComponent, setAsyncComponent] = useState(Loading...
) displayTestsAsyncResults([ - { - fnName: "testGetUpVotesData", - fn: testGetUpVotesData, - description: - "Should get the upVotesData asociated with the article that have the passed ID", - }, + { + fnName: 'testGetUpVotesData', + fn: testGetUpVotesData, + description: + 'Should get the upVotesData asociated with the article that have the passed ID', + }, ]).then((res) => { - setAsyncComponent(res); -}); + setAsyncComponent(res) +}) return ( - <> - {displayTestsSyncResults([ - { - fnName: "testComposeDataIsWorkingAsExpected", - fn: testComposeDataIsWorkingAsExpected, - description: "Check if the structure is as the expected one", - }, - ])} - {asyncComponent} - - - > -); + <> + {displayTestsSyncResults([ + { + fnName: 'testComposeDataIsWorkingAsExpected', + fn: testComposeDataIsWorkingAsExpected, + description: 'Check if the structure is as the expected one', + }, + ])} + {asyncComponent} + + + > +) diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..499f6a4 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,373 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@near-js/accounts@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@near-js/accounts/-/accounts-1.0.4.tgz#b699dc1c63ffccc1598481b4260dfaf2507f0a69" + integrity sha512-6zgSwq/rQ9ggPOIkGUx9RoEurbJiojqA/axeh6o1G+46GqUBI7SUcDooyVvZjeiOvUPObnTQptDYpbV+XZji8g== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/providers" "0.1.1" + "@near-js/signers" "0.1.1" + "@near-js/transactions" "1.1.2" + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + ajv "8.11.2" + ajv-formats "2.1.1" + bn.js "5.2.1" + borsh "1.0.0" + depd "2.0.0" + lru_map "0.4.1" + near-abi "0.1.1" + +"@near-js/crypto@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@near-js/crypto/-/crypto-1.2.1.tgz#aa18bed171e68653dae9f82114636eba34ece32a" + integrity sha512-iJOHaGKvdudYfR8nEtRhGlgcTEHeVmxMoT0JVXmuP3peG96v/sSnA03CE6MZBeCC8txKAQOffagxE7oU6hJp9g== + dependencies: + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + "@noble/curves" "1.2.0" + bn.js "5.2.1" + borsh "1.0.0" + randombytes "2.1.0" + +"@near-js/keystores-browser@0.0.9": + version "0.0.9" + resolved "https://registry.yarnpkg.com/@near-js/keystores-browser/-/keystores-browser-0.0.9.tgz#4d6211ad617613124aeee78ede5771b153e3bcdd" + integrity sha512-JzPj+RHJN2G3CEm/LyfbtZDQy/wxgOlqfh52voqPGijUHg93b27KBqtZShazAgJNkhzRbWcoluWQnd2jL8vF7A== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/keystores" "0.0.9" + +"@near-js/keystores-node@0.0.9": + version "0.0.9" + resolved "https://registry.yarnpkg.com/@near-js/keystores-node/-/keystores-node-0.0.9.tgz#c2fd2f5bfbca1c75699dd7324e300cfd12e790ed" + integrity sha512-2B9MYz6uIhysG1fhQSjvaPYCM7gM+UAeDchX0J8QRauXIeN8TGzpcdgkdkMUnWNTIdt3Iblh0ZuCs+FY02dTXg== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/keystores" "0.0.9" + +"@near-js/keystores@0.0.9": + version "0.0.9" + resolved "https://registry.yarnpkg.com/@near-js/keystores/-/keystores-0.0.9.tgz#768aaaab1beb7f797432513cb1bbf9430e305a85" + integrity sha512-j8ySgVEcm2Gg6zxkSdadNtPlIqhJZdPGfWWM3tPtEoowNS9snhwZn5NRFPrgmX0+MzpF7E091CRcY90MvRVhsg== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/types" "0.0.4" + +"@near-js/providers@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@near-js/providers/-/providers-0.1.1.tgz#7489eb5a4248562fe98fdbc4cb55ea3f6d787e0a" + integrity sha512-0M/Vz2Ac34ShKVoe2ftVJ5Qg4eSbEqNXDbCDOdVj/2qbLWZa7Wpe+me5ei4TMY2ZhGdawhgJUPrYwdJzOCyf8w== + dependencies: + "@near-js/transactions" "1.1.2" + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + bn.js "5.2.1" + borsh "1.0.0" + http-errors "1.7.2" + optionalDependencies: + node-fetch "2.6.7" + +"@near-js/signers@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@near-js/signers/-/signers-0.1.1.tgz#6d32b262eac9b03fab5fc1ee93d2c4055c86980f" + integrity sha512-focJgs04dBUfawMnyGg3yIjaMawuVz2OeLRKC4t5IQDmO4PLfdIraEuwgS7tckMq3GdrJ7nqkwkpSNYpdt7I5Q== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/keystores" "0.0.9" + "@noble/hashes" "1.3.3" + +"@near-js/transactions@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@near-js/transactions/-/transactions-1.1.2.tgz#7dec18b463cd336e325ee61b1e1c39a6192d9e81" + integrity sha512-AqYA56ncwgrWjIu+bNaWjTPRZb0O+SfpWIP7U+1FKNKxNYMCtkt6zp7SlQeZn743shKVq9qMzA9+ous/KCb0QQ== + dependencies: + "@near-js/crypto" "1.2.1" + "@near-js/signers" "0.1.1" + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + "@noble/hashes" "1.3.3" + bn.js "5.2.1" + borsh "1.0.0" + +"@near-js/types@0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@near-js/types/-/types-0.0.4.tgz#d941689df41c850aeeeaeb9d498418acec515404" + integrity sha512-8TTMbLMnmyG06R5YKWuS/qFG1tOA3/9lX4NgBqQPsvaWmDsa+D+QwOkrEHDegped0ZHQwcjAXjKML1S1TyGYKg== + dependencies: + bn.js "5.2.1" + +"@near-js/utils@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@near-js/utils/-/utils-0.1.0.tgz#1368f59008c39df1e903bd3e0f308eedcdf25c1d" + integrity sha512-kOVAXmJzaC8ElJD3RLEoBuqOK+d5s7jc0JkvhyEtbuEmXYHHAy9Q17/YkDcX9tyr01L85iOt66z0cODqzgtQwA== + dependencies: + "@near-js/types" "0.0.4" + bn.js "5.2.1" + bs58 "4.0.0" + depd "2.0.0" + mustache "4.0.0" + +"@near-js/wallet-account@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@near-js/wallet-account/-/wallet-account-1.1.1.tgz#e66e8d10fb51f71f7cb722bdff63fb98e2b0d486" + integrity sha512-NnoJKtogBQ7Qz+AP+LdF70BP8Az6UXQori7OjPqJLMo73bn6lh5Ywvegwd1EB7ZEVe4BRt9+f9QkbU5M8ANfAw== + dependencies: + "@near-js/accounts" "1.0.4" + "@near-js/crypto" "1.2.1" + "@near-js/keystores" "0.0.9" + "@near-js/signers" "0.1.1" + "@near-js/transactions" "1.1.2" + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + bn.js "5.2.1" + borsh "1.0.0" + +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@noble/hashes@1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" + integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== + +"@types/json-schema@^7.0.11": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + +ajv-formats@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + +ajv@8.11.2: + version "8.11.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.2.tgz#aecb20b50607acf2569b6382167b65a96008bb78" + integrity sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +ajv@^8.0.0: + version "8.16.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.16.0.tgz#22e2a92b94f005f7e0f9c9d39652ef0b8f6f0cb4" + integrity sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw== + dependencies: + fast-deep-equal "^3.1.3" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.4.1" + +base-x@^2.0.1: + version "2.0.6" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-2.0.6.tgz#4582a91ebcec99ee06f4e4032030b0cf1c2941d8" + integrity sha512-UAmjxz9KbK+YIi66xej+pZVo/vxUOh49ubEvZW5egCbxhur05pBb+hwuireQwKO4nDpsNm64/jEei17LEpsr5g== + dependencies: + safe-buffer "^5.0.1" + +bn.js@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +borsh@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/borsh/-/borsh-1.0.0.tgz#b564c8cc8f7a91e3772b9aef9e07f62b84213c1f" + integrity sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ== + +bs58@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.0.tgz#65f5deaf6d74e6135a99f763ca6209ab424b9172" + integrity sha512-/jcGuUuSebyxwLLfKrbKnCJttxRf9PM51EnHTwmFKBxl4z1SGkoAhrfd6uZKE0dcjQTfm6XzTP8DPr1tzE4KIw== + dependencies: + base-x "^2.0.1" + +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fs@^0.0.1-security: + version "0.0.1-security" + resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4" + integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w== + +http-errors@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" + integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +lru_map@0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.4.1.tgz#f7b4046283c79fb7370c36f8fca6aee4324b0a98" + integrity sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg== + +mustache@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.0.0.tgz#7f02465dbb5b435859d154831c032acdfbbefb31" + integrity sha512-FJgjyX/IVkbXBXYUwH+OYwQKqWpFPLaLVESd70yHjSDunwzV2hZOoTBvPf4KLoxesUzzyfTH6F784Uqd7Wm5yA== + +near-abi@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/near-abi/-/near-abi-0.1.1.tgz#b7ead408ca4ad11de4fe3e595d30a7a8bc5307e0" + integrity sha512-RVDI8O+KVxRpC3KycJ1bpfVj9Zv+xvq9PlW1yIFl46GhrnLw83/72HqHGjGDjQ8DtltkcpSjY9X3YIGZ+1QyzQ== + dependencies: + "@types/json-schema" "^7.0.11" + +near-api-js@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-3.0.4.tgz#5ee094ce53e30239cc817ca942ec3e9739296dbb" + integrity sha512-qKWjnugoB7kSFhzZ5GXyH/eABspCQYWBmWnM4hpV5ctnQBt89LqgEu9yD1z4sa89MvUu8BuCxwb1m00BE8iofg== + dependencies: + "@near-js/accounts" "1.0.4" + "@near-js/crypto" "1.2.1" + "@near-js/keystores" "0.0.9" + "@near-js/keystores-browser" "0.0.9" + "@near-js/keystores-node" "0.0.9" + "@near-js/providers" "0.1.1" + "@near-js/signers" "0.1.1" + "@near-js/transactions" "1.1.2" + "@near-js/types" "0.0.4" + "@near-js/utils" "0.1.0" + "@near-js/wallet-account" "1.1.1" + "@noble/curves" "1.2.0" + ajv "8.11.2" + ajv-formats "2.1.1" + bn.js "5.2.1" + borsh "1.0.0" + depd "2.0.0" + http-errors "1.7.2" + near-abi "0.1.1" + node-fetch "2.6.7" + +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + +path@^0.12.7: + version "0.12.7" + resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f" + integrity sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q== + dependencies: + process "^0.11.1" + util "^0.10.3" + +process@^0.11.1: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +randombytes@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +safe-buffer@^5.0.1, safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + +"statuses@>= 1.5.0 < 2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +uri-js@^4.2.2, uri-js@^4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +util@^0.10.3: + version "0.10.4" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" + integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + dependencies: + inherits "2.0.3" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0"