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

Fix input params for nomad functions #1426

Merged
merged 1 commit into from
Jun 16, 2022
Merged

Conversation

wanglonghong
Copy link
Collaborator

@wanglonghong wanglonghong commented Jun 16, 2022

Description

Type of change

  • Docs change / dependency upgrade
  • Configuration / tooling changes
  • Refactoring
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires changes in customer code

High-level change(s) description - from the user's perspective

We need to convert a domainId from string to number because if its type is a string, it compares the domainId with the names like rinkeby, goerli, etc.

The data structure of nomad domains ===>

BridgeContext {
     domains: Map(5) {
       'goerli' => {
            name: 'goerli',
            domain: 3331,
            ...
       },
      'rinkeby'=>{
           name: 'rinkeby',
           domain: 1111,
           ...
      },
      'kovan'=>{
           name: 'kovan',
           domain: 2221,
           ...
      },
}

reference: @nomad-xyz/multi-provider/src/provider.ts :: resolveDomain()

  resolveDomain(nameOrDomain: string | number): number {
    let domain: Domain | undefined;
    if (typeof nameOrDomain === 'number') {
      domain = this.registeredDomains.find((d) => d?.domain === nameOrDomain);
    } else if (typeof nameOrDomain === 'string') {
      domain = this.registeredDomains.find(
        (d) => d?.name.toLowerCase() === nameOrDomain.toLowerCase(),
      );
    }

    if (!domain) throw new UnknownDomainError(this, nameOrDomain);

    return domain.domain;
  }

Related Issue(s)

Fixes

Related pull request(s)

@wanglonghong wanglonghong added the Bug Issue type: Bug label Jun 16, 2022
@wanglonghong wanglonghong changed the title Fix input params in use of nomad function Fix input params for nomad functions Jun 16, 2022
@wanglonghong wanglonghong merged commit 5176246 into main Jun 16, 2022
@wanglonghong wanglonghong deleted the hotfix-and-try-catch branch June 16, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issue type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant