Have you ensured that all of these are up to date?
[X] opensea-js
[x] Node (minimum v16)
What version of opensea-js are you on?
newest
What function is the bug in?
4 different places i'll shot
Operating System
Linux
Describe the bug
Description
Variables, functions and types should always be used after they've been defined. This issue will flag any code snippets that use variables or types before definition.
Sometimes, the code will run just fine even when the variable is declared after use. Consider the following example:
const ram: Resource = { type: "memory", limit: 1024 ** 3 }
type Resource = {
type: string;
limit: number;
}
Here, Resource is used in the annotation before it has been defined. Similarly, it is possible to hoist function declarations and variables declared with the var keyword:
const four = twice(2);
function twice(n: number) {
return n * 2;
}
However, it makes the code harder to follow when variables or types are declared after being used.
Bad Practice
const knight: Radiant = {
order: "SurgeBinder"
strength: 30
}
Component
Utils
Have you ensured that all of these are up to date?
What version of opensea-js are you on?
newest
What function is the bug in?
4 different places i'll shot
Operating System
Linux
Describe the bug
Description
Variables, functions and types should always be used after they've been defined. This issue will flag any code snippets that use variables or types before definition.
Sometimes, the code will run just fine even when the variable is declared after use. Consider the following example:
const ram: Resource = { type: "memory", limit: 1024 ** 3 } type Resource = { type: string; limit: number; } Here, Resource is used in the annotation before it has been defined. Similarly, it is possible to hoist function declarations and variables declared with the var keyword:
const four = twice(2); function twice(n: number) { return n * 2; } However, it makes the code harder to follow when variables or types are declared after being used.
Bad Practice const knight: Radiant = { order: "SurgeBinder" strength: 30 }
interface Radiant { order: string; strength: number; }
Look for the bugs here: 'basisPointsForFee' was used before it was defined https://github.com/philipjonsen/opensea-js/blob/main/src/utils/utils.ts#L292-L292
paymentTokenFromJSON' was used before it was defined https://github.com/philipjonsen/opensea-js/blob/main/src/utils/utils.ts#L51-L51 'rarityFromJSON' was used before it was defined
https://github.com/philipjonsen/opensea-js/blob/main/src/utils/utils.ts#L51-L51
'feeFromJSON' was used before it was defined
https://github.com/philipjonsen/opensea-js/blob/main/src/utils/utils.ts#L50-L50