Skip to content

Commit

Permalink
Merge branch 'jribbink/update-protobuf-definitions' of github.com:onf…
Browse files Browse the repository at this point in the history
…low/fcl-js into jribbink/update-protobuf-definitions
  • Loading branch information
jribbink committed May 30, 2022
2 parents b35462a + 5b5763c commit 721dfd6
Show file tree
Hide file tree
Showing 138 changed files with 2,857 additions and 2,237 deletions.
3 changes: 1 addition & 2 deletions .changeset/empty-ants-switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
"@onflow/fcl": patch
---

- Fix events subcribe block height issue
- Add polling rate guide to docs
Fix events subcribe block height issue and add polling rate guide to docs.
5 changes: 5 additions & 0 deletions .changeset/friendly-berries-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/transport-http": patch
---

Fix issue where httpRequest errors were thrown inside a promise and could not be caught on node
5 changes: 5 additions & 0 deletions .changeset/grumpy-cats-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/sdk": patch
---

Allow for integer string account.keyId in authorization function
6 changes: 6 additions & 0 deletions .changeset/itchy-pumpkins-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@onflow/fcl": patch
---

Update event listeners in strategies
Fixes a bug where event listener was not being removed on close
30 changes: 30 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@onflow/config": "1.0.1",
"@onflow/fcl": "1.0.2",
"@onflow/protobuf": "1.0.0",
"@onflow/rlp": "1.0.1",
"@onflow/sdk": "1.0.1",
"@onflow/transport-grpc": "1.0.1",
"@onflow/transport-http": "1.2.0",
"@onflow/types": "1.0.1",
"@onflow/util-actor": "1.0.1",
"@onflow/util-address": "1.0.1",
"@onflow/util-encode-key": "1.0.1",
"@onflow/util-invariant": "1.0.1",
"@onflow/util-logger": "1.0.1",
"@onflow/util-node-http-modules": "1.0.2",
"@onflow/util-template": "1.0.1",
"@onflow/util-uid": "1.0.1"
},
"changesets": [
"empty-ants-switch",
"friendly-berries-admire",
"itchy-pumpkins-dream",
"short-colts-beg",
"smart-toys-joke",
"tall-zebras-tie"
]
}
5 changes: 5 additions & 0 deletions .changeset/short-colts-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/transport-http": minor
---

Added errorMessage property to HTTPRequestError to expose Access API errors when making requests
5 changes: 5 additions & 0 deletions .changeset/smart-toys-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/sdk": patch
---

Make deprecation notice for getEvents use @onflow/util-logger instead of console.warn
5 changes: 5 additions & 0 deletions .changeset/tall-zebras-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/sdk": patch
---

Fix issue where custom decoders did not properly override default decoders
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
README.md
*.md
*.mdx
packages/protobuf/src/generated/
6 changes: 3 additions & 3 deletions docs/reference/transactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Transactions let you send Cadence code to the Flow blockchain that permanently alters its state.

