diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index ad828dc69..59a4e6e1b 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,7 +1,7 @@
name: Requesting a Feature or Improvement
description: For feature requests. Please search for existing issues first. Also see CONTRIBUTING.
-title: '[FEATURE]
'
-labels: [Feature, Needs Triage]
+title: "[FEATURE] "
+labels: [Feature, Needs Triage]
body:
- type: markdown
attributes:
diff --git a/.prettierignore b/.prettierignore
index 4d4e05efa..a08601d5b 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,4 +1,4 @@
README.md
*.md
*.mdx
-packages/protobuf/src/generated/
+packages/protobuf/src/generated/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 884b0c4f7..4ed8f0db7 100644
--- a/Makefile
+++ b/Makefile
@@ -50,3 +50,4 @@ publish:
ci: clean install build
$(info TSK: ci)
sh -c 'npm run test -- --ci || exit 255'
+ sh -c 'npm run prettier:check || exit 255'
diff --git a/package-lock.json b/package-lock.json
index 08818b3da..5f7d69d06 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,7 +20,7 @@
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lerna": "^8.0.0",
- "prettier": "^2.6.2",
+ "prettier": "^3.2.5",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
@@ -1933,6 +1933,21 @@
"semver": "^7.5.3"
}
},
+ "node_modules/@changesets/apply-release-plan/node_modules/prettier": {
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
+ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/@changesets/apply-release-plan/node_modules/semver": {
"version": "7.5.4",
"dev": true,
@@ -2200,6 +2215,21 @@
"prettier": "^2.7.1"
}
},
+ "node_modules/@changesets/write/node_modules/prettier": {
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
+ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/@discoveryjs/json-ext": {
"version": "0.5.7",
"dev": true,
@@ -22665,14 +22695,15 @@
}
},
"node_modules/prettier": {
- "version": "2.8.4",
+ "version": "3.2.5",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
+ "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
"dev": true,
- "license": "MIT",
"bin": {
- "prettier": "bin-prettier.js"
+ "prettier": "bin/prettier.cjs"
},
"engines": {
- "node": ">=10.13.0"
+ "node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
@@ -27120,19 +27151,19 @@
},
"packages/config": {
"name": "@onflow/config",
- "version": "1.3.0-alpha.3",
+ "version": "1.3.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/util-actor": "1.3.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
+ "@onflow/util-actor": "1.3.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
"eslint": "^8.34.0",
"eslint-plugin-jsdoc": "^46.9.0"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.11",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/estree": "^1.0.1",
"@types/jest": "^29.5.4",
"@typescript-eslint/eslint-plugin": "^6.5.0",
@@ -27158,30 +27189,30 @@
},
"packages/fcl": {
"name": "@onflow/fcl",
- "version": "1.10.0-alpha.10",
+ "version": "1.10.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/config": "1.3.0-alpha.3",
- "@onflow/fcl-core": "1.9.0-alpha.7",
+ "@onflow/config": "1.3.0",
+ "@onflow/fcl-core": "1.9.0",
"@onflow/interaction": "0.0.11",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/sdk": "1.4.0-alpha.8",
- "@onflow/types": "1.3.0-alpha.3",
- "@onflow/util-actor": "1.3.2-alpha.2",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
- "@onflow/util-semver": "1.0.2-alpha.0",
- "@onflow/util-template": "1.2.2-alpha.2",
- "@onflow/util-uid": "1.2.2-alpha.2",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/sdk": "1.4.0",
+ "@onflow/types": "1.3.0",
+ "@onflow/util-actor": "1.3.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
+ "@onflow/util-semver": "1.0.2",
+ "@onflow/util-template": "1.2.2",
+ "@onflow/util-uid": "1.2.2",
"cross-fetch": "^3.1.6",
"events": "^3.3.0",
"sha3": "^2.1.4"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/typedefs": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/typedefs": "1.3.0",
"@types/estree": "^1.0.1",
"@types/jest": "^29.5.10",
"@types/node": "^18.13.0",
@@ -27194,7 +27225,7 @@
},
"packages/fcl-bundle": {
"name": "@onflow/fcl-bundle",
- "version": "1.4.2-alpha.2",
+ "version": "1.4.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/plugin-transform-runtime": "^7.18.2",
@@ -27224,28 +27255,28 @@
},
"packages/fcl-core": {
"name": "@onflow/fcl-core",
- "version": "1.9.0-alpha.7",
+ "version": "1.9.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@improbable-eng/grpc-web": "^0.15.0",
- "@onflow/config": "1.3.0-alpha.3",
+ "@onflow/config": "1.3.0",
"@onflow/interaction": "0.0.11",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/sdk": "1.4.0-alpha.8",
- "@onflow/types": "1.3.0-alpha.3",
- "@onflow/util-actor": "1.3.2-alpha.2",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
- "@onflow/util-semver": "1.0.2-alpha.0",
- "@onflow/util-template": "1.2.2-alpha.2",
- "@onflow/util-uid": "1.2.2-alpha.2",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/sdk": "1.4.0",
+ "@onflow/types": "1.3.0",
+ "@onflow/util-actor": "1.3.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
+ "@onflow/util-semver": "1.0.2",
+ "@onflow/util-template": "1.2.2",
+ "@onflow/util-uid": "1.2.2",
"cross-fetch": "^3.1.6"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/typedefs": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/typedefs": "1.3.0",
"@types/estree": "^1.0.1",
"@types/jest": "^29.5.4",
"@types/node": "^18.13.0",
@@ -27288,28 +27319,28 @@
},
"packages/fcl-react-native": {
"name": "@onflow/fcl-react-native",
- "version": "1.9.0-alpha.10",
+ "version": "1.9.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/config": "1.3.0-alpha.3",
- "@onflow/fcl-core": "1.9.0-alpha.7",
+ "@onflow/config": "1.3.0",
+ "@onflow/fcl-core": "1.9.0",
"@onflow/interaction": "0.0.11",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/sdk": "1.4.0-alpha.8",
- "@onflow/types": "1.3.0-alpha.3",
- "@onflow/util-actor": "1.3.2-alpha.2",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
- "@onflow/util-semver": "1.0.2-alpha.0",
- "@onflow/util-template": "1.2.2-alpha.2",
- "@onflow/util-uid": "1.2.2-alpha.2",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/sdk": "1.4.0",
+ "@onflow/types": "1.3.0",
+ "@onflow/util-actor": "1.3.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
+ "@onflow/util-semver": "1.0.2",
+ "@onflow/util-template": "1.2.2",
+ "@onflow/util-uid": "1.2.2",
"cross-fetch": "^3.1.6"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/typedefs": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/typedefs": "1.3.0",
"@types/estree": "^1.0.1",
"@types/node": "^18.13.0",
"eslint": "^8.35.0",
@@ -27341,27 +27372,27 @@
},
"packages/fcl-wc": {
"name": "@onflow/fcl-wc",
- "version": "6.0.0-alpha.8",
+ "version": "5.0.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.9",
- "@onflow/config": "1.3.0-alpha.3",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
+ "@onflow/config": "1.3.0",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
"@walletconnect/modal": "^2.4.7",
"@walletconnect/sign-client": "^2.8.1",
"@walletconnect/types": "^2.8.1",
"@walletconnect/utils": "^2.8.1"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"better-sqlite3": "^7.6.2",
"eslint": "^8.35.0",
"eslint-plugin-jsdoc": "^46.9.0",
"jest": "^29.5.0"
},
"peerDependencies": {
- "@onflow/fcl": "1.10.0-alpha.10"
+ "@onflow/fcl": "1.10.0"
}
},
"packages/fcl/node_modules/typescript": {
@@ -27378,7 +27409,7 @@
},
"packages/protobuf": {
"name": "@onflow/protobuf",
- "version": "1.3.0-alpha.0",
+ "version": "1.3.0",
"license": "Apache-2.0",
"dependencies": {
"@improbable-eng/grpc-web": "^0.12.0",
@@ -27827,7 +27858,7 @@
},
"packages/rlp": {
"name": "@onflow/rlp",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "MPL-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
@@ -27835,7 +27866,7 @@
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -27846,26 +27877,26 @@
},
"packages/sdk": {
"name": "@onflow/sdk",
- "version": "1.4.0-alpha.8",
+ "version": "1.4.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/config": "1.3.0-alpha.3",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/transport-http": "1.10.0-alpha.4",
- "@onflow/typedefs": "1.3.0-alpha.3",
- "@onflow/util-actor": "1.3.2-alpha.2",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
- "@onflow/util-template": "1.2.2-alpha.2",
+ "@onflow/config": "1.3.0",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/transport-http": "1.10.0",
+ "@onflow/typedefs": "1.3.0",
+ "@onflow/util-actor": "1.3.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
+ "@onflow/util-template": "1.2.2",
"deepmerge": "^4.2.2",
"events": "^3.3.0",
"sha3": "^2.1.4",
"uuid": "^9.0.1"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/uuid": "^9.0.6",
"eslint": "^8.35.0",
"eslint-plugin-jsdoc": "^46.9.0",
@@ -27887,21 +27918,21 @@
},
"packages/transport-grpc": {
"name": "@onflow/transport-grpc",
- "version": "1.4.0-alpha.5",
+ "version": "1.4.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@improbable-eng/grpc-web": "^0.15.0",
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
- "@onflow/protobuf": "1.3.0-alpha.0",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-template": "1.2.2-alpha.2"
+ "@onflow/protobuf": "1.3.0",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-template": "1.2.2"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/sdk": "1.4.0-alpha.8",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/sdk": "1.4.0",
"jest": "^29.5.0"
}
},
@@ -27931,14 +27962,14 @@
},
"packages/transport-http": {
"name": "@onflow/transport-http",
- "version": "1.10.0-alpha.4",
+ "version": "1.10.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/util-address": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2",
- "@onflow/util-logger": "1.3.2-alpha.2",
- "@onflow/util-template": "1.2.2-alpha.2",
+ "@onflow/util-address": "1.2.2",
+ "@onflow/util-invariant": "1.2.2",
+ "@onflow/util-logger": "1.3.2",
+ "@onflow/util-template": "1.2.2",
"abort-controller": "^3.0.0",
"cross-fetch": "^3.1.6",
"events": "^3.3.0",
@@ -27946,10 +27977,10 @@
"ws": "^8.14.2"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/sdk": "1.4.0-alpha.8",
- "@onflow/types": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/rlp": "1.2.2",
+ "@onflow/sdk": "1.4.0",
+ "@onflow/types": "1.3.0",
"jest": "^29.5.0"
}
},
@@ -27974,13 +28005,13 @@
},
"packages/typedefs": {
"name": "@onflow/typedefs",
- "version": "1.3.0-alpha.3",
+ "version": "1.3.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/node": "^18.13.0",
"eslint": "^8.33.0",
"eslint-plugin-jsdoc": "^46.9.0",
@@ -28003,15 +28034,15 @@
},
"packages/types": {
"name": "@onflow/types",
- "version": "1.3.0-alpha.3",
+ "version": "1.3.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/util-logger": "1.3.2-alpha.2"
+ "@onflow/util-logger": "1.3.2"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -28022,7 +28053,7 @@
},
"packages/util-actor": {
"name": "@onflow/util-actor",
- "version": "1.3.2-alpha.2",
+ "version": "1.3.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
@@ -28030,7 +28061,7 @@
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -28041,15 +28072,15 @@
},
"packages/util-address": {
"name": "@onflow/util-address",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/types": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/types": "1.3.0",
"@types/jest": "^29.5.3",
"@types/node": "^18.13.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
@@ -28074,17 +28105,17 @@
},
"packages/util-encode-key": {
"name": "@onflow/util-encode-key",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/rlp": "1.2.2-alpha.2",
- "@onflow/util-invariant": "1.2.2-alpha.2"
+ "@onflow/rlp": "1.2.2",
+ "@onflow/util-invariant": "1.2.2"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/types": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/types": "1.3.0",
"@types/jest": "^29.5.3",
"@types/node": "^18.13.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
@@ -28109,15 +28140,15 @@
},
"packages/util-invariant": {
"name": "@onflow/util-invariant",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
- "@onflow/types": "1.3.0-alpha.3",
+ "@onflow/fcl-bundle": "1.4.2",
+ "@onflow/types": "1.3.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -28128,14 +28159,14 @@
},
"packages/util-logger": {
"name": "@onflow/util-logger",
- "version": "1.3.2-alpha.2",
+ "version": "1.3.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -28154,36 +28185,27 @@
},
"packages/util-semver": {
"name": "@onflow/util-semver",
- "version": "1.0.2-alpha.0",
+ "version": "1.0.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"jest": "^29.5.0"
}
},
- "packages/util-semver/node_modules/commander": {
- "version": "9.5.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
- "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
- "dev": true,
- "engines": {
- "node": "^12.20.0 || >=14"
- }
- },
"packages/util-template": {
"name": "@onflow/util-template",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6",
- "@onflow/util-logger": "1.3.2-alpha.2"
+ "@onflow/util-logger": "1.3.2"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
@@ -28194,14 +28216,14 @@
},
"packages/util-uid": {
"name": "@onflow/util-uid",
- "version": "1.2.2-alpha.2",
+ "version": "1.2.2",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
- "@onflow/fcl-bundle": "1.4.2-alpha.2",
+ "@onflow/fcl-bundle": "1.4.2",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
diff --git a/package.json b/package.json
index 6a7163fe7..494725cd1 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,8 @@
"test": "jest",
"release": "npm run build && npm run changeset publish",
"changeset": "changeset",
- "clear": "find . -name node_modules -type d -prune -exec rm -rf '{}' + && find . -name dist -type d -prune -exec rm -rf '{}' +"
+ "clear": "find . -name node_modules -type d -prune -exec rm -rf '{}' + && find . -name dist -type d -prune -exec rm -rf '{}' +",
+ "prettier:check": "prettier --check ."
},
"name": "fcl-js",
"devDependencies": {
@@ -23,7 +24,7 @@
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lerna": "^8.0.0",
- "prettier": "^2.6.2",
+ "prettier": "^3.2.5",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
diff --git a/packages/config/src/utils/utils.test.ts b/packages/config/src/utils/utils.test.ts
index eae5d4f46..2bf27a9d5 100644
--- a/packages/config/src/utils/utils.test.ts
+++ b/packages/config/src/utils/utils.test.ts
@@ -34,7 +34,7 @@ describe("getContracts", () => {
emulator: "0x333",
testnet: "0x222",
mainnet: "0x111",
- }
+ },
},
},
accounts: {
diff --git a/packages/config/src/utils/utils.ts b/packages/config/src/utils/utils.ts
index 1ac6c0c42..f73d681a4 100644
--- a/packages/config/src/utils/utils.ts
+++ b/packages/config/src/utils/utils.ts
@@ -128,14 +128,17 @@ const filterDependencies = (obj: FlowJson) =>
*/
const mapContractAliasesToNetworkAddress =
(network: string) => (contracts: Record) => {
- return Object.entries(contracts).reduce((c, [key, value]) => {
- const networkContractAlias = value?.aliases?.[network]
- if (networkContractAlias) {
- c[key] = networkContractAlias
- }
+ return Object.entries(contracts).reduce(
+ (c, [key, value]) => {
+ const networkContractAlias = value?.aliases?.[network]
+ if (networkContractAlias) {
+ c[key] = networkContractAlias
+ }
- return c
- }, {} as Record)
+ return c
+ },
+ {} as Record
+ )
}
/**
@@ -145,14 +148,17 @@ const mapContractAliasesToNetworkAddress =
*/
const mapDependencyAliasesToNetworkAddress =
(network: string) => (dependencies: Record) => {
- return Object.entries(dependencies).reduce((c, [key, value]) => {
- const networkDependencyAlias = value?.aliases?.[network]
- if (networkDependencyAlias) {
- c[key] = networkDependencyAlias
- }
+ return Object.entries(dependencies).reduce(
+ (c, [key, value]) => {
+ const networkDependencyAlias = value?.aliases?.[network]
+ if (networkDependencyAlias) {
+ c[key] = networkDependencyAlias
+ }
- return c
- }, {} as Record)
+ return c
+ },
+ {} as Record
+ )
}
const mapDeploymentsToNetworkAddress =
diff --git a/packages/fcl-bundle/.babelrc b/packages/fcl-bundle/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/fcl-bundle/.babelrc
+++ b/packages/fcl-bundle/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/fcl-bundle/src/build/get-input-options.js b/packages/fcl-bundle/src/build/get-input-options.js
index 0f3f9b55f..fce85ca34 100644
--- a/packages/fcl-bundle/src/build/get-input-options.js
+++ b/packages/fcl-bundle/src/build/get-input-options.js
@@ -90,7 +90,7 @@ module.exports = function getInputOptions(package, build) {
compilerOptions: {
// patch for rollup-plugin-typescript2 because rootDirs
// are used to resolve include/exclude filters
- rootDirs: [""]
+ rootDirs: [""],
},
},
useTsconfigDeclarationDir: true,
diff --git a/packages/fcl-core/.babelrc b/packages/fcl-core/.babelrc
index 927807e21..1e3225d50 100644
--- a/packages/fcl-core/.babelrc
+++ b/packages/fcl-core/.babelrc
@@ -7,5 +7,5 @@
}
],
"@babel/preset-typescript"
- ]
+ ]
}
diff --git a/packages/fcl-core/.eslintrc.json b/packages/fcl-core/.eslintrc.json
index 82311fab6..591164935 100644
--- a/packages/fcl-core/.eslintrc.json
+++ b/packages/fcl-core/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -28,4 +24,4 @@
"jsdoc/require-returns-description": 0,
"no-undef": 1
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-core/src/current-user/exec-service/index.js b/packages/fcl-core/src/current-user/exec-service/index.js
index 40a7c41be..93d879cc9 100644
--- a/packages/fcl-core/src/current-user/exec-service/index.js
+++ b/packages/fcl-core/src/current-user/exec-service/index.js
@@ -9,7 +9,13 @@ const execStrategy = async ({service, body, config, opts}) => {
return strategy({service, body, config, opts})
}
-export async function execService({service, msg = {}, config = {}, opts = {}, platform}) {
+export async function execService({
+ service,
+ msg = {},
+ config = {},
+ opts = {},
+ platform,
+}) {
msg.data = service.data
const execConfig = {
services: await configLens(/^service\./),
diff --git a/packages/fcl-core/src/current-user/exec-service/plugins.js b/packages/fcl-core/src/current-user/exec-service/plugins.js
index 8aaf9f449..f1eaaeed0 100644
--- a/packages/fcl-core/src/current-user/exec-service/plugins.js
+++ b/packages/fcl-core/src/current-user/exec-service/plugins.js
@@ -1,20 +1,20 @@
import {invariant} from "@onflow/util-invariant"
import {LEVELS, log} from "@onflow/util-logger"
import {isRequired, isString, isObject, isFunc} from "../../utils/is"
-import { CORE_STRATEGIES } from "../../utils/constants"
+import {CORE_STRATEGIES} from "../../utils/constants"
const stub = () => {
throw new Error(`Platform specific Core Strategies are not initialized`)
}
-const stubCoreStrategies = ({
+const stubCoreStrategies = {
[CORE_STRATEGIES["EXT/RPC"]]: stub,
[CORE_STRATEGIES["HTTP/POST"]]: stub,
[CORE_STRATEGIES["IFRAME/RPC"]]: stub,
[CORE_STRATEGIES["POP/RPC"]]: stub,
[CORE_STRATEGIES["TAB/RPC"]]: stub,
[CORE_STRATEGIES["EXT/RPC"]]: stub,
-})
+}
const supportedPlugins = ["ServicePlugin"]
const supportedServicePlugins = ["discovery-service"]
@@ -139,20 +139,23 @@ const PluginRegistry = () => {
}
let serviceRegistry
-const getIsServiceRegistryInitialized = () => typeof serviceRegistry !== 'undefined'
+const getIsServiceRegistryInitialized = () =>
+ typeof serviceRegistry !== "undefined"
export const initServiceRegistry = ({coreStrategies}) => {
if (getIsServiceRegistryInitialized()) {
return serviceRegistry
}
- const _serviceRegistry = ServiceRegistry({coreStrategies});
- serviceRegistry = _serviceRegistry;
+ const _serviceRegistry = ServiceRegistry({coreStrategies})
+ serviceRegistry = _serviceRegistry
return _serviceRegistry
}
export const getServiceRegistry = () => {
if (!getIsServiceRegistryInitialized()) {
- console.warn("Registry is not initalized, it will be initialized with stub core strategies")
+ console.warn(
+ "Registry is not initalized, it will be initialized with stub core strategies"
+ )
return initServiceRegistry({coreStrategies: stubCoreStrategies})
}
diff --git a/packages/fcl-core/src/current-user/exec-service/strategies/http-post.js b/packages/fcl-core/src/current-user/exec-service/strategies/http-post.js
index 722cf1860..d93697849 100644
--- a/packages/fcl-core/src/current-user/exec-service/strategies/http-post.js
+++ b/packages/fcl-core/src/current-user/exec-service/strategies/http-post.js
@@ -5,76 +5,74 @@ import {poll} from "./utils/poll"
import {VERSION} from "../../../VERSION"
import {serviceEndpoint} from "../strategies/utils/service-endpoint"
-export const getExecHttpPost = (execLocal) => async({service, body, config, opts}) => {
- const resp = await fetchService(service, {
- data: {
- fclVersion: VERSION,
- service: {
- params: service.params,
- data: service.data,
- type: service.type,
+export const getExecHttpPost =
+ execLocal =>
+ async ({service, body, config, opts}) => {
+ const resp = await fetchService(service, {
+ data: {
+ fclVersion: VERSION,
+ service: {
+ params: service.params,
+ data: service.data,
+ type: service.type,
+ },
+ config,
+ ...body,
},
- config,
- ...body,
- },
- }).then(normalizePollingResponse)
+ }).then(normalizePollingResponse)
- if (resp.status === "APPROVED") {
- return resp.data
- } else if (resp.status === "DECLINED") {
- throw new Error(`Declined: ${resp.reason || "No reason supplied."}`)
- } else if (resp.status === "REDIRECT") {
- return resp
- } else if (resp.status === "PENDING") {
+ if (resp.status === "APPROVED") {
+ return resp.data
+ } else if (resp.status === "DECLINED") {
+ throw new Error(`Declined: ${resp.reason || "No reason supplied."}`)
+ } else if (resp.status === "REDIRECT") {
+ return resp
+ } else if (resp.status === "PENDING") {
+ // these two flags are required to run polling one more time before it stops
+ var canContinue = true
+ var shouldContinue = true
- // these two flags are required to run polling one more time before it stops
- var canContinue = true
- var shouldContinue = true
-
- const [_, unmount] = await execLocal(
- normalizeLocalView(resp.local),
- {
+ const [_, unmount] = await execLocal(normalizeLocalView(resp.local), {
serviceEndpoint,
- onClose: () => (shouldContinue = false)
+ onClose: () => (shouldContinue = false),
+ })
+
+ const close = () => {
+ try {
+ unmount()
+ shouldContinue = false
+ } catch (error) {
+ console.error("Frame Close Error", error)
+ }
}
- )
+ /**
+ * this function is run once per poll call.
+ * Offsetting canContinue flag to make sure that
+ * the polling is performed one extra time after canContinue flag is set to false
+ * to prevent halting on Android when a browser calls window.close
+ * before FCL receives a successful result from polling
+ *
+ * @returns {boolean}
+ */
+ const checkCanContinue = () => {
+ const offsetCanContinue = canContinue
+ canContinue = shouldContinue
- const close = () => {
- try {
- unmount()
- shouldContinue = false
- } catch (error) {
- console.error("Frame Close Error", error)
+ return offsetCanContinue
}
- }
- /**
- * this function is run once per poll call.
- * Offsetting canContinue flag to make sure that
- * the polling is performed one extra time after canContinue flag is set to false
- * to prevent halting on Android when a browser calls window.close
- * before FCL receives a successful result from polling
- *
- * @returns {boolean}
- */
- const checkCanContinue = () => {
- const offsetCanContinue = canContinue
- canContinue = shouldContinue
- return offsetCanContinue
+ return poll(resp.updates, checkCanContinue)
+ .then(serviceResponse => {
+ close()
+ return serviceResponse
+ })
+ .catch(error => {
+ console.error(error)
+ close()
+ throw error
+ })
+ } else {
+ console.error(`Auto Decline: Invalid Response`, {service, resp})
+ throw new Error(`Auto Decline: Invalid Response`)
}
-
- return poll(resp.updates, checkCanContinue)
- .then(serviceResponse => {
- close()
- return serviceResponse
- })
- .catch(error => {
- console.error(error)
- close()
- throw error
- })
- } else {
- console.error(`Auto Decline: Invalid Response`, {service, resp})
- throw new Error(`Auto Decline: Invalid Response`)
}
-}
diff --git a/packages/fcl-core/src/current-user/index.js b/packages/fcl-core/src/current-user/index.js
index 20c2e1399..e25a07b10 100644
--- a/packages/fcl-core/src/current-user/index.js
+++ b/packages/fcl-core/src/current-user/index.js
@@ -133,7 +133,10 @@ async function getAccountProofData() {
return accountProofData
}
-const makeConfig = async ({discoveryAuthnInclude, discoveryFeaturesSuggested}) => {
+const makeConfig = async ({
+ discoveryAuthnInclude,
+ discoveryFeaturesSuggested,
+}) => {
return {
client: {
discoveryAuthnInclude,
diff --git a/packages/fcl-core/src/discovery/services.js b/packages/fcl-core/src/discovery/services.js
index 8583444cd..425a1aca1 100644
--- a/packages/fcl-core/src/discovery/services.js
+++ b/packages/fcl-core/src/discovery/services.js
@@ -26,7 +26,7 @@ export async function getServices({types}) {
fclVersion: VERSION,
include,
features: {
- suggested: await config.get("discovery.features.suggested", [])
+ suggested: await config.get("discovery.features.suggested", []),
},
clientServices: await makeDiscoveryServices(),
supportedStrategies: getServiceRegistry().getStrategies(),
diff --git a/packages/fcl-core/src/discovery/services/authn.js b/packages/fcl-core/src/discovery/services/authn.js
index e62b6c678..1873416d1 100644
--- a/packages/fcl-core/src/discovery/services/authn.js
+++ b/packages/fcl-core/src/discovery/services/authn.js
@@ -55,7 +55,7 @@ const HANDLERS = {
'"fcl.discovery" is only available in the browser.'
)
// If you call this before the window is loaded extensions will not be set yet
- if (document.readyState === 'complete') {
+ if (document.readyState === "complete") {
fetchServicesFromDiscovery()
} else {
window.onload = async () => {
@@ -90,7 +90,7 @@ const spawnProviders = () => spawn(HANDLERS, SERVICE_ACTOR_KEYS.AUTHN)
/**
* @description
* Discovery methods for interacting with Authn.
- *
+ *
* @typedef {object} Authn
* @property {Function} subscribe - Subscribe to Discovery authn services
* @property {Function} snapshot - Get the current Discovery authn services spanshot
diff --git a/packages/fcl-core/src/discovery/utils.js b/packages/fcl-core/src/discovery/utils.js
index d64b0e6f7..934362a6c 100644
--- a/packages/fcl-core/src/discovery/utils.js
+++ b/packages/fcl-core/src/discovery/utils.js
@@ -9,7 +9,10 @@ export const makeDiscoveryServices = async () => {
export async function getDiscoveryService(service) {
const discoveryAuthnInclude = await config.get("discovery.authn.include", [])
- const discoveryFeaturesSuggested = await config.get("discovery.features.suggested", [])
+ const discoveryFeaturesSuggested = await config.get(
+ "discovery.features.suggested",
+ []
+ )
const discoveryWalletMethod = await config.first([
"discovery.wallet.method",
"discovery.wallet.method.default",
diff --git a/packages/fcl-core/src/document/document.test.js b/packages/fcl-core/src/document/document.test.js
index 43a29330b..ca34d89a5 100644
--- a/packages/fcl-core/src/document/document.test.js
+++ b/packages/fcl-core/src/document/document.test.js
@@ -2,17 +2,18 @@ import {retrieve} from "./document.js"
import {config} from "@onflow/config"
describe("resolveArguments", () => {
-
- test("Should invoke resolver", async () => {
- const templateResolver = jest.fn()
+ test("Should invoke resolver", async () => {
+ const templateResolver = jest.fn()
- const ret = await config.overload({
- "document.resolver.testprotocol": templateResolver
- }, async d => {
- await retrieve({ url: "testprotocol://example.test" })
+ const ret = await config.overload(
+ {
+ "document.resolver.testprotocol": templateResolver,
+ },
+ async d => {
+ await retrieve({url: "testprotocol://example.test"})
- expect(templateResolver.mock.calls.length).toEqual(1)
- })
- })
-
-})
\ No newline at end of file
+ expect(templateResolver.mock.calls.length).toEqual(1)
+ }
+ )
+ })
+})
diff --git a/packages/fcl-core/src/events/index.test.ts b/packages/fcl-core/src/events/index.test.ts
index b3c0c1b11..070e64361 100644
--- a/packages/fcl-core/src/events/index.test.ts
+++ b/packages/fcl-core/src/events/index.test.ts
@@ -40,7 +40,7 @@ describe("events", () => {
sdk.subscribeEvents({eventTypes: ["A"]}),
])
})
-
+
test("should work with empty args", () => {
events().subscribe(() => {})
expect(sendSpy).toHaveBeenCalledWith([sdk.subscribeEvents({})])
diff --git a/packages/fcl-core/src/events/index.ts b/packages/fcl-core/src/events/index.ts
index 90909a34a..b6b9e1bbf 100644
--- a/packages/fcl-core/src/events/index.ts
+++ b/packages/fcl-core/src/events/index.ts
@@ -28,17 +28,24 @@ export function events(filterOrType?: EventFilter | string) {
]).then(decode)
// If the subscribe fails, fallback to legacy events
- const legacySubscriptionPromise = streamPromise.then(() => null).catch((e) => {
- // Only fallback to legacy events if the error is specifcally about the unsupported feature
- if(e.message !== "SDK Send Error: subscribeEvents is not supported by this transport.") {
- throw e
- }
+ const legacySubscriptionPromise = streamPromise
+ .then(() => null)
+ .catch(e => {
+ // Only fallback to legacy events if the error is specifcally about the unsupported feature
+ if (
+ e.message !==
+ "SDK Send Error: subscribeEvents is not supported by this transport."
+ ) {
+ throw e
+ }
- if (typeof filterOrType !== "string") {
- throw new Error("GRPC fcl.events fallback only supports string (type) filters")
- }
- return legacyEvents(filterOrType).subscribe(callback)
- })
+ if (typeof filterOrType !== "string") {
+ throw new Error(
+ "GRPC fcl.events fallback only supports string (type) filters"
+ )
+ }
+ return legacyEvents(filterOrType).subscribe(callback)
+ })
// Subscribe to the stream using the callback
function onEvents(data: Event[]) {
@@ -51,12 +58,12 @@ export function events(filterOrType?: EventFilter | string) {
// If using legacy events, don't subscribe to the stream
legacySubscriptionPromise.then(legacySubscription => {
if (!legacySubscription) {
- streamPromise.then(stream =>
- stream.on("events", onEvents).on("error", onError)
- ).catch((error) => {
- streamPromise.then(stream => stream.close())
- onError(error)
- })
+ streamPromise
+ .then(stream => stream.on("events", onEvents).on("error", onError))
+ .catch(error => {
+ streamPromise.then(stream => stream.close())
+ onError(error)
+ })
}
})
@@ -72,4 +79,4 @@ export function events(filterOrType?: EventFilter | string) {
}
},
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-core/src/events/legacy-events.js b/packages/fcl-core/src/events/legacy-events.js
index d47976430..a4412fbc9 100644
--- a/packages/fcl-core/src/events/legacy-events.js
+++ b/packages/fcl-core/src/events/legacy-events.js
@@ -74,7 +74,7 @@ const spawnEvents = key => spawn(HANDLERS, key)
* @description - Subscribe to events
* @param {string} key - A valid event name
* @returns {SubscribeObject}
- *
+ *
* @example
* import * as fcl from "@onflow/fcl"
* fcl.events(eventName).subscribe((event) => console.log(event))
diff --git a/packages/fcl-core/src/fcl-core.ts b/packages/fcl-core/src/fcl-core.ts
index 8910f88d0..ac43b5b43 100644
--- a/packages/fcl-core/src/fcl-core.ts
+++ b/packages/fcl-core/src/fcl-core.ts
@@ -127,19 +127,22 @@ import {watchForChainIdChanges} from "./utils"
// Set chain id default on access node change
watchForChainIdChanges()
-
export {getMutate} from "./exec/mutate"
export {getCurrentUser} from "./current-user"
export {initServiceRegistry} from "./current-user/exec-service/plugins"
-export { isReactNative, setIsReactNative } from './utils/is-react-native'
+export {isReactNative, setIsReactNative} from "./utils/is-react-native"
export {getExecHttpPost} from "./current-user/exec-service/strategies/http-post"
export {normalizePollingResponse} from "./normalizers/service/polling-response"
export {buildMessageHandler} from "./current-user/exec-service/strategies/utils/buildMessageHandler"
export {serviceEndpoint} from "./current-user/exec-service/strategies/utils/service-endpoint"
-export {URL} from './utils/url'
-export {CORE_STRATEGIES, FCL_REDIRECT_URL_PARAM_NAME, FCL_RESPONSE_PARAM_NAME } from './utils/constants'
+export {URL} from "./utils/url"
+export {
+ CORE_STRATEGIES,
+ FCL_REDIRECT_URL_PARAM_NAME,
+ FCL_RESPONSE_PARAM_NAME,
+} from "./utils/constants"
diff --git a/packages/fcl-core/src/interaction-template-utils/derive-cadence-by-network/derive-cadence-by-network.test.js b/packages/fcl-core/src/interaction-template-utils/derive-cadence-by-network/derive-cadence-by-network.test.js
index 78a86e2a3..4124bce4b 100644
--- a/packages/fcl-core/src/interaction-template-utils/derive-cadence-by-network/derive-cadence-by-network.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/derive-cadence-by-network/derive-cadence-by-network.test.js
@@ -220,5 +220,4 @@ describe("Derive cadence by network 1.1.0", () => {
})
).rejects.toThrow(Error)
})
-
})
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.0.0.js b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.0.0.js
index bd2efcf31..28958346e 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.0.0.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.0.0.js
@@ -1,71 +1,64 @@
-import {
- invariant,
- send,
- getAccount,
- config,
- decode,
- } from "@onflow/sdk"
- import {genHash} from "../utils/hash.js"
- import {findImports} from "../utils/find-imports.js"
- import {generateImport} from "../utils/generate-import.js"
-
- /**
- * @description Produces a dependency pin for a contract at current state of chain
- * @param {object} params
- * @param {string} params.address - The address of the account containing the contract
- * @param {string} params.contractName - The name of the contract
- * @param {object} opts - Options to pass to the interaction
- * @returns {Promise} - The dependency pin
- */
- export async function generateDependencyPin100(
- {address, contractName},
- opts = {}
- ) {
- invariant(
- address != undefined,
- "generateDependencyPin({ address }) -- address must be defined"
- )
- invariant(
- contractName != undefined,
- "generateDependencyPin({ contractName }) -- contractName must be defined"
- )
- invariant(
- typeof address === "string",
- "generateDependencyPin({ address }) -- address must be a string"
- )
- invariant(
- typeof contractName === "string",
- "generateDependencyPin({ contractName }) -- contractName must be a string"
- )
-
- const horizon = [generateImport({contractName, address})]
-
- for (const horizonImport of horizon) {
- const account = await send(
- [
- getAccount(
- await config().get(horizonImport.address, horizonImport.address)
- ),
- ],
- opts
- ).then(decode)
-
- horizonImport.contract = account.contracts?.[horizonImport.contractName]
-
- if (!horizonImport.contract) {
- console.error("Did not find expected contract", horizonImport, account)
- throw new Error("Did not find expected contract")
- }
-
- const contractImports = findImports(horizonImport.contract)
-
- horizon.push(...contractImports)
+import {invariant, send, getAccount, config, decode} from "@onflow/sdk"
+import {genHash} from "../utils/hash.js"
+import {findImports} from "../utils/find-imports.js"
+import {generateImport} from "../utils/generate-import.js"
+
+/**
+ * @description Produces a dependency pin for a contract at current state of chain
+ * @param {object} params
+ * @param {string} params.address - The address of the account containing the contract
+ * @param {string} params.contractName - The name of the contract
+ * @param {object} opts - Options to pass to the interaction
+ * @returns {Promise} - The dependency pin
+ */
+export async function generateDependencyPin100(
+ {address, contractName},
+ opts = {}
+) {
+ invariant(
+ address != undefined,
+ "generateDependencyPin({ address }) -- address must be defined"
+ )
+ invariant(
+ contractName != undefined,
+ "generateDependencyPin({ contractName }) -- contractName must be defined"
+ )
+ invariant(
+ typeof address === "string",
+ "generateDependencyPin({ address }) -- address must be a string"
+ )
+ invariant(
+ typeof contractName === "string",
+ "generateDependencyPin({ contractName }) -- contractName must be a string"
+ )
+
+ const horizon = [generateImport({contractName, address})]
+
+ for (const horizonImport of horizon) {
+ const account = await send(
+ [
+ getAccount(
+ await config().get(horizonImport.address, horizonImport.address)
+ ),
+ ],
+ opts
+ ).then(decode)
+
+ horizonImport.contract = account.contracts?.[horizonImport.contractName]
+
+ if (!horizonImport.contract) {
+ console.error("Did not find expected contract", horizonImport, account)
+ throw new Error("Did not find expected contract")
}
-
- const contractHashes = horizon.map(iport => genHash(iport.contract))
-
- const contractHashesJoined = contractHashes.join("")
-
- return genHash(contractHashesJoined)
+
+ const contractImports = findImports(horizonImport.contract)
+
+ horizon.push(...contractImports)
}
-
\ No newline at end of file
+
+ const contractHashes = horizon.map(iport => genHash(iport.contract))
+
+ const contractHashesJoined = contractHashes.join("")
+
+ return genHash(contractHashesJoined)
+}
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.1.0.js b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.1.0.js
index a8a73a4cd..df7fd154b 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.1.0.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin-1.1.0.js
@@ -1,10 +1,4 @@
-import {
- invariant,
- send,
- getAccount,
- config,
- decode,
-} from "@onflow/sdk"
+import {invariant, send, getAccount, config, decode} from "@onflow/sdk"
import {genHash} from "../utils/hash.js"
import {findImports} from "../utils/find-imports.js"
import {generateImport} from "../utils/generate-import.js"
@@ -37,7 +31,7 @@ export async function generateDependencyPin110(
typeof contractName === "string",
"generateDependencyPin({ contractName }) -- contractName must be a string"
)
-
+
const horizon = [generateImport({contractName, address})]
for (const horizonImport of horizon) {
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.js b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.js
index 475dfa013..c18f95567 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.js
@@ -1,72 +1,67 @@
-import {
- block,
- invariant,
-} from "@onflow/sdk"
+import {block, invariant} from "@onflow/sdk"
import {generateDependencyPin110} from "./generate-dependency-pin-1.1.0.js"
import {generateDependencyPin100} from "./generate-dependency-pin-1.0.0.js"
-
- /**
- * @description Produces a dependency pin for a contract at current state of chain
- * @param {object} params
- * @param {string} params.version - The version of the interaction template
- * @param {string} params.address - The address of the account containing the contract
- * @param {string} params.contractName - The name of the contract
- * @param {object} opts - Options to pass to the interaction
- * @returns {Promise} - The dependency pin
- */
- export async function generateDependencyPin(
- {version, address, contractName },
- opts = {}
- ) {
- invariant(
- address != undefined,
- "generateDependencyPin({ address }) -- address must be defined"
- )
- invariant(
- contractName != undefined,
- "generateDependencyPin({ contractName }) -- contractName must be defined"
- )
- invariant(
- typeof address === "string",
- "generateDependencyPin({ address }) -- address must be a string"
- )
- invariant(
- typeof contractName === "string",
- "generateDependencyPin({ contractName }) -- contractName must be a string"
- )
- switch (version) {
- case "1.1.0":
- return await generateDependencyPin110({address, contractName})
- case "1.0.0":
- return await generateDependencyPin100({address, contractName })
- default:
- throw new Error(
- "deriveCadenceByNetwork Error: Unsupported template version"
- )
- }
+/**
+ * @description Produces a dependency pin for a contract at current state of chain
+ * @param {object} params
+ * @param {string} params.version - The version of the interaction template
+ * @param {string} params.address - The address of the account containing the contract
+ * @param {string} params.contractName - The name of the contract
+ * @param {object} opts - Options to pass to the interaction
+ * @returns {Promise} - The dependency pin
+ */
+export async function generateDependencyPin(
+ {version, address, contractName},
+ opts = {}
+) {
+ invariant(
+ address != undefined,
+ "generateDependencyPin({ address }) -- address must be defined"
+ )
+ invariant(
+ contractName != undefined,
+ "generateDependencyPin({ contractName }) -- contractName must be defined"
+ )
+ invariant(
+ typeof address === "string",
+ "generateDependencyPin({ address }) -- address must be a string"
+ )
+ invariant(
+ typeof contractName === "string",
+ "generateDependencyPin({ contractName }) -- contractName must be a string"
+ )
+
+ switch (version) {
+ case "1.1.0":
+ return await generateDependencyPin110({address, contractName})
+ case "1.0.0":
+ return await generateDependencyPin100({address, contractName})
+ default:
+ throw new Error(
+ "deriveCadenceByNetwork Error: Unsupported template version"
+ )
+ }
}
+/**
+ * @description Produces a dependency pin for a contract at latest sealed block
+ * @param {object} params
+ * @param {string} params.version - The version of the interaction template
+ * @param {string} params.address - The address of the account containing the contract
+ * @param {string} params.contractName - The name of the contract
+ * @param {object} opts - Options to pass to the interaction
+ * @returns {Promise} - The dependency pin
+ */
+export async function generateDependencyPinAtLatestSealedBlock(
+ {version, address, contractName},
+ opts = {}
+) {
+ const latestSealedBlock = await block({sealed: true}, opts)
+ const latestSealedBlockHeight = latestSealedBlock?.height
- /**
- * @description Produces a dependency pin for a contract at latest sealed block
- * @param {object} params
- * @param {string} params.version - The version of the interaction template
- * @param {string} params.address - The address of the account containing the contract
- * @param {string} params.contractName - The name of the contract
- * @param {object} opts - Options to pass to the interaction
- * @returns {Promise} - The dependency pin
- */
- export async function generateDependencyPinAtLatestSealedBlock(
- {version, address, contractName},
- opts = {}
- ) {
- const latestSealedBlock = await block({sealed: true}, opts)
- const latestSealedBlockHeight = latestSealedBlock?.height
-
- return generateDependencyPin(
- {version, address, contractName, blockHeight: latestSealedBlockHeight},
- opts
- )
- }
-
\ No newline at end of file
+ return generateDependencyPin(
+ {version, address, contractName, blockHeight: latestSealedBlockHeight},
+ opts
+ )
+}
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.test.js b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.test.js
index b4a0196ff..f7c2c2999 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-dependency-pin/generate-dependency-pin.test.js
@@ -1,4 +1,7 @@
-import {generateDependencyPin110, generateDependencySelfPin} from "./generate-dependency-pin-1.1.0.js"
+import {
+ generateDependencyPin110,
+ generateDependencySelfPin,
+} from "./generate-dependency-pin-1.1.0.js"
import {config} from "@onflow/config"
const returnedAccount = {
@@ -6,8 +9,7 @@ const returnedAccount = {
keys: [],
balance: "10",
contracts: {
- FungibleToken:
-`/**
+ FungibleToken: `/**
# The Flow Fungible Token standard
@@ -252,8 +254,8 @@ pub contract interface FungibleToken {
jest.mock("@onflow/sdk", () => ({
send: jest.fn().mockImplementation(({}) => {
// Adjusted mock implementation
- const sanitized = returnedAccount.contracts.FungibleToken.replace(/\\/g, '');
- returnedAccount.contracts.FungibleToken = sanitized;
+ const sanitized = returnedAccount.contracts.FungibleToken.replace(/\\/g, "")
+ returnedAccount.contracts.FungibleToken = sanitized
return Promise.resolve(returnedAccount)
}),
getAccount: jest.fn().mockImplementation(({}) => {
@@ -298,5 +300,4 @@ describe("1.1.0, generate dependency pin", () => {
expect(depPin).toEqual(pin)
})
-
})
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.0.0.js b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.0.0.js
index 757ac931f..1361c8bad 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.0.0.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.0.0.js
@@ -105,13 +105,9 @@ export async function generateTemplateId({template}) {
Object.keys(templateData?.["arguments"]).map(async argumentLabel => [
genHash(argumentLabel),
[
- genHash(
- String(templateData?.["arguments"]?.[argumentLabel].index)
- ),
+ genHash(String(templateData?.["arguments"]?.[argumentLabel].index)),
genHash(templateData?.["arguments"]?.[argumentLabel].type),
- genHash(
- templateData?.["arguments"]?.[argumentLabel].balance || ""
- ),
+ genHash(templateData?.["arguments"]?.[argumentLabel].balance || ""),
await Promise.all(
Object.keys(
templateData?.["arguments"]?.[argumentLabel].messages
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.1.0.test.js b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.1.0.test.js
index 3245c05cb..073c99579 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.1.0.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id-1.1.0.test.js
@@ -7,8 +7,7 @@ const returnedAccount = {
keys: [],
balance: "10",
contracts: {
- FungibleToken:
-`/**
+ FungibleToken: `/**
# The Flow Fungible Token standard
diff --git a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id.js b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id.js
index 74e22809e..dbba8af2c 100644
--- a/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id.js
+++ b/packages/fcl-core/src/interaction-template-utils/generate-template-id/generate-template-id.js
@@ -42,5 +42,5 @@ export async function generateTemplateId({template}) {
*/
export async function verifyGeneratedTemplateId({template}) {
- return template.id === await generateTemplateId({template})
-}
\ No newline at end of file
+ return template.id === (await generateTemplateId({template}))
+}
diff --git a/packages/fcl-core/src/interaction-template-utils/get-template-argument-message.test.js b/packages/fcl-core/src/interaction-template-utils/get-template-argument-message.test.js
index e40e2715c..9073c0780 100644
--- a/packages/fcl-core/src/interaction-template-utils/get-template-argument-message.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/get-template-argument-message.test.js
@@ -241,7 +241,7 @@ describe("Get interaction template v1.1.0 parameters messages", () => {
],
},
}
-
+
test("It gets argument message for given argument and internationalization", async () => {
const message = getTemplateArgumentMessage({
localization: "en-US",
diff --git a/packages/fcl-core/src/interaction-template-utils/get-template-message.test.js b/packages/fcl-core/src/interaction-template-utils/get-template-message.test.js
index ce4af4b6c..678c1b512 100644
--- a/packages/fcl-core/src/interaction-template-utils/get-template-message.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/get-template-message.test.js
@@ -257,7 +257,6 @@ describe("Get interaction template messages 1.1.0", () => {
expect(description).toEqual("Transfer Flow to account")
})
-
test("It fails to get message for an unknown message key", async () => {
const message = getTemplateMessage({
localization: "en-US",
diff --git a/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.js b/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.js
index a31e092c8..cb347ade8 100644
--- a/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.js
+++ b/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.js
@@ -1,16 +1,15 @@
-
/**
- * @description - Replaces string imports with the actual contract address
- *
+ * @description - Replaces string imports with the actual contract address
+ *
* @param {object} param
* @param {string} param.cadence
* @param {object} param.networkDependencies
* @returns {string} - Cadence
*/
export function replaceStringImports({cadence, networkDependencies}) {
- return Object.keys(networkDependencies).reduce((c, contractName) => {
- const address = networkDependencies[contractName]
- const regex = new RegExp(`import "\\b${contractName}\\b"`, "g");
- return c.replace(regex, `import ${contractName} from ${address}`);
- }, cadence)
-}
\ No newline at end of file
+ return Object.keys(networkDependencies).reduce((c, contractName) => {
+ const address = networkDependencies[contractName]
+ const regex = new RegExp(`import "\\b${contractName}\\b"`, "g")
+ return c.replace(regex, `import ${contractName} from ${address}`)
+ }, cadence)
+}
diff --git a/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.test.js b/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.test.js
index 7c0c0da93..a32afe71d 100644
--- a/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/utils/replace-string-imports.test.js
@@ -11,16 +11,17 @@ describe("Verify replace imports works ", () => {
expect(cadence).toEqual("import FungibleToken from 0xf233dcee88fe0abe\n\n")
})
-
test("replace multiple import", async () => {
const cadence = await replaceStringImports({
cadence: 'import "FungibleToken"\nimport "NonFungibleToken"\n\n',
networkDependencies: {
FungibleToken: "0xf233dcee88fe0abe",
- NonFungibleToken: "0x1d7e57aa55817448"
+ NonFungibleToken: "0x1d7e57aa55817448",
},
})
- expect(cadence).toEqual("import FungibleToken from 0xf233dcee88fe0abe\nimport NonFungibleToken from 0x1d7e57aa55817448\n\n")
+ expect(cadence).toEqual(
+ "import FungibleToken from 0xf233dcee88fe0abe\nimport NonFungibleToken from 0x1d7e57aa55817448\n\n"
+ )
})
})
diff --git a/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.js b/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.js
index b91dae62b..2863988e1 100644
--- a/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.js
+++ b/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.js
@@ -52,7 +52,7 @@ export async function verifyDependencyPinsSame(
const templateDependencyPlaceholder =
template.data.dependencies[templateDependencyPlaceholderKey]
- const templateDependencyPlaceholderContractNames = Object.keys(
+ const templateDependencyPlaceholderContractNames = Object.keys(
templateDependencyPlaceholder
)
@@ -62,7 +62,7 @@ export async function verifyDependencyPinsSame(
templateDependencyPlaceholderContractName
]
- const templateDependency =
+ const templateDependency =
templateDependencyPlaceholderContractNetworks[network]
if (typeof templateDependency === "undefined") continue
diff --git a/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.test.js b/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.test.js
index 009ffca14..945d3fbac 100644
--- a/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.test.js
+++ b/packages/fcl-core/src/interaction-template-utils/verify-dependency-pin-same-at-block.test.js
@@ -6,8 +6,7 @@ const returnedAccount = {
keys: [],
balance: "10",
contracts: {
- FungibleToken:
-`/**
+ FungibleToken: `/**
# The Flow Fungible Token standard
@@ -252,8 +251,8 @@ pub contract interface FungibleToken {
jest.mock("@onflow/sdk", () => ({
send: jest.fn().mockImplementation(({}) => {
// Adjusted mock implementation
- const sanitized = returnedAccount.contracts.FungibleToken.replace(/\\/g, '');
- returnedAccount.contracts.FungibleToken = sanitized;
+ const sanitized = returnedAccount.contracts.FungibleToken.replace(/\\/g, "")
+ returnedAccount.contracts.FungibleToken = sanitized
return Promise.resolve(returnedAccount)
}),
getAccount: jest.fn().mockImplementation(({}) => {
@@ -275,148 +274,148 @@ jest.mock("@onflow/sdk", () => ({
}),
atBlockHeight: jest.fn().mockImplementation(({}) => {
// Adjusted mock implementation
- return
- })
+ return
+ }),
}))
const template = {
- f_type: "InteractionTemplate",
- f_version: "1.1.0",
- id: "3accd8c0bf4c7b543a80287d6c158043b4c2e737c2205dba6e009abbbf1328a4",
- data: {
- type: "transaction",
- interface: "",
- messages: [
- {
- key: "title",
- i18n: [
- {
- tag: "en-US",
- translation: "Transfer Tokens",
- },
- ],
- },
- {
- key: "description",
- i18n: [
- {
- tag: "en-US",
- translation: "Transfer Flow to account",
- },
- ],
- },
- ],
- cadence: {
- body: 'import "FungibleToken"\n\n#interaction(\n version: "1.1.0",\n title: "Transfer Flow",\n description: "Transfer Flow to account",\n language: "en-US",\n parameters: [\n Parameter(\n name: "amount", \n title: "Amount", \n description: "The amount of FLOW tokens to send"\n ),\n Parameter(\n name: "to", \n title: "To",\n description: "The Flow account the tokens will go to"\n )\n ],\n)\n\ntransaction(amount: UFix64, to: Address) {\n let vault: @FungibleToken.Vault\n \n prepare(signer: AuthAccount) {\n self.vault \u003c- signer\n .borrow\u003c\u0026{FungibleToken.Provider}\u003e(from: /storage/flowTokenVault)!\n .withdraw(amount: amount)\n }\n\n execute {\n getAccount(to)\n .getCapability(/public/flowTokenReceiver)!\n .borrow\u003c\u0026{FungibleToken.Receiver}\u003e()!\n .deposit(from: \u003c-self.vault)\n }\n}',
- network_pins: [
+ f_type: "InteractionTemplate",
+ f_version: "1.1.0",
+ id: "3accd8c0bf4c7b543a80287d6c158043b4c2e737c2205dba6e009abbbf1328a4",
+ data: {
+ type: "transaction",
+ interface: "",
+ messages: [
+ {
+ key: "title",
+ i18n: [
{
- network: "mainnet",
- pin_self:
- "dd046de8ef442e4d708124d5710cb78962eb884a4387df1f0b1daf374bd28278",
+ tag: "en-US",
+ translation: "Transfer Tokens",
},
+ ],
+ },
+ {
+ key: "description",
+ i18n: [
{
- network: "testnet",
- pin_self:
- "4089786f5e19fe66b39e347634ca28229851f4de1fd469bd8f327d79510e771f",
+ tag: "en-US",
+ translation: "Transfer Flow to account",
},
],
},
- dependencies: [
+ ],
+ cadence: {
+ body: 'import "FungibleToken"\n\n#interaction(\n version: "1.1.0",\n title: "Transfer Flow",\n description: "Transfer Flow to account",\n language: "en-US",\n parameters: [\n Parameter(\n name: "amount", \n title: "Amount", \n description: "The amount of FLOW tokens to send"\n ),\n Parameter(\n name: "to", \n title: "To",\n description: "The Flow account the tokens will go to"\n )\n ],\n)\n\ntransaction(amount: UFix64, to: Address) {\n let vault: @FungibleToken.Vault\n \n prepare(signer: AuthAccount) {\n self.vault \u003c- signer\n .borrow\u003c\u0026{FungibleToken.Provider}\u003e(from: /storage/flowTokenVault)!\n .withdraw(amount: amount)\n }\n\n execute {\n getAccount(to)\n .getCapability(/public/flowTokenReceiver)!\n .borrow\u003c\u0026{FungibleToken.Receiver}\u003e()!\n .deposit(from: \u003c-self.vault)\n }\n}',
+ network_pins: [
{
- contracts: [
- {
- contract: "FungibleToken",
- networks: [
- {
- network: "mainnet",
- address: "0xf233dcee88fe0abe",
- dependency_pin_block_height: 70493190,
- dependency_pin: {
- pin: "ac0208f93d07829ec96584d618ddbec6af3cf4e2866bd5071249e8ec93c7e0dc",
- pin_self:
- "cdadd5b5897f2dfe35d8b25f4e41fea9f8fca8f40f8a8b506b33701ef5033076",
- pin_contract_name: "FungibleToken",
- pin_contract_address: "0xf233dcee88fe0abe",
- imports: [],
- },
- },
- {
- network: "testnet",
- address: "0x9a0766d93b6608b7",
- dependency_pin_block_height: 149595558,
- dependency_pin: {
- pin: "ac0208f93d07829ec96584d618ddbec6af3cf4e2866bd5071249e8ec93c7e0dc",
- pin_self:
- "cdadd5b5897f2dfe35d8b25f4e41fea9f8fca8f40f8a8b506b33701ef5033076",
- pin_contract_name: "FungibleToken",
- pin_contract_address: "0x9a0766d93b6608b7",
- imports: [],
- },
- },
- {
- network: "emulator",
- address: "0xee82856bf20e2aa6",
- dependency_pin_block_height: 0,
- },
- ],
- },
- ],
- },
- ],
- parameters: [
- {
- label: "amount",
- index: 0,
- type: "UFix64",
- messages: [
- {
- key: "title",
- i18n: [
- {
- tag: "en-US",
- translation: "Amount",
- },
- ],
- },
- {
- key: "description",
- i18n: [
- {
- tag: "en-US",
- translation: "The amount of FLOW tokens to send",
- },
- ],
- },
- ],
+ network: "mainnet",
+ pin_self:
+ "dd046de8ef442e4d708124d5710cb78962eb884a4387df1f0b1daf374bd28278",
},
{
- label: "to",
- index: 1,
- type: "Address",
- messages: [
- {
- key: "title",
- i18n: [
- {
- tag: "en-US",
- translation: "To",
- },
- ],
- },
- {
- key: "description",
- i18n: [
- {
- tag: "en-US",
- translation: "The Flow account the tokens will go to",
- },
- ],
- },
- ],
+ network: "testnet",
+ pin_self:
+ "4089786f5e19fe66b39e347634ca28229851f4de1fd469bd8f327d79510e771f",
},
],
},
- }
+ dependencies: [
+ {
+ contracts: [
+ {
+ contract: "FungibleToken",
+ networks: [
+ {
+ network: "mainnet",
+ address: "0xf233dcee88fe0abe",
+ dependency_pin_block_height: 70493190,
+ dependency_pin: {
+ pin: "ac0208f93d07829ec96584d618ddbec6af3cf4e2866bd5071249e8ec93c7e0dc",
+ pin_self:
+ "cdadd5b5897f2dfe35d8b25f4e41fea9f8fca8f40f8a8b506b33701ef5033076",
+ pin_contract_name: "FungibleToken",
+ pin_contract_address: "0xf233dcee88fe0abe",
+ imports: [],
+ },
+ },
+ {
+ network: "testnet",
+ address: "0x9a0766d93b6608b7",
+ dependency_pin_block_height: 149595558,
+ dependency_pin: {
+ pin: "ac0208f93d07829ec96584d618ddbec6af3cf4e2866bd5071249e8ec93c7e0dc",
+ pin_self:
+ "cdadd5b5897f2dfe35d8b25f4e41fea9f8fca8f40f8a8b506b33701ef5033076",
+ pin_contract_name: "FungibleToken",
+ pin_contract_address: "0x9a0766d93b6608b7",
+ imports: [],
+ },
+ },
+ {
+ network: "emulator",
+ address: "0xee82856bf20e2aa6",
+ dependency_pin_block_height: 0,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ parameters: [
+ {
+ label: "amount",
+ index: 0,
+ type: "UFix64",
+ messages: [
+ {
+ key: "title",
+ i18n: [
+ {
+ tag: "en-US",
+ translation: "Amount",
+ },
+ ],
+ },
+ {
+ key: "description",
+ i18n: [
+ {
+ tag: "en-US",
+ translation: "The amount of FLOW tokens to send",
+ },
+ ],
+ },
+ ],
+ },
+ {
+ label: "to",
+ index: 1,
+ type: "Address",
+ messages: [
+ {
+ key: "title",
+ i18n: [
+ {
+ tag: "en-US",
+ translation: "To",
+ },
+ ],
+ },
+ {
+ key: "description",
+ i18n: [
+ {
+ tag: "en-US",
+ translation: "The Flow account the tokens will go to",
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+}
describe("1.1.0, verify dependency pin same", () => {
beforeAll(() => {
@@ -428,7 +427,6 @@ describe("1.1.0, verify dependency pin same", () => {
})
test("v1.1.0, get dependency pin", async () => {
-
config.put("flow.network", "mainnet")
config.put("accessNode.api", "https://rest-mainnet.onflow.org")
@@ -440,5 +438,4 @@ describe("1.1.0, verify dependency pin same", () => {
expect(isVerified).toEqual(true)
})
-
})
diff --git a/packages/fcl-core/src/normalizers/interaction-template/interaction-template.js b/packages/fcl-core/src/normalizers/interaction-template/interaction-template.js
index 3fd43c137..bb5bb79c6 100644
--- a/packages/fcl-core/src/normalizers/interaction-template/interaction-template.js
+++ b/packages/fcl-core/src/normalizers/interaction-template/interaction-template.js
@@ -5,9 +5,7 @@ export async function normalizeInteractionTemplate(template) {
switch (template["f_version"]) {
case "1.0.0":
- return normalizeInteractionTemplate(
- normalize100to110({template})
- )
+ return normalizeInteractionTemplate(normalize100to110({template}))
case "1.1.0":
return template
default:
diff --git a/packages/fcl-core/src/utils/constants.js b/packages/fcl-core/src/utils/constants.js
index 21e74ff0f..6d1792269 100644
--- a/packages/fcl-core/src/utils/constants.js
+++ b/packages/fcl-core/src/utils/constants.js
@@ -1,5 +1,5 @@
-export const FCL_REDIRECT_URL_PARAM_NAME = 'fcl_redirect_url'
-export const FCL_RESPONSE_PARAM_NAME = 'fclResponseJson'
+export const FCL_REDIRECT_URL_PARAM_NAME = "fcl_redirect_url"
+export const FCL_RESPONSE_PARAM_NAME = "fclResponseJson"
export const CORE_STRATEGIES = {
"HTTP/RPC": "HTTP/RPC",
@@ -8,5 +8,5 @@ export const CORE_STRATEGIES = {
"POP/RPC": "POP/RPC",
"TAB/RPC": "TAB/RPC",
"EXT/RPC": "EXT/RPC",
- "DEEPLINK/RPC": "DEEPLINK/RPC"
+ "DEEPLINK/RPC": "DEEPLINK/RPC",
}
diff --git a/packages/fcl-core/src/wallet-utils/on-message-from-fcl.js b/packages/fcl-core/src/wallet-utils/on-message-from-fcl.js
index 239bf1a37..04547a312 100644
--- a/packages/fcl-core/src/wallet-utils/on-message-from-fcl.js
+++ b/packages/fcl-core/src/wallet-utils/on-message-from-fcl.js
@@ -1,7 +1,7 @@
/**
* @description
* Listens for messages from FCL
- *
+ *
* @param {string} messageType - Message type
* @param {Function} cb - Callback function
* @returns {Function} - Function to remove event listener
diff --git a/packages/fcl-core/tsconfig.json b/packages/fcl-core/tsconfig.json
index c8f99ccaa..617d9a8ae 100644
--- a/packages/fcl-core/tsconfig.json
+++ b/packages/fcl-core/tsconfig.json
@@ -4,6 +4,6 @@
"include": ["src/**/*"],
"compilerOptions": {
"declarationDir": "types",
- "rootDir": "src",
+ "rootDir": "src"
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-react-native/.babelrc b/packages/fcl-react-native/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/fcl-react-native/.babelrc
+++ b/packages/fcl-react-native/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/fcl-react-native/.eslintrc.json b/packages/fcl-react-native/.eslintrc.json
index 82311fab6..591164935 100644
--- a/packages/fcl-react-native/.eslintrc.json
+++ b/packages/fcl-react-native/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -28,4 +24,4 @@
"jsdoc/require-returns-description": 0,
"no-undef": 1
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-react-native/src/fcl-react-native.ts b/packages/fcl-react-native/src/fcl-react-native.ts
index 9d1860654..061a07096 100644
--- a/packages/fcl-react-native/src/fcl-react-native.ts
+++ b/packages/fcl-react-native/src/fcl-react-native.ts
@@ -63,7 +63,12 @@ export {
nodeVersionInfo,
} from "@onflow/fcl-core"
-import {getMutate, getCurrentUser, initServiceRegistry, setIsReactNative} from "@onflow/fcl-core"
+import {
+ getMutate,
+ getCurrentUser,
+ initServiceRegistry,
+ setIsReactNative,
+} from "@onflow/fcl-core"
export const mutate = getMutate({platform: "react-native"})
const currentUser = getCurrentUser({platform: "react-native"})
diff --git a/packages/fcl-react-native/src/utils/react-native/ServiceDiscovery.js b/packages/fcl-react-native/src/utils/react-native/ServiceDiscovery.js
index 17712377d..e03bc5db6 100644
--- a/packages/fcl-react-native/src/utils/react-native/ServiceDiscovery.js
+++ b/packages/fcl-react-native/src/utils/react-native/ServiceDiscovery.js
@@ -1,5 +1,5 @@
-import { useState, useEffect, createElement } from 'react'
-import { StyleSheet, Text, View, TouchableOpacity } from 'react-native'
+import {useState, useEffect, createElement} from "react"
+import {StyleSheet, Text, View, TouchableOpacity} from "react-native"
/**
* @typedef {import("@onflow/typedefs").Service} Service
@@ -14,9 +14,9 @@ import { StyleSheet, Text, View, TouchableOpacity } from 'react-native'
*/
const fetcher = (url, opts) => {
return fetch(url, {
- method: 'POST',
+ method: "POST",
headers: {
- 'Content-Type': 'application/json',
+ "Content-Type": "application/json",
},
body: JSON.stringify(opts),
}).then(d => d.json())
@@ -34,7 +34,8 @@ const DefaultLoadingComponent = () => createElement(Text, null, "Loading...")
*
* @returns {JSX.Element} - The empty component.
*/
-const DefaultEmptyComponent = () => createElement(Text, null, "No Wallets Found")
+const DefaultEmptyComponent = () =>
+ createElement(Text, null, "No Wallets Found")
/**
* Default service card component that renders a TouchableOpacity with the service provider's name as text.
@@ -44,14 +45,11 @@ const DefaultEmptyComponent = () => createElement(Text, null, "No Wallets Found"
* @param {Function} props.onPress - The onPress event handler.
* @returns {JSX.Element} - The service card component.
*/
-const DefaultServiceCard = ({
- service,
- onPress
-}) => {
+const DefaultServiceCard = ({service, onPress}) => {
return createElement(
TouchableOpacity,
- { onPress },
- createElement(Text, null, service?.provider?.name),
+ {onPress},
+ createElement(Text, null, service?.provider?.name)
)
}
@@ -62,7 +60,8 @@ const DefaultServiceCard = ({
* @param {JSX.Element[]} props.children - The children components.
* @returns {JSX.Element} - The wrapper component.
*/
-const DefaultWrapper = ({ children }) => createElement(View, { style: styles.container }, ...children)
+const DefaultWrapper = ({children}) =>
+ createElement(View, {style: styles.container}, ...children)
/**
* Custom hook for service discovery.
@@ -74,7 +73,7 @@ const DefaultWrapper = ({ children }) => createElement(View, { style: styles.con
* @property {boolean} isLoading - A flag indicating whether the services are being loaded.
* @property {Function} authenticateService - A function to authenticate a service.
*/
-export const useServiceDiscovery = ({ fcl }) => {
+export const useServiceDiscovery = ({fcl}) => {
const [services, setServices] = useState([])
const [isLoading, setIsLoading] = useState(false)
@@ -84,8 +83,8 @@ export const useServiceDiscovery = ({ fcl }) => {
try {
const response = await fetcher(endpoint, {
fclVersion: fcl.VERSION,
- userAgent: 'ReactNative',
- supportedStrategies: ['HTTP/POST'],
+ userAgent: "ReactNative",
+ supportedStrategies: ["HTTP/POST"],
})
setServices(response)
setIsLoading(false)
@@ -103,9 +102,9 @@ export const useServiceDiscovery = ({ fcl }) => {
*
* @param {object} service - The service object to authenticate.
*/
- const authenticateService = (service) => {
+ const authenticateService = service => {
if (services.includes(service)) {
- fcl.authenticate({ service })
+ fcl.authenticate({service})
}
}
@@ -132,34 +131,33 @@ export const ServiceDiscovery = ({
Loading = DefaultLoadingComponent,
Empty = DefaultEmptyComponent,
ServiceCard = DefaultServiceCard,
- Wrapper = DefaultWrapper
+ Wrapper = DefaultWrapper,
}) => {
- const { services, isLoading, authenticateService } = useServiceDiscovery({ fcl })
+ const {services, isLoading, authenticateService} = useServiceDiscovery({fcl})
return createElement(
Wrapper,
null,
isLoading && createElement(Loading),
!isLoading && services.length === 0 && createElement(Empty),
- !isLoading && services.map((service, index) => {
- return (
- createElement(ServiceCard, {
+ !isLoading &&
+ services.map((service, index) => {
+ return createElement(ServiceCard, {
key: service?.provider?.address ?? index,
service,
onPress: () => {
authenticateService(service)
- }
+ },
})
- )
- })
+ })
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
- backgroundColor: '#fff',
- alignItems: 'center',
- justifyContent: 'center',
+ backgroundColor: "#fff",
+ alignItems: "center",
+ justifyContent: "center",
},
})
diff --git a/packages/fcl-react-native/src/utils/react-native/__tests__/default-config.test.js b/packages/fcl-react-native/src/utils/react-native/__tests__/default-config.test.js
index 6eaec4096..f0b03cf58 100644
--- a/packages/fcl-react-native/src/utils/react-native/__tests__/default-config.test.js
+++ b/packages/fcl-react-native/src/utils/react-native/__tests__/default-config.test.js
@@ -1,8 +1,10 @@
-import {getDefaultConfig} from "../default-config";
+import {getDefaultConfig} from "../default-config"
describe("getDefaultConfig tests", () => {
it("should return default config", () => {
const defaultConfig = getDefaultConfig()
- expect(defaultConfig["discovery.wallet.method.default"]).toBe("DEEPLINK/RPC");
+ expect(defaultConfig["discovery.wallet.method.default"]).toBe(
+ "DEEPLINK/RPC"
+ )
})
})
diff --git a/packages/fcl-react-native/src/utils/react-native/coreStrategies.js b/packages/fcl-react-native/src/utils/react-native/coreStrategies.js
index f684ac53b..44e50646c 100644
--- a/packages/fcl-react-native/src/utils/react-native/coreStrategies.js
+++ b/packages/fcl-react-native/src/utils/react-native/coreStrategies.js
@@ -1,9 +1,9 @@
import {CORE_STRATEGIES, getExecHttpPost} from "@onflow/fcl-core"
import {execLocal} from "./exec-local"
-import {execDeeplinkRPC} from './strategies/deeplink-rpc'
+import {execDeeplinkRPC} from "./strategies/deeplink-rpc"
-export const coreStrategies = ({
+export const coreStrategies = {
[CORE_STRATEGIES["HTTP/RPC"]]: getExecHttpPost(execLocal),
[CORE_STRATEGIES["HTTP/POST"]]: getExecHttpPost(execLocal),
- [CORE_STRATEGIES["DEEPLINK/RPC"]]: execDeeplinkRPC
-})
+ [CORE_STRATEGIES["DEEPLINK/RPC"]]: execDeeplinkRPC,
+}
diff --git a/packages/fcl-react-native/src/utils/react-native/default-config.js b/packages/fcl-react-native/src/utils/react-native/default-config.js
index 8d1f44caa..8c487b152 100644
--- a/packages/fcl-react-native/src/utils/react-native/default-config.js
+++ b/packages/fcl-react-native/src/utils/react-native/default-config.js
@@ -1,11 +1,12 @@
-import AsyncStorage from '@react-native-async-storage/async-storage';
+import AsyncStorage from "@react-native-async-storage/async-storage"
const getAsyncStorage = () => {
try {
const ASYNC_STORAGE = {
can: true,
get: async key => JSON.parse(await AsyncStorage.getItem(key)),
- put: async (key, value) => await AsyncStorage.setItem(key, JSON.stringify(value)),
+ put: async (key, value) =>
+ await AsyncStorage.setItem(key, JSON.stringify(value)),
}
return ASYNC_STORAGE
} catch (error) {
@@ -19,4 +20,3 @@ export const getDefaultConfig = () => {
"fcl.storage.default": getAsyncStorage(),
}
}
-
diff --git a/packages/fcl-react-native/src/utils/react-native/index.js b/packages/fcl-react-native/src/utils/react-native/index.js
index 0e4b83a5b..d3060c6f2 100644
--- a/packages/fcl-react-native/src/utils/react-native/index.js
+++ b/packages/fcl-react-native/src/utils/react-native/index.js
@@ -1,3 +1,3 @@
-export {ServiceDiscovery, useServiceDiscovery} from './ServiceDiscovery'
-export {getDefaultConfig} from './default-config'
-export {coreStrategies} from './coreStrategies'
+export {ServiceDiscovery, useServiceDiscovery} from "./ServiceDiscovery"
+export {getDefaultConfig} from "./default-config"
+export {coreStrategies} from "./coreStrategies"
diff --git a/packages/fcl-react-native/src/utils/react-native/strategies/deeplink-rpc.js b/packages/fcl-react-native/src/utils/react-native/strategies/deeplink-rpc.js
index 0ea72f8b1..9d6f82050 100644
--- a/packages/fcl-react-native/src/utils/react-native/strategies/deeplink-rpc.js
+++ b/packages/fcl-react-native/src/utils/react-native/strategies/deeplink-rpc.js
@@ -1,9 +1,8 @@
-import { normalizePollingResponse } from "@onflow/fcl-core"
+import {normalizePollingResponse} from "@onflow/fcl-core"
import {browser} from "./utils/browser"
export function execDeeplinkRPC({service, config, body}) {
return new Promise((resolve, reject) => {
-
browser(service, config, body, {
onResponse: (e, {close}) => {
try {
diff --git a/packages/fcl-react-native/src/utils/react-native/strategies/utils/service-endpoint.js b/packages/fcl-react-native/src/utils/react-native/strategies/utils/service-endpoint.js
index 4ee01bafa..2710885e0 100644
--- a/packages/fcl-react-native/src/utils/react-native/strategies/utils/service-endpoint.js
+++ b/packages/fcl-react-native/src/utils/react-native/strategies/utils/service-endpoint.js
@@ -1,15 +1,19 @@
import {URL} from "@onflow/fcl-core"
-const isBodyEmpty = (body) => {
- return !body || (body?.data !== undefined && Object.keys(body).filter(key => key !== 'data').length === 0)
+const isBodyEmpty = body => {
+ return (
+ !body ||
+ (body?.data !== undefined &&
+ Object.keys(body).filter(key => key !== "data").length === 0)
+ )
}
export function serviceEndpoint(service, config, body) {
const url = new URL(service.endpoint)
if (!isBodyEmpty(body)) {
- url.searchParams.append('fclMessageJson', JSON.stringify({...body, config}))
+ url.searchParams.append("fclMessageJson", JSON.stringify({...body, config}))
} else {
- url.searchParams.append('fclMessageJson', JSON.stringify({config}))
+ url.searchParams.append("fclMessageJson", JSON.stringify({config}))
}
if (service.params != null) {
diff --git a/packages/fcl-react-native/tsconfig.json b/packages/fcl-react-native/tsconfig.json
index c8f99ccaa..617d9a8ae 100644
--- a/packages/fcl-react-native/tsconfig.json
+++ b/packages/fcl-react-native/tsconfig.json
@@ -4,6 +4,6 @@
"include": ["src/**/*"],
"compilerOptions": {
"declarationDir": "types",
- "rootDir": "src",
+ "rootDir": "src"
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-wc/.babelrc b/packages/fcl-wc/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/fcl-wc/.babelrc
+++ b/packages/fcl-wc/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/fcl-wc/.eslintrc.json b/packages/fcl-wc/.eslintrc.json
index 82311fab6..591164935 100644
--- a/packages/fcl-wc/.eslintrc.json
+++ b/packages/fcl-wc/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -28,4 +24,4 @@
"jsdoc/require-returns-description": 0,
"no-undef": 1
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl-wc/src/fcl-wc.test.js b/packages/fcl-wc/src/fcl-wc.test.js
index 021b88580..68cc18d4d 100644
--- a/packages/fcl-wc/src/fcl-wc.test.js
+++ b/packages/fcl-wc/src/fcl-wc.test.js
@@ -1,21 +1,21 @@
-import {init} from './fcl-wc'
-import * as fcl from '@onflow/fcl'
+import {init} from "./fcl-wc"
+import * as fcl from "@onflow/fcl"
-jest.mock('@walletconnect/modal', () => {})
-jest.mock('@walletconnect/sign-client', () => {})
-jest.mock('@walletconnect/utils', () => {})
+jest.mock("@walletconnect/modal", () => {})
+jest.mock("@walletconnect/sign-client", () => {})
+jest.mock("@walletconnect/utils", () => {})
-jest.mock('@onflow/fcl', () => {
+jest.mock("@onflow/fcl", () => {
return {
__esModule: true,
- ...jest.requireActual('@onflow/fcl')
- };
-});
+ ...jest.requireActual("@onflow/fcl"),
+ }
+})
describe("Init Client", () => {
let chainIdSpy
beforeEach(() => {
- chainIdSpy = jest.spyOn(fcl, 'getChainId')
+ chainIdSpy = jest.spyOn(fcl, "getChainId")
chainIdSpy.mockImplementation(async () => "testnet")
})
diff --git a/packages/fcl/.eslintrc.json b/packages/fcl/.eslintrc.json
index 82311fab6..591164935 100644
--- a/packages/fcl/.eslintrc.json
+++ b/packages/fcl/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -28,4 +24,4 @@
"jsdoc/require-returns-description": 0,
"no-undef": 1
}
-}
\ No newline at end of file
+}
diff --git a/packages/fcl/src/fcl.ts b/packages/fcl/src/fcl.ts
index 1d8b583e3..d31c699d3 100644
--- a/packages/fcl/src/fcl.ts
+++ b/packages/fcl/src/fcl.ts
@@ -63,7 +63,7 @@ export {
nodeVersionInfo,
} from "@onflow/fcl-core"
-import {getMutate, getCurrentUser, initServiceRegistry } from "@onflow/fcl-core"
+import {getMutate, getCurrentUser, initServiceRegistry} from "@onflow/fcl-core"
export const mutate = getMutate({platform: "web"})
diff --git a/packages/fcl/src/utils/web/__tests__/default-config.test.js b/packages/fcl/src/utils/web/__tests__/default-config.test.js
index 61ccc66bf..d36664238 100644
--- a/packages/fcl/src/utils/web/__tests__/default-config.test.js
+++ b/packages/fcl/src/utils/web/__tests__/default-config.test.js
@@ -1,8 +1,8 @@
-import {getDefaultConfig} from "../default-config";
+import {getDefaultConfig} from "../default-config"
describe("getDefaultConfig tests", () => {
it("should return default config", () => {
const defaultConfig = getDefaultConfig()
- expect(defaultConfig["discovery.wallet.method.default"]).toBe("IFRAME/RPC");
+ expect(defaultConfig["discovery.wallet.method.default"]).toBe("IFRAME/RPC")
})
})
diff --git a/packages/fcl/src/utils/web/coreStrategies.js b/packages/fcl/src/utils/web/coreStrategies.js
index 232bcadef..226efd040 100644
--- a/packages/fcl/src/utils/web/coreStrategies.js
+++ b/packages/fcl/src/utils/web/coreStrategies.js
@@ -5,11 +5,11 @@ import {execTabRPC} from "./strategies/tab-rpc"
import {execExtRPC} from "./strategies/ext-rpc"
import {execLocal} from "./exec-local"
-export const coreStrategies = ({
+export const coreStrategies = {
[CORE_STRATEGIES["HTTP/RPC"]]: getExecHttpPost(execLocal),
[CORE_STRATEGIES["HTTP/POST"]]: getExecHttpPost(execLocal),
[CORE_STRATEGIES["IFRAME/RPC"]]: execIframeRPC,
[CORE_STRATEGIES["POP/RPC"]]: execPopRPC,
[CORE_STRATEGIES["TAB/RPC"]]: execTabRPC,
[CORE_STRATEGIES["EXT/RPC"]]: execExtRPC,
-})
+}
diff --git a/packages/fcl/src/utils/web/default-config.js b/packages/fcl/src/utils/web/default-config.js
index 3bbf571b0..02c783eac 100644
--- a/packages/fcl/src/utils/web/default-config.js
+++ b/packages/fcl/src/utils/web/default-config.js
@@ -5,7 +5,8 @@ const getSessionStorage = () => {
const SESSION_STORAGE = {
can: !isServerSide(),
get: async key => JSON.parse(sessionStorage.getItem(key)),
- put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)),
+ put: async (key, value) =>
+ sessionStorage.setItem(key, JSON.stringify(value)),
}
return SESSION_STORAGE
} catch (error) {
diff --git a/packages/fcl/src/utils/web/index.js b/packages/fcl/src/utils/web/index.js
index edd0b8cb9..86d47b3c9 100644
--- a/packages/fcl/src/utils/web/index.js
+++ b/packages/fcl/src/utils/web/index.js
@@ -1,5 +1,5 @@
-export {renderFrame} from './render-frame'
-export {renderPop} from './render-pop'
-export {renderTab} from './render-tab'
-export {getDefaultConfig} from './default-config'
-export {coreStrategies} from './coreStrategies'
+export {renderFrame} from "./render-frame"
+export {renderPop} from "./render-pop"
+export {renderTab} from "./render-tab"
+export {getDefaultConfig} from "./default-config"
+export {coreStrategies} from "./coreStrategies"
diff --git a/packages/fcl/src/utils/web/strategies/utils/extension.js b/packages/fcl/src/utils/web/strategies/utils/extension.js
index 5c4031151..5198cd265 100644
--- a/packages/fcl/src/utils/web/strategies/utils/extension.js
+++ b/packages/fcl/src/utils/web/strategies/utils/extension.js
@@ -1,4 +1,4 @@
-import { buildMessageHandler } from "@onflow/fcl-core"
+import {buildMessageHandler} from "@onflow/fcl-core"
const noop = () => {}
diff --git a/packages/fcl/src/utils/web/strategies/utils/frame.js b/packages/fcl/src/utils/web/strategies/utils/frame.js
index cf863ed1d..928e358be 100644
--- a/packages/fcl/src/utils/web/strategies/utils/frame.js
+++ b/packages/fcl/src/utils/web/strategies/utils/frame.js
@@ -1,5 +1,5 @@
import {renderFrame} from "../../render-frame"
-import { buildMessageHandler, serviceEndpoint } from "@onflow/fcl-core"
+import {buildMessageHandler, serviceEndpoint} from "@onflow/fcl-core"
const noop = () => {}
diff --git a/packages/fcl/src/utils/web/strategies/utils/pop.js b/packages/fcl/src/utils/web/strategies/utils/pop.js
index d4aa0f79b..a279d2727 100644
--- a/packages/fcl/src/utils/web/strategies/utils/pop.js
+++ b/packages/fcl/src/utils/web/strategies/utils/pop.js
@@ -1,5 +1,5 @@
import {renderPop} from "../../render-pop"
-import { buildMessageHandler, serviceEndpoint } from "@onflow/fcl-core"
+import {buildMessageHandler, serviceEndpoint} from "@onflow/fcl-core"
const noop = () => {}
diff --git a/packages/fcl/src/utils/web/strategies/utils/tab.js b/packages/fcl/src/utils/web/strategies/utils/tab.js
index 7ea025576..53c1f7291 100644
--- a/packages/fcl/src/utils/web/strategies/utils/tab.js
+++ b/packages/fcl/src/utils/web/strategies/utils/tab.js
@@ -1,5 +1,5 @@
import {renderTab} from "../../render-tab"
-import { buildMessageHandler, serviceEndpoint } from "@onflow/fcl-core"
+import {buildMessageHandler, serviceEndpoint} from "@onflow/fcl-core"
const noop = () => {}
diff --git a/packages/fcl/tsconfig.json b/packages/fcl/tsconfig.json
index c8f99ccaa..617d9a8ae 100644
--- a/packages/fcl/tsconfig.json
+++ b/packages/fcl/tsconfig.json
@@ -4,6 +4,6 @@
"include": ["src/**/*"],
"compilerOptions": {
"declarationDir": "types",
- "rootDir": "src",
+ "rootDir": "src"
}
-}
\ No newline at end of file
+}
diff --git a/packages/protobuf/.babelrc b/packages/protobuf/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/protobuf/.babelrc
+++ b/packages/protobuf/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/sdk/.eslintrc.json b/packages/sdk/.eslintrc.json
index 65fa03caf..07472a62c 100644
--- a/packages/sdk/.eslintrc.json
+++ b/packages/sdk/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -20,4 +16,4 @@
"jsdoc/require-jsdoc": 0,
"jsdoc/valid-types": 0
}
-}
\ No newline at end of file
+}
diff --git a/packages/sdk/src/build/build-authorizations.js b/packages/sdk/src/build/build-authorizations.js
index ae1ee0a8b..64a5b4b64 100644
--- a/packages/sdk/src/build/build-authorizations.js
+++ b/packages/sdk/src/build/build-authorizations.js
@@ -1,4 +1,4 @@
-import { TransactionRole } from "@onflow/typedefs"
+import {TransactionRole} from "@onflow/typedefs"
import {pipe, prepAccount} from "../interaction/interaction"
export function authorizations(ax = []) {
diff --git a/packages/sdk/src/build/build-get-events-at-block-height-range.js b/packages/sdk/src/build/build-get-events-at-block-height-range.js
index 58c19bd93..569aa12e1 100644
--- a/packages/sdk/src/build/build-get-events-at-block-height-range.js
+++ b/packages/sdk/src/build/build-get-events-at-block-height-range.js
@@ -10,7 +10,11 @@ import {pipe, Ok, makeGetEvents} from "../interaction/interaction"
* @param {number} toBlockHeight - The height of the block to stop looking for events (inclusive)
* @returns {Function} - An interaction object
*/
-export function getEventsAtBlockHeightRange(eventName, fromBlockHeight, toBlockHeight) {
+export function getEventsAtBlockHeightRange(
+ eventName,
+ fromBlockHeight,
+ toBlockHeight
+) {
return pipe([
makeGetEvents,
ix => {
diff --git a/packages/sdk/src/encode/encode.test.js b/packages/sdk/src/encode/encode.test.js
index 8c224fe61..79168315e 100644
--- a/packages/sdk/src/encode/encode.test.js
+++ b/packages/sdk/src/encode/encode.test.js
@@ -376,8 +376,7 @@ describe("encode txId from voucher", () => {
{
address: "01",
keyId: 4,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
],
}),
@@ -426,20 +425,17 @@ describe("encode txId from voucher", () => {
{
address: "03",
keyId: 0,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
{
address: "01",
keyId: 0,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
{
address: "02",
keyId: 0,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
],
}),
@@ -453,20 +449,17 @@ describe("encode txId from voucher", () => {
{
address: "01",
keyId: 2,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
{
address: "01",
keyId: 0,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
{
address: "01",
keyId: 1,
- sig:
- "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
+ sig: "f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
],
}),
diff --git a/packages/sdk/src/encode/encode.ts b/packages/sdk/src/encode/encode.ts
index 46d274d9b..785ba8728 100644
--- a/packages/sdk/src/encode/encode.ts
+++ b/packages/sdk/src/encode/encode.ts
@@ -25,7 +25,8 @@ const addressBuffer = (addr: string) => leftPaddedHexBuffer(addr, 8)
const blockBuffer = (block: string) => leftPaddedHexBuffer(block, 32)
-const argumentToString = (arg: Record) => Buffer.from(JSON.stringify(arg), "utf8")
+const argumentToString = (arg: Record) =>
+ Buffer.from(JSON.stringify(arg), "utf8")
const scriptBuffer = (script: string) => Buffer.from(script, "utf8")
const signatureBuffer = (signature: string) => Buffer.from(signature, "hex")
@@ -44,11 +45,11 @@ const preparePayload = (tx: Transaction) => {
validatePayload(tx)
return [
- scriptBuffer(tx.cadence || ''),
+ scriptBuffer(tx.cadence || ""),
tx.arguments.map(argumentToString),
- blockBuffer(tx.refBlock || ''),
+ blockBuffer(tx.refBlock || ""),
tx.computeLimit,
- addressBuffer(sansPrefix(tx.proposalKey.address || '')),
+ addressBuffer(sansPrefix(tx.proposalKey.address || "")),
tx.proposalKey.keyId,
tx.proposalKey.sequenceNum,
addressBuffer(sansPrefix(tx.payer)),
@@ -65,9 +66,10 @@ const prepareEnvelope = (tx: Transaction) => {
const preparePayloadSignatures = (tx: Transaction) => {
const signers = collectSigners(tx)
- return tx.payloadSigs?.map((sig: Sig) => {
+ return tx.payloadSigs
+ ?.map((sig: Sig) => {
return {
- signerIndex: signers.get(sig.address) || '',
+ signerIndex: signers.get(sig.address) || "",
keyId: sig.keyId,
sig: sig.sig,
}
@@ -97,7 +99,7 @@ const collectSigners = (tx: Voucher | Transaction) => {
}
}
- if (tx.proposalKey.address){
+ if (tx.proposalKey.address) {
addSigner(tx.proposalKey.address)
}
addSigner(tx.payer)
@@ -113,15 +115,15 @@ const prepareVoucher = (voucher: Voucher) => {
const prepareSigs = (sigs: Sig[]) => {
return sigs
- .map(({ address, keyId, sig }) => {
- return { signerIndex: signers.get(address) || '', keyId, sig }
+ .map(({address, keyId, sig}) => {
+ return {signerIndex: signers.get(address) || "", keyId, sig}
})
.sort((a, b) => {
if (a.signerIndex > b.signerIndex) return 1
if (a.signerIndex < b.signerIndex) return -1
if (a.keyId > b.keyId) return 1
if (a.keyId < b.keyId) return -1
-
+
return 0
})
.map(sig => {
@@ -200,9 +202,9 @@ interface VoucherProposalKey {
}
interface Sig {
- address: string,
- keyId: number | string,
- sig: string,
+ address: string
+ keyId: number | string
+ sig: string
}
export interface TransactionProposalKey {
@@ -211,9 +213,9 @@ export interface TransactionProposalKey {
sequenceNum?: number
}
export interface Transaction {
- cadence: string | null;
- refBlock: string | null;
- computeLimit: string | null;
+ cadence: string | null
+ refBlock: string | null
+ computeLimit: string | null
arguments: VoucherArgument[]
proposalKey: TransactionProposalKey
payer: string
@@ -223,9 +225,9 @@ export interface Transaction {
}
export interface Voucher {
- cadence: string;
- refBlock: string;
- computeLimit: number;
+ cadence: string
+ refBlock: string
+ computeLimit: number
arguments: VoucherArgument[]
proposalKey: VoucherProposalKey
payer: string
@@ -235,8 +237,8 @@ export interface Voucher {
}
interface PayloadField {
- name: string,
- check: (v: any) => boolean,
+ name: string
+ check: (v: any) => boolean
defaultVal?: string
}
@@ -256,7 +258,9 @@ const proposalKeyFields: PayloadField[] = [
{name: "sequenceNum", check: isNumber},
]
-const payloadSigsFields: PayloadField[] = [{name: "payloadSigs", check: isArray}]
+const payloadSigsFields: PayloadField[] = [
+ {name: "payloadSigs", check: isArray},
+]
const payloadSigFields: PayloadField[] = [
{name: "address", check: isString},
@@ -264,7 +268,9 @@ const payloadSigFields: PayloadField[] = [
{name: "sig", check: isString},
]
-const envelopeSigsFields: PayloadField[] = [{ name: "envelopeSigs", check: isArray }]
+const envelopeSigsFields: PayloadField[] = [
+ {name: "envelopeSigs", check: isArray},
+]
const envelopeSigFields: PayloadField[] = [
{name: "address", check: isString},
diff --git a/packages/sdk/src/resolve/__tests__/resolve-accounts.test.js b/packages/sdk/src/resolve/__tests__/resolve-accounts.test.js
index 1cf452395..53968c9cb 100644
--- a/packages/sdk/src/resolve/__tests__/resolve-accounts.test.js
+++ b/packages/sdk/src/resolve/__tests__/resolve-accounts.test.js
@@ -230,18 +230,19 @@ test.skip("Deep resolve usecase - excess resolves throw an eror", async () => {
)
// expect(...).toThrow doesn't work in this case
let error
- try{
+ try {
await TestUtils.run([
sdk.transaction`CODE`,
sdk.proposer(authz),
sdk.payer(authz),
sdk.authorizations([authz]),
])
- } catch (e){
+ } catch (e) {
error = e
-
}
- expect(error).toMatchInlineSnapshot("[Error: recurseResolveAccount Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.]")
+ expect(error).toMatchInlineSnapshot(
+ "[Error: recurseResolveAccount Error: Depth limit (5) reached. Ensure your authorization functions resolve to an account after 5 resolves.]"
+ )
}
)
})
diff --git a/packages/sdk/src/resolve/resolve-accounts.test.js b/packages/sdk/src/resolve/resolve-accounts.test.js
index 0f4017874..2449a3b00 100644
--- a/packages/sdk/src/resolve/resolve-accounts.test.js
+++ b/packages/sdk/src/resolve/resolve-accounts.test.js
@@ -234,9 +234,7 @@ test("mulitple payer scenario (One from dev and one from pre-authz)", async () =
proposalKey: {address: "0x72f6325947f76d3a", keyId: 1, sequenceNum: 12},
payer: "0x01",
authorizers: ["0x72f6325947f76d3a"],
- payloadSigs: [
- {address: "0x72f6325947f76d3a", keyId: 1, sig: "1"},
- ],
+ payloadSigs: [{address: "0x72f6325947f76d3a", keyId: 1, sig: "1"}],
envelopeSigs: [{address: "0x01", keyId: 1, sig: "123"}],
})
})
@@ -312,9 +310,7 @@ test("mulitple payer scenario (One from dev and one from pre-authz) as array", a
proposalKey: {address: "0x02", keyId: 1, sequenceNum: 12},
payer: "0x01",
authorizers: ["0x02"],
- payloadSigs: [
- {address: "0x02", keyId: 1, sig: "1"},
- ],
+ payloadSigs: [{address: "0x02", keyId: 1, sig: "1"}],
envelopeSigs: [
{address: "0x01", keyId: 1, sig: "123"},
{address: "0x01", keyId: 2, sig: "456"},
@@ -380,9 +376,7 @@ test("payer from pre-authz", async () => {
proposalKey: {address: "0x72f6325947f76d3a", keyId: 1, sequenceNum: 12},
payer: "0xf086a545ce3c552d",
authorizers: ["0x72f6325947f76d3a"],
- payloadSigs: [
- {address: "0x72f6325947f76d3a", keyId: 1, sig: "1"},
- ],
+ payloadSigs: [{address: "0x72f6325947f76d3a", keyId: 1, sig: "1"}],
envelopeSigs: [{address: "0xf086a545ce3c552d", keyId: 12, sig: "2"}],
})
})
diff --git a/packages/sdk/src/resolve/resolve-accounts.ts b/packages/sdk/src/resolve/resolve-accounts.ts
index 1617bbdcd..8c7ebf183 100644
--- a/packages/sdk/src/resolve/resolve-accounts.ts
+++ b/packages/sdk/src/resolve/resolve-accounts.ts
@@ -2,13 +2,14 @@ import {sansPrefix, withPrefix} from "@onflow/util-address"
import {invariant} from "@onflow/util-invariant"
import {log} from "@onflow/util-logger"
import {isTransaction} from "../interaction/interaction"
-import { Interaction, InteractionAccount } from "@onflow/typedefs";
+import {Interaction, InteractionAccount} from "@onflow/typedefs"
import {createSignableVoucher} from "./voucher"
import {v4 as uuidv4} from "uuid"
const MAX_DEPTH_LIMIT = 5
-const idof = (acct: InteractionAccount) => `${withPrefix(acct.addr)}-${acct.keyId}`
+const idof = (acct: InteractionAccount) =>
+ `${withPrefix(acct.addr)}-${acct.keyId}`
const isFn = (v: any): v is Function =>
v &&
(Object.prototype.toString.call(v) === "[object Function]" ||
@@ -28,7 +29,7 @@ function debug() {
const SPACE_COUNT_PER_INDENT = 4
const DEBUG_MESSAGE: string[] = []
return [
- function (msg = '', indent = 0) {
+ function (msg = "", indent = 0) {
DEBUG_MESSAGE.push(
Array(indent * SPACE_COUNT_PER_INDENT)
.fill(SPACE)
@@ -50,7 +51,10 @@ function recurseFlatMap(el: T, depthLimit = 3) {
)
}
-export function buildPreSignable(acct: Partial, ix: Interaction) {
+export function buildPreSignable(
+ acct: Partial,
+ ix: Interaction
+) {
try {
return {
f_type: "PreSignable",
@@ -68,16 +72,20 @@ export function buildPreSignable(acct: Partial, ix: Interact
}
}
-async function removeUnusedIxAccounts(ix: Interaction, opts: Record) {
+async function removeUnusedIxAccounts(
+ ix: Interaction,
+ opts: Record
+) {
const payerTempIds = Array.isArray(ix.payer) ? ix.payer : [ix.payer]
const authorizersTempIds = Array.isArray(ix.authorizations)
? ix.authorizations
: [ix.authorizations]
- const proposerTempIds = ix.proposer === null
- ? []
- : Array.isArray(ix.proposer)
- ? ix.proposer
- : [ix.proposer]
+ const proposerTempIds =
+ ix.proposer === null
+ ? []
+ : Array.isArray(ix.proposer)
+ ? ix.proposer
+ : [ix.proposer]
const ixAccountKeys = Object.keys(ix.accounts)
const uniqueTempIds = [
@@ -181,8 +189,9 @@ async function recurseResolveAccount(
let flatResolvedAccounts = recurseFlatMap(resolvedAccounts)
- flatResolvedAccounts = flatResolvedAccounts.map((flatResolvedAccount: InteractionAccount) =>
- addAccountToIx(ix, flatResolvedAccount)
+ flatResolvedAccounts = flatResolvedAccounts.map(
+ (flatResolvedAccount: InteractionAccount) =>
+ addAccountToIx(ix, flatResolvedAccount)
)
account.resolve = flatResolvedAccounts.map(
@@ -192,14 +201,16 @@ async function recurseResolveAccount(
account = addAccountToIx(ix, account)
const recursedAccounts = await Promise.all(
- flatResolvedAccounts.map(async (resolvedAccount: InteractionAccount) => {
- return await recurseResolveAccount(
- ix,
- resolvedAccount.tempId,
- depthLimit - 1,
- {debugLogger}
- )
- })
+ flatResolvedAccounts.map(
+ async (resolvedAccount: InteractionAccount) => {
+ return await recurseResolveAccount(
+ ix,
+ resolvedAccount.tempId,
+ depthLimit - 1,
+ {debugLogger}
+ )
+ }
+ )
)
return recursedAccounts
@@ -224,7 +235,11 @@ const getAccountTempIDs = (rawTempIds: string | string[] | null) => {
return Array.isArray(rawTempIds) ? rawTempIds : [rawTempIds]
}
-async function resolveAccountType(ix: Interaction, type: ROLES, {debugLogger}: {debugLogger: (msg?: string, indent?: number) => void}) {
+async function resolveAccountType(
+ ix: Interaction,
+ type: ROLES,
+ {debugLogger}: {debugLogger: (msg?: string, indent?: number) => void}
+) {
invariant(
ix && typeof ix === "object",
"resolveAccountType Error: ix not defined"
@@ -286,9 +301,11 @@ async function resolveAccountType(ix: Interaction, type: ROLES, {debugLogger}: {
)
}
- ix[type] = (Array.isArray(ix[type])
- ? [...new Set(allResolvedAccounts.map(acct => acct.tempId))]
- : allResolvedAccounts[0].tempId) as string & string[]
+ ix[type] = (
+ Array.isArray(ix[type])
+ ? [...new Set(allResolvedAccounts.map(acct => acct.tempId))]
+ : allResolvedAccounts[0].tempId
+ ) as string & string[]
// Ensure all payers are of the same account
if (type === ROLES.PAYER) {
@@ -305,7 +322,10 @@ async function resolveAccountType(ix: Interaction, type: ROLES, {debugLogger}: {
}
}
-export async function resolveAccounts(ix: Interaction, opts: Record = {}) {
+export async function resolveAccounts(
+ ix: Interaction,
+ opts: Record = {}
+) {
if (isTransaction(ix)) {
if (!Array.isArray(ix.payer)) {
log.deprecate({
diff --git a/packages/sdk/src/resolve/resolve-compute-limit.test.js b/packages/sdk/src/resolve/resolve-compute-limit.test.js
index 286116132..74cde6d82 100644
--- a/packages/sdk/src/resolve/resolve-compute-limit.test.js
+++ b/packages/sdk/src/resolve/resolve-compute-limit.test.js
@@ -1,4 +1,8 @@
-import {initInteraction, pipe, makeTransaction} from "../interaction/interaction"
+import {
+ initInteraction,
+ pipe,
+ makeTransaction,
+} from "../interaction/interaction"
import {config} from "@onflow/config"
import {resolveComputeLimit} from "./resolve-compute-limit.js"
diff --git a/packages/sdk/src/resolve/resolve-signatures.ts b/packages/sdk/src/resolve/resolve-signatures.ts
index 70c2464af..43f674f47 100644
--- a/packages/sdk/src/resolve/resolve-signatures.ts
+++ b/packages/sdk/src/resolve/resolve-signatures.ts
@@ -1,5 +1,5 @@
import {isTransaction} from "../interaction/interaction"
-import { Interaction, InteractionAccount } from "@onflow/typedefs";
+import {Interaction, InteractionAccount} from "@onflow/typedefs"
import {sansPrefix} from "@onflow/util-address"
import {
Transaction,
@@ -18,7 +18,7 @@ export async function resolveSignatures(ix: Interaction) {
try {
let insideSigners = findInsideSigners(ix)
const insidePayload = encodeInsideMessage(prepForEncoding(ix))
-
+
// Promise.all could potentially break the flow if there are multiple inside signers trying to resolve at the same time
// causing multiple triggers of authz function that tries to render multiple auth iiframes/tabs/extensions
// as an alternative, use this:
@@ -31,9 +31,9 @@ export async function resolveSignatures(ix: Interaction) {
const outsidePayload = encodeOutsideMessage({
...prepForEncoding(ix),
payloadSigs: insideSigners.map(id => ({
- address: ix.accounts[id].addr || '',
+ address: ix.accounts[id].addr || "",
keyId: ix.accounts[id].keyId || 0,
- sig: ix.accounts[id].signature || '',
+ sig: ix.accounts[id].signature || "",
})),
})
@@ -63,7 +63,11 @@ function fetchSignature(ix: Interaction, payload: string) {
}
}
-export function buildSignable(acct: InteractionAccount, message: string, ix: Interaction) {
+export function buildSignable(
+ acct: InteractionAccount,
+ message: string,
+ ix: Interaction
+) {
try {
return {
f_type: "Signable",
@@ -89,12 +93,14 @@ function prepForEncoding(ix: Interaction): Transaction {
(Array.isArray(ix.payer) ? ix.accounts[ix.payer[0]] : ix.accounts[ix.payer])
.addr || ""
)
-
- const proposalKey: TransactionProposalKey = ix.proposer ? {
- address: sansPrefix(ix.accounts[ix.proposer].addr) || '',
- keyId: ix.accounts[ix.proposer].keyId || 0,
- sequenceNum: ix.accounts[ix.proposer].sequenceNum || 0,
- } : {}
+
+ const proposalKey: TransactionProposalKey = ix.proposer
+ ? {
+ address: sansPrefix(ix.accounts[ix.proposer].addr) || "",
+ keyId: ix.accounts[ix.proposer].keyId || 0,
+ sequenceNum: ix.accounts[ix.proposer].sequenceNum || 0,
+ }
+ : {}
return {
cadence: ix.message.cadence,
@@ -104,7 +110,7 @@ function prepForEncoding(ix: Interaction): Transaction {
proposalKey,
payer: payerAddress,
authorizers: ix.authorizations
- .map(cid => sansPrefix(ix.accounts[cid].addr) || '')
+ .map(cid => sansPrefix(ix.accounts[cid].addr) || "")
.reduce((prev: string[], current) => {
return prev.find(item => item === current) ? prev : [...prev, current]
}, []),
diff --git a/packages/sdk/src/resolve/voucher.ts b/packages/sdk/src/resolve/voucher.ts
index 02fd1a329..f5cff68f5 100644
--- a/packages/sdk/src/resolve/voucher.ts
+++ b/packages/sdk/src/resolve/voucher.ts
@@ -1,6 +1,6 @@
import {withPrefix} from "@onflow/util-address"
import {Voucher, encodeTxIdFromVoucher} from "../encode/encode"
-import { Interaction } from "@onflow/typedefs"
+import {Interaction} from "@onflow/typedefs"
export function findInsideSigners(ix: Interaction) {
// Inside Signers Are: (authorizers + proposer) - payer
@@ -46,11 +46,13 @@ export const createSignableVoucher = (ix: Interaction) => {
sig: ix.accounts[id].signature,
}))
- const proposalKey = ix.proposer ? {
- address: withPrefix(ix.accounts[ix.proposer].addr),
- keyId: ix.accounts[ix.proposer].keyId,
- sequenceNum: ix.accounts[ix.proposer].sequenceNum,
- } : {}
+ const proposalKey = ix.proposer
+ ? {
+ address: withPrefix(ix.accounts[ix.proposer].addr),
+ keyId: ix.accounts[ix.proposer].keyId,
+ sequenceNum: ix.accounts[ix.proposer].sequenceNum,
+ }
+ : {}
return {
cadence: ix.message.cadence,
diff --git a/packages/sdk/src/response/response.ts b/packages/sdk/src/response/response.ts
index 4dc062959..feed56a9d 100644
--- a/packages/sdk/src/response/response.ts
+++ b/packages/sdk/src/response/response.ts
@@ -1,19 +1,19 @@
const DEFAULT_RESPONSE = {
- "tag":null,
- "transaction":null,
- "transactionStatus":null,
- "transactionId":null,
- "encodedData":null,
- "events":null,
- "account":null,
- "block":null,
- "blockHeader":null,
- "latestBlock":null,
- "collection":null,
- "networkParameters":null,
- "streamConnection":null,
- "heartbeat":null,
- "nodeVersionInfo": null,
+ tag: null,
+ transaction: null,
+ transactionStatus: null,
+ transactionId: null,
+ encodedData: null,
+ events: null,
+ account: null,
+ block: null,
+ blockHeader: null,
+ latestBlock: null,
+ collection: null,
+ networkParameters: null,
+ streamConnection: null,
+ heartbeat: null,
+ nodeVersionInfo: null,
}
export const response = () => ({...DEFAULT_RESPONSE})
diff --git a/packages/sdk/src/test-utils/authz-fn.ts b/packages/sdk/src/test-utils/authz-fn.ts
index dce507949..48d935ed8 100644
--- a/packages/sdk/src/test-utils/authz-fn.ts
+++ b/packages/sdk/src/test-utils/authz-fn.ts
@@ -1,7 +1,8 @@
-import { InteractionAccount } from "@onflow/typedefs"
+import {InteractionAccount} from "@onflow/typedefs"
import {withPrefix} from "@onflow/util-address"
-export const idof = (acct: InteractionAccount) => `${withPrefix(acct.addr)}-${acct.keyId}`
+export const idof = (acct: InteractionAccount) =>
+ `${withPrefix(acct.addr)}-${acct.keyId}`
export function sig(opts: Partial) {
return ["SIGNATURE", opts.addr, opts.keyId].join(".")
@@ -60,7 +61,9 @@ interface IAuthzResolveMany {
payer?: any
}
-export function authzResolveMany(opts: IAuthzResolveMany = {authorizations: []}) {
+export function authzResolveMany(
+ opts: IAuthzResolveMany = {authorizations: []}
+) {
return function (account: InteractionAccount): InteractionAccount {
const tempId = opts.tempId || "AUTHZ_RESOLVE_MANY"
return {
@@ -79,7 +82,10 @@ export function authzResolveMany(opts: IAuthzResolveMany = {authorizations: []})
}
}
-export function authzDeepResolveMany(opts: IAuthzResolveMany = {authorizations: []}, depth = 1) {
+export function authzDeepResolveMany(
+ opts: IAuthzResolveMany = {authorizations: []},
+ depth = 1
+) {
return function (account: InteractionAccount): InteractionAccount {
const tempId = opts.tempId || "AUTHZ_DEEP_RESOLVE_MANY"
return {
@@ -88,7 +94,7 @@ export function authzDeepResolveMany(opts: IAuthzResolveMany = {authorizations:
resolve:
depth > 0
? authzDeepResolveMany(opts, depth - 1)(account).resolve
- : authzResolveMany(opts)(account).resolve
+ : authzResolveMany(opts)(account).resolve,
}
}
}
diff --git a/packages/transport-grpc/.babelrc b/packages/transport-grpc/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/transport-grpc/.babelrc
+++ b/packages/transport-grpc/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/transport-grpc/src/sdk-send-grpc.js b/packages/transport-grpc/src/sdk-send-grpc.js
index 0671936ce..b6d2deb0c 100644
--- a/packages/transport-grpc/src/sdk-send-grpc.js
+++ b/packages/transport-grpc/src/sdk-send-grpc.js
@@ -5,7 +5,8 @@ import * as logger from "@onflow/util-logger"
logger.log.deprecate({
pkg: "transport-grpc",
msg: `@onflow/transport-grpc is deprecated, please use @onflow/transport-http instead or simply remove the \`sdk.transport\` config option within the FCL/JS-SDK.`,
- transition: "https://github.com/onflow/fcl-js/tree/master/packages/transport-grpc/README.md"
+ transition:
+ "https://github.com/onflow/fcl-js/tree/master/packages/transport-grpc/README.md",
})
export {sendGetBlockHeader} from "./send-get-block-header.js"
@@ -18,4 +19,4 @@ export {sendPing} from "./send-ping.js"
export {sendTransaction} from "./send-transaction.js"
export {sendGetNetworkParameters} from "./send-get-network-parameters.js"
export {sendGetNodeVersionInfo} from "./send-get-node-version-info.js"
-export {send} from "./send-grpc.js"
\ No newline at end of file
+export {send} from "./send-grpc.js"
diff --git a/packages/transport-grpc/src/send-get-block.js b/packages/transport-grpc/src/send-get-block.js
index 2f67f1642..6e34ba205 100644
--- a/packages/transport-grpc/src/send-get-block.js
+++ b/packages/transport-grpc/src/send-get-block.js
@@ -58,10 +58,7 @@ function constructResponse(ix, context, res) {
id: u8ToHex(block.getId_asU8(), context),
parentId: u8ToHex(block.getParentId_asU8(), context),
height: block.getHeight(),
- timestamp: block
- .getTimestamp()
- .toDate()
- .toISOString(),
+ timestamp: block.getTimestamp().toDate().toISOString(),
collectionGuarantees: collectionGuarantees.map(collectionGuarantee => ({
collectionId: u8ToHex(
collectionGuarantee.getCollectionId_asU8(),
diff --git a/packages/transport-grpc/src/send-transaction.js b/packages/transport-grpc/src/send-transaction.js
index b5b2d2e57..242222dcf 100644
--- a/packages/transport-grpc/src/send-transaction.js
+++ b/packages/transport-grpc/src/send-transaction.js
@@ -72,11 +72,16 @@ export async function sendTransaction(ix, context = {}, opts = {}) {
sig.setKeyId(acct.keyId)
sig.setSignature(hexBuffer(acct.signature, context))
- const isSignatureExist = tx.getPayloadSignaturesList().some(
- existingSignature => existingSignature.getAddress().toString() === sig.getAddress().toString()
- && existingSignature.getKeyId() === sig.getKeyId()
- && existingSignature.getSignature().toString() === sig.getSignature().toString()
- )
+ const isSignatureExist = tx
+ .getPayloadSignaturesList()
+ .some(
+ existingSignature =>
+ existingSignature.getAddress().toString() ===
+ sig.getAddress().toString() &&
+ existingSignature.getKeyId() === sig.getKeyId() &&
+ existingSignature.getSignature().toString() ===
+ sig.getSignature().toString()
+ )
if (!isSignatureExist) {
tx.addPayloadSignatures(sig)
}
diff --git a/packages/transport-grpc/src/send-transaction.test.js b/packages/transport-grpc/src/send-transaction.test.js
index 33b862347..14820d210 100644
--- a/packages/transport-grpc/src/send-transaction.test.js
+++ b/packages/transport-grpc/src/send-transaction.test.js
@@ -218,6 +218,8 @@ describe("Transaction", () => {
expect(response.transactionId).toBe(returnedTransactionId)
- expect(unaryMockRequest.getTransaction().getPayloadSignaturesList()).toHaveLength(1)
+ expect(
+ unaryMockRequest.getTransaction().getPayloadSignaturesList()
+ ).toHaveLength(1)
})
})
diff --git a/packages/transport-grpc/tsconfig.json b/packages/transport-grpc/tsconfig.json
index 88be905eb..ac6917898 100644
--- a/packages/transport-grpc/tsconfig.json
+++ b/packages/transport-grpc/tsconfig.json
@@ -6,6 +6,6 @@
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
- "outDir": "types",
+ "outDir": "types"
}
-}
\ No newline at end of file
+}
diff --git a/packages/transport-http/src/connect-subscribe-events.ts b/packages/transport-http/src/connect-subscribe-events.ts
index a602ce487..d72417afb 100644
--- a/packages/transport-http/src/connect-subscribe-events.ts
+++ b/packages/transport-http/src/connect-subscribe-events.ts
@@ -29,7 +29,7 @@ function constructData(ix: Interaction, context: any, data: any) {
),
}))
: null
- response.heartbeat = {
+ response.heartbeat = {
blockId: data.BlockID,
blockHeight: Number(data.Height),
blockTimestamp: data.Timestamp,
diff --git a/packages/transport-http/src/send-ping.ts b/packages/transport-http/src/send-ping.ts
index 378e1c8eb..7b810b380 100644
--- a/packages/transport-http/src/send-ping.ts
+++ b/packages/transport-http/src/send-ping.ts
@@ -1,19 +1,25 @@
import {invariant} from "@onflow/util-invariant"
import {httpRequest as defaultHttpRequest} from "./http-request.js"
-import { Interaction } from "@onflow/typedefs";
+import {Interaction} from "@onflow/typedefs"
export interface ISendPingContext {
- response?: Function;
+ response?: Function
}
interface ISendPingOpts {
node?: string
- httpRequest?: any,
-
+ httpRequest?: any
}
-export async function sendPing(ix: Interaction, context: ISendPingContext = {}, opts: ISendPingOpts = {}) {
- invariant(Boolean(opts.node), `SDK Send Ping Error: opts.node must be defined.`)
+export async function sendPing(
+ ix: Interaction,
+ context: ISendPingContext = {},
+ opts: ISendPingOpts = {}
+) {
+ invariant(
+ Boolean(opts.node),
+ `SDK Send Ping Error: opts.node must be defined.`
+ )
invariant(
Boolean(context.response),
`SDK Send Ping Error: context.response must be defined.`
@@ -28,7 +34,7 @@ export async function sendPing(ix: Interaction, context: ISendPingContext = {},
body: null,
})
- let ret = typeof context?.response === 'function' ? context.response() : {}
+ let ret = typeof context?.response === "function" ? context.response() : {}
ret.tag = ix.tag
return ret
diff --git a/packages/transport-http/src/send-transaction.js b/packages/transport-http/src/send-transaction.js
index 0286cfa33..a314171fc 100644
--- a/packages/transport-http/src/send-transaction.js
+++ b/packages/transport-http/src/send-transaction.js
@@ -31,10 +31,14 @@ export async function sendTransaction(ix, context = {}, opts = {}) {
"base64"
),
}
- if (!payloadSignatures.find(existingSignature => existingSignature.address === signature.address
- && existingSignature.key_index === signature.key_index
- && existingSignature.signature === signature.signature
- )) {
+ if (
+ !payloadSignatures.find(
+ existingSignature =>
+ existingSignature.address === signature.address &&
+ existingSignature.key_index === signature.key_index &&
+ existingSignature.signature === signature.signature
+ )
+ ) {
payloadSignatures.push(signature)
}
}
diff --git a/packages/typedefs/.babelrc b/packages/typedefs/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/typedefs/.babelrc
+++ b/packages/typedefs/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/typedefs/.eslintrc.json b/packages/typedefs/.eslintrc.json
index b5e57f0a6..ff11666ab 100644
--- a/packages/typedefs/.eslintrc.json
+++ b/packages/typedefs/.eslintrc.json
@@ -5,12 +5,8 @@
"jest": true,
"node": true
},
- "extends": [
- "plugin:jsdoc/recommended"
- ],
- "plugins": [
- "jsdoc"
- ],
+ "extends": ["plugin:jsdoc/recommended"],
+ "plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
@@ -24,4 +20,4 @@
}
]
}
-}
\ No newline at end of file
+}
diff --git a/packages/typedefs/src/interaction.ts b/packages/typedefs/src/interaction.ts
index 259da6094..8551e8cd2 100644
--- a/packages/typedefs/src/interaction.ts
+++ b/packages/typedefs/src/interaction.ts
@@ -89,7 +89,7 @@ export interface Interaction {
}
collection: {
id: string | null
- },
+ }
subscribeEvents: {
eventTypes: string[] | null
addresses: string[] | null
diff --git a/packages/types/src/types.test.ts b/packages/types/src/types.test.ts
index 0d30ec9ee..2dc17a6fe 100644
--- a/packages/types/src/types.test.ts
+++ b/packages/types/src/types.test.ts
@@ -257,7 +257,7 @@ function registerTest([
X,
t.JsonCdc,
X,
- boolean?
+ boolean?,
]) {
describe(cast.label, () => {
test(`t.${cast.label}.asArgument(${input})`, () => {
diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts
index 8071e150b..9e4fa68e2 100644
--- a/packages/types/src/types.ts
+++ b/packages/types/src/types.ts
@@ -5,12 +5,8 @@ export type JsonCdc = {
value: T
}
-type JsonCdcLabel> = X extends JsonCdc<
- infer L,
- unknown
->
- ? L
- : never
+type JsonCdcLabel> =
+ X extends JsonCdc ? L : never
export interface TypeDescriptor> {
label: JsonCdcLabel
@@ -19,7 +15,7 @@ export interface TypeDescriptor> {
}
export type TypeDescriptorInput<
- X extends TypeDescriptor>
+ X extends TypeDescriptor>,
> = X extends TypeDescriptor> ? T : never
export interface PathValue {
@@ -715,7 +711,7 @@ export {_Array as Array}
export const Dictionary = <
K extends TypeDescriptor,
- V extends TypeDescriptor
+ V extends TypeDescriptor,
>(
children:
| {
@@ -747,18 +743,18 @@ export const Dictionary = <
value: c.value.asArgument(v[i].value),
}))
: vIsArray && !childrenIsArray
- ? v.map(x => ({
- key: children.key.asArgument(x.key),
- value: children.value.asArgument(x.value),
- }))
- : !vIsArray && !childrenIsArray
- ? [
- {
- key: children.key.asArgument(v.key),
- value: children.value.asArgument(v.value),
- },
- ]
- : throwTypeError("Invalid arguments for Dictionary."),
+ ? v.map(x => ({
+ key: children.key.asArgument(x.key),
+ value: children.value.asArgument(x.value),
+ }))
+ : !vIsArray && !childrenIsArray
+ ? [
+ {
+ key: children.key.asArgument(v.key),
+ value: children.value.asArgument(v.value),
+ },
+ ]
+ : throwTypeError("Invalid arguments for Dictionary."),
}
return throwTypeError("Expected Object for type Dictionary")
},
diff --git a/packages/util-actor/.babelrc b/packages/util-actor/.babelrc
index f57936a43..d766c90b2 100644
--- a/packages/util-actor/.babelrc
+++ b/packages/util-actor/.babelrc
@@ -1,8 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ],
- "@babel/preset-typescript"
- ]
+ "presets": [["@babel/preset-env"], "@babel/preset-typescript"]
}
diff --git a/packages/util-invariant/.babelrc b/packages/util-invariant/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/util-invariant/.babelrc
+++ b/packages/util-invariant/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}
diff --git a/packages/util-logger/src/util-logger.ts b/packages/util-logger/src/util-logger.ts
index d6c3e2552..329eb6c92 100644
--- a/packages/util-logger/src/util-logger.ts
+++ b/packages/util-logger/src/util-logger.ts
@@ -1,8 +1,8 @@
interface IConfig {
- get: (key: string) => T;
+ get: (key: string) => T
}
-type Config = IConfig & (() => IConfig) | null
+type Config = (IConfig & (() => IConfig)) | null
// Config dependency injected into logger to break circular dependency
let config: Config = null
@@ -67,7 +67,8 @@ export const log = async (options: {
always?: boolean
}) => {
const {title, message, level, always} = options
- const configLoggerLevel = (await config?.()?.get("logger.level")) ?? LEVELS.warn
+ const configLoggerLevel =
+ (await config?.()?.get("logger.level")) ?? LEVELS.warn
// If config level is below message level then don't show it
if (!always && configLoggerLevel < level) return
diff --git a/packages/util-semver/.babelrc b/packages/util-semver/.babelrc
index 67fc2886b..344d6d61c 100644
--- a/packages/util-semver/.babelrc
+++ b/packages/util-semver/.babelrc
@@ -1,7 +1,3 @@
{
- "presets": [
- [
- "@babel/preset-env"
- ]
- ]
+ "presets": [["@babel/preset-env"]]
}