Skip to content

Commit

Permalink
Address PR comments:
Browse files Browse the repository at this point in the history
 * create networkName to pass to SDK
 * Refac networkFromString too avoid redundancy
  • Loading branch information
taylorjdawson committed May 1, 2020
1 parent 5f3568d commit ee00380
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions dist/nft-card.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/nft-card.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/nft-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ export class NftCard extends LitElement {
// Get the web3 provider
this.provider = getProvider()

this.network = networkFromString(this.network)
this.seaport = new OpenSeaPort(this.provider, { networkName: this.network })
const networkName = networkFromString(this.network)
this.seaport = new OpenSeaPort(this.provider, { networkName })

try {
this.asset = await this.seaport.api.getAsset({
Expand Down
5 changes: 2 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ export const networkFromId = (id: string) => {

export const networkFromString = (name: string) => {
switch (name) {
case 'mainnet':
case 'main':
return Network.Main
case 'rinkeby':
return Network.Rinkeby
case 'mainnet':
case 'main':
default:
return Network.Main
}
Expand Down

0 comments on commit ee00380

Please sign in to comment.