We are assuming you have read the [Scripts Documentation](../scripts) before this, as transactions are sort of scripts with more required things.
We are assuming you have read the [Scripts Documentation](https://docs.onflow.org/fcl/reference/scripts/) before this, as transactions are sort of scripts with more required things.

While `query` is used for sending scripts to the chain, `mutate` is used for building and sending transactions. Just like [scripts](../scripts), `fcl.mutate` is a [JavaScript Tagged Template Literal](https://styled-components.com/docs/advanced#tagged-template-literals) that we can pass Cadence code into.
While `query` is used for sending scripts to the chain, `mutate` is used for building and sending transactions. Just like [scripts](https://docs.onflow.org/fcl/reference/scripts/), `fcl.mutate` is a [JavaScript Tagged Template Literal](https://styled-components.com/docs/advanced#tagged-template-literals) that we can pass Cadence code into.

Unlike scripts, they require a little more information, things like a proposer, authorizations and a payer, which may be a little confusing and overwhelming.

Expand Down Expand Up @@ -74,4 +74,4 @@ const transaction = await fcl.tx(transactionId).onceSealed()
console.log(transaction) // The transactions status and events after being sealed
```

To learn more about `mutate`, check out the [API documentation](./api/#mutate).
To learn more about `mutate`, check out the [API documentation](./api/#mutate).
6 changes: 2 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
"projects": [
"<rootDir>/packages/*"
]
};
projects: ["<rootDir>/packages/*"],
}
54 changes: 47 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"dependencies": {
"@changesets/cli": "^2.21.1",
"@changesets/changelog-github": "^0.4.4"
},
"devDependencies": {
"prettier": "^2.6.2"
}
}
11 changes: 11 additions & 0 deletions packages/fcl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @onflow/fcl

## 1.0.3-alpha.0

### Patch Changes

- [#1177](https://github.com/onflow/fcl-js/pull/1177) [`e38f9fe4`](https://github.com/onflow/fcl-js/commit/e38f9fe4ba030693984ab74bffd5bca387ac9a09) Thanks [@hotrungnhan](https://github.com/hotrungnhan)! - Fix events subcribe block height issue and add polling rate guide to docs.

* [#1211](https://github.com/onflow/fcl-js/pull/1211) [`f4c6fb9a`](https://github.com/onflow/fcl-js/commit/f4c6fb9a05e8cf717afcd6a3b3b4c8b102f253e3) Thanks [@gregsantos](https://github.com/gregsantos)! - Update event listeners in strategies
Fixes a bug where event listener was not being removed on close
* Updated dependencies [[`1654ebbe`](https://github.com/onflow/fcl-js/commit/1654ebbe45ea5e4ca13536ed2139520ce21ee314), [`d1765950`](https://github.com/onflow/fcl-js/commit/d176595021681e660ae0a06161340833280091fb)]:
- @onflow/sdk@1.0.2-alpha.0

## 1.0.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/fcl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onflow/fcl",
"version": "1.0.2",
"version": "1.0.3-alpha.0",
"description": "Flow Client Library",
"license": "Apache-2.0",
"author": "Dapper Labs <[email protected]>",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@onflow/config": "^1.0.1",
"@onflow/interaction": "0.0.11",
"@onflow/rlp": "^1.0.1",
"@onflow/sdk": "^1.0.1",
"@onflow/sdk": "^1.0.2-alpha.0",
"@onflow/types": "^1.0.1",
"@onflow/util-actor": "^1.0.1",
"@onflow/util-address": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/fcl/src/config-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ export async function getDiscoveryService() {
type: "authn",
endpoint: discoveryWallet,
method: discoveryWalletMethod,
discoveryAuthnInclude
discoveryAuthnInclude,
}
}
31 changes: 15 additions & 16 deletions packages/fcl/src/current-user/exec-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,32 @@ export async function execService({service, msg = {}, opts = {}, config = {}}) {
}

try {
const res = await STRATEGIES[service.method](
service,
msg,
opts,
fullConfig
)
const res = await STRATEGIES[service.method](service, msg, opts, fullConfig)
if (res.status === "REDIRECT") {
invariant(
service.type === res.data.type,
"Cannot shift recursive service type in execService"
)
return await execService({
service: res.data,
msg,
opts,
config: fullConfig
service: res.data,
msg,
opts,
config: fullConfig,
})
} else {
return res
}
} catch (error) {
console.error("execService({service, msg = {}, opts = {}, config = {}})", error, {
service,
msg,
opts,
config
})
console.error(
"execService({service, msg = {}, opts = {}, config = {}})",
error,
{
service,
msg,
opts,
config,
}
)
throw error
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ export function extension(service, opts = {}) {
const onReady = opts.onReady || noop
const onResponse = opts.onResponse || noop

window.addEventListener(
"message",
buildMessageHandler({close, send, onReady, onResponse, onMessage})
)
const handler = buildMessageHandler({
close,
send,
onReady,
onResponse,
onMessage,
})
window.addEventListener("message", handler)

send({service})

return {send, close}

function close() {
try {
window.removeEventListener("message", buildMessageHandler)
window.removeEventListener("message", handler)
onClose()
} catch (error) {
console.error("Ext Close Error", error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export function fetchService(service, opts = {}) {
"Content-Type": "application/json",
},
body: body,
}).then((d) => d.json())
}).then(d => d.json())
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ export function frame(service, opts = {}) {
const onReady = opts.onReady || noop
const onResponse = opts.onResponse || noop

window.addEventListener(
"message",
buildMessageHandler({close, send, onReady, onResponse, onMessage})
)
const handler = buildMessageHandler({
close,
send,
onReady,
onResponse,
onMessage,
})
window.addEventListener("message", handler)

const [$frame, unmount] = renderFrame(serviceEndpoint(service))
return {send, close}

function close() {
try {
window.removeEventListener("message", buildMessageHandler)
window.removeEventListener("message", handler)
unmount()
onClose()
} catch (error) {
Expand Down
Loading

0 comments on commit 721dfd6

Please sign in to comment.