Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKG - [sdk] Implement GetNetworkParameters #1420

Merged
merged 75 commits into from
Dec 6, 2022

Conversation

huyndo
Copy link
Contributor

@huyndo huyndo commented Sep 20, 2022

Close #304 and #1367

  • Implement builder and sender for GetNetworkParameters in sdk
  • Expose GetNetworkParameters for fcl
  • Add a translation from chainId from access node for backward compatibility
  • Add a util getChainId to get chainId from multiple sources. This is also run at startup.
  • Changes fcl to use this util instead of looking at config
  • Send chainId to wallets in execService and discovery
  • Add GetNetworkParameters in the resolver pipeline
  • Add opts to resolver to skip exec functions during testing

@huyndo huyndo self-assigned this Sep 20, 2022
@huyndo huyndo requested a review from a team as a code owner September 20, 2022 17:53
@changeset-bot
Copy link

changeset-bot bot commented Sep 20, 2022

🦋 Changeset detected

Latest commit: c41dc1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@onflow/fcl Minor
@onflow/sdk Minor
@onflow/transport-grpc Minor
@onflow/transport-http Minor
@onflow/fcl-wc Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

huyndo and others added 21 commits September 20, 2022 14:41
* DOC -- [fcl] Add Dapper Wallet to address list

* DOC - [fcl] Remove line

Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
…n services (#1352)

* PKG -- [fcl-wc] Create pkg, add WC deps

* PKG -- [fcl-wc] Add init, wc utils

* PKG -- [fcl-wc] Update wc beta, add fcl-bundle

* PKG -- [fcl-wc] Remove default WalletConnect projectId

* PKG -- [fcl-wc] Add README

* PKG -- [fcl-wc] Update to WalletConnect 2.0.0-beta.102

* PKG -- [fcl-wc] Update jest version

* PKG -- [fcl-js] Add wc-rpc strategy

* PKG -- [fcl-js] Add wc pairings to execService config

* PKG -- [fcl-js] Normalize data sent in client request

* PKG -- [fcl-js] Update request to switch on service.endpoint

* PKG -- [fcl-js] Add case for flow_user_sign endpoint

* PKG -- [fcl-js] Remove switch and set chainId

* PKG -- [fcl-js] Add fallback for config.get client

* PKG -- [fcl-wc] Create pkg, add WC deps

* PKG -- [fcl-wc] Add init, wc utils

* PKG -- [fcl-wc] Update wc beta, add fcl-bundle

* PKG -- [fcl-wc] Remove default WalletConnect projectId

* PKG -- [fcl-wc] Add README

* PKG -- [fcl-wc] Update to WalletConnect 2.0.0-beta.102

* PKG -- [fcl-wc] Update jest version

* PKG -- [fcl-wc] Update Walletconnect to 2.0.0-rc.0

* PKG -- [fcl] add default client on exec discovery config

* PKG -- [fcl-js] Add discoveryServices to execService, remove wc pairings

* PKG -- [fcl-wc] Add servicePlugin

* PKG -- [fcl-wc] Add servicePlugin

* PKG -- [fcl-wc] update service def and strategy

* PKG -- [fcl-wc] add fcl config and full service strategy

* PKG -- [fcl] update service strategy args to obj, remove client

* PKG -- [fcl] move config to authn, remove client.extensions

* PKG -- [fcl] add execStrategy and service registry

* PKG -- [fcl-wc] update service with qrcode modal, remove @onflow/config

* PKG -- [fcl] add WC/RPC back to core strategies

* PKG -- [fcl] add plugin registry and wire up in execService

* PKG -- [fcl] update plugin registry to new service format

* PKG -- [fcl-wc] update service name and combine definition with strategy

* PKG -- [fcl] remove wc-rpc, replaced with plugin strategy

* PKG -- [fcl-wc] update README

* PKG -- [fcl-wc] add better-sqlite3, update package-lock.json

* PKG -- [fcl-wc] add better-sqlite3 as dev dep

* PKG -- [fcl] update supported plugins and setServices method to remove dupe

* PKG -- [fcl-wc] update Service name and type

* PKG -- [fcl-wc] update init client test

* PKG -- [fcl-wc] update walletconnect deps to rc.0

* PKG -- [fcl-wc] update walletconnect to 2.0.0-rc.2

* PKG -- [root] update package-lock.json

* PKG -- [root] merge master and update package-lock.json

* PKG -- [fcl-wc] update pairing and service provider address to placeholder,

* PKG -- [fcl-wc] add network from config

* PKG -- [fcl-wc] add util-logger

* PKG -- [fcl] add plugin validation

* PKG -- [fcl] add client services to discovery api

* PKG -- [fcl] add logger to discovery authn

* PKG -- [fcl] update naming of discoveryServices to clientServices

* PKG -- [root] update changeset for fcl-wc

* PKG -- [fcl-wc] add provider.uid to service and use as pairing topic

* PKG -- [fcl] move makeDiscoveryServices to discovery utils

* PKG -- [fcl-wc] update servicePlugin fiel from services to discoveryServices

* PKG -- [fcl] add validation

* PKG -- [fcl-wc] add util-logger to service strategy

* PKG -- [fcl-wc] update isMobile util to include iPad

* PKG -- [fcl-wc] add f_type to service plugin

* PKG -- [fcl] add validation for ServicePlugin f_type

* PKG -- [fcl-wc] change pairing service provider.address to null

* PKG -- [fcl-wc] update console.logs to use logger

* PKG -- [fcl-wc] update version for alpha release
* Version Packages (alpha)

* Update to correct alpha version

* Update CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Greg Santos <greg.santos@dapperlabs.com>
Co-authored-by: Jordan Ribbink <jribbink@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* PKG -- [fcl] Respect service method for discovery

Addresses: #1374

* PKG -- [fcl] Add changeset

Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
this content is also defined in the onflow/developer-portal repo

https://github.com/onflow/developer-portal/blob/e0b9e225c252cb7ef8d8325a519e6f21f503d626/app/constants/doc-collections.server.ts#L1004

adding this file will allow sidebar entries to be managed in this repo,
instead

Remove newline
* PKG -- [fcl] TEMPLATES

* PKG -- [fcl] Adds Interaction Template Utils

* PKG -- [fcl] Allow mutate to consume a template

* PKG -- [sdk] Adds template resolver and builder

* PKG -- [fcl] Adds verify dependency pin interaction template util

* PKG -- [fcl] Allow template serialization to include argument balance

* PKG -- [sdk] Set template to null in voucher if not defined

* PKG -- [fcl] Hash all strings during serialization process

* PKG -- [fcl] Adds sha3 dependency

* Adds utility to generate network dependent cadence from a template

* Update resolver tests to support template in interaction object

* Adds functionality to resolve a document using an arbitrary protocol, using protocol resolvers as defined in config

* PKG -- [fcl] Release templates 1.1.1-templates.5

* PKG -- [fcl] Code cleanup

* PKG -- [sdk] Move document retriever to fcl

* PKG -- [fcl] Add changeset

* PKG -- [fcl] Adds data structure normalizers to interaction template utils

* PKG -- [fcl] Derive fcl config dependencies from InteractionTemplate in query mutate

* PKG -- [fcl] Run prettier

* PKG -- [fcl] Add changeset

* PKG -- [fcl] Update test

* PKG -- [fcl] Run Release

* PKG -- [fcl] Adds node-fetch dep

* PKG -- [fcl] Use correct f_version check for interaction template normalization

* PKG -- [fcl] Support on-chain interaction template audit system

* PKG -- [fcl] Verify template is audited returns a map of auditor to isAudited bool

* PKG -- [fcl] Verify template is audited returns a map of auditor to isAudited bool

* PKG -- [fcl] Support on-chain interaction template audit system (#1356)

* PKG -- [fcl] Support on-chain interaction template audit system

* PKG -- [fcl] Verify template is audited returns a map of auditor to isAudited bool

* PKG -- [fcl] Verify template is audited returns a map of auditor to isAudited bool

* PKG -- [fcl] Templates release

* DOC -- Adds Interaction Template documentation

* PKG -- [sdk] Remove template from voucher

* DOC -- Update interaction template doc

* DOC -- Update interaction template doc

* PKG -- [fcl] Misc cleanup

* PKG -- [fcl] Adds templates to query and mutate docs

* PKG -- [fcl] Updates template verification helper to use latest contract method

* PKG -- [fcl] Remove sdk template export from fcl

* PKG -- [sdk] Revert interaction.js to version on master branch

* PKG -- [fcl] Rename verifyInteractionTemplateIsAudited to getInteractionTemplateAudits

* DOC -- Update interaction template doc

* PKG -- [fcl] Update FCL Templates docs

* DOC -- Change interaction templates doc to mdx

* PKG -- [fcl] Add auditors to flow.auditors config variable

* PKG -- [fcl] Release templates.11

* PKG -- [fcl] Add support for finding imports from multiple contract import lines

* PKG -- [fcl] Update according to PR feedback

* PKG -- [fcl] Move normalizers to a common normalizers folder

* PKG -- [fcl] Update according to PR feedback

* PKG -- [fcl] Update according to PR feedback

* PKG -- [fcl] Throw document retriever specific error on failure case

* PKG -- [fcl] Move normalizers to a common normalizers folder

* PKG -- [fcl] Reset changeset to master

* PKG -- [fcl] Reset changeset to master

* PKG -- [fcl] Reset changeset to master

* PKG -- [fcl] Adds changeset

* PKG -- [fcl] Removes duplicated import

* PKG -- [fcl] Adds prep template util for mutate and query

* PKG -- [fcl] Adds pre util for query and mutate

* PKG -- [fcl-wc] Adds jest polyfill for TextEncoder

* PKG -- [fcl-wc] Adds jest polyfill for TextEncoder

* PKG -- [fcl] Add node-fetch dep
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This has been replaced with a bot.
* Add to docs on discovery.wallet.method

* Add EXT/RPC

* Add recommended

* Add recommended

Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
* DOC -- Query Interaction Template by cadence hash

* DOC -- Interaction Templates queryable by POST search

* DOC -- Use base64 cadence

* DOC -- Use base64 cadence

* DOC -- Use base64 cadence
…1396)

* PKG -- [fcl-wc] update service plugin discovery services spec, add service strategy

* PKG -- [fcl] update plugin to match service plugin spec, add required service strategy

* PKG -- [fcl-wc] add applink and get all pairings

* PKG -- [fcl-wc] update deeplink handling, and services added from base wc registry

* PKG -- [fcl] add getStrategies to registry, and send supportedStrategies to discovery ui/api

* PKG -- [fcl-wc] update service.uid on make service from flow wallets

* PKG -- [fcl-wc] update base wc service to optin based on flag, remove pairing services

* PKG -- [fcl] update discovery service validation

* PKG -- [fcl-wc] update initFclWC export/name to init

* PKG -- [fcl-wc] add sessionRequestHook, update pairing match to service.uid

* PKG -- [fcl] update fetching wallets from wc api

* PKG -- [fcl-wc] remove default metatdata

* PKG -- [fcl-wc] add and use setConfiguredNetwork, only allow injected wallets on testnet

* PKG -- [fcl] update to use logger levels
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* PKG -- [fcl] Adds interaction template message getter utils

* PKG -- [fcl] Adds changeset
packages/fcl/src/utils/getChainId.js Show resolved Hide resolved
packages/sdk/src/decode/decode.js Outdated Show resolved Hide resolved
packages/sdk/src/interaction/interaction.js Outdated Show resolved Hide resolved
Co-authored-by: Greg Santos <greg.santos@dapperlabs.com>
packages/sdk/src/sdk.test.js Outdated Show resolved Hide resolved
@@ -1,3 +1,6 @@
// mock send function so getChainId does not hit the chain at startup
config.put("sdk.transport", async ix => ix)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huyndo Can we confirm that this has no ability to affect config used in other tests?

If we need this for this FCL test file, we could use config.overload as a way to isolate the configuration change to a specific test(s):

eg:

config.overload({ "sdk.transport": ix => ix }, async () => {
   ... do test stuff...
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeffreyDoyle Welp turns out not adding to resolver pipeline means I can get rid of this too

packages/fcl-wc/src/fcl-wc.test.js Outdated Show resolved Hide resolved
describe("getChainId", () => {

it("getChainId assuming it's already in config", async () => {
config.put("flow.network.default", "testnet")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last config.put that we should change into a config.overload !

@huyndo huyndo merged commit c20bc34 into master Dec 6, 2022
@huyndo huyndo deleted the huyndo/get-network-parameters branch December 6, 2022 23:27
@github-actions github-actions bot mentioned this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement a GetNetworkParameters Interaction
7 participants