coinbase / coinbase-sdk-nodejs

Other
74 stars 29 forks source link

fix sequence #167

Closed marchsu closed 2 months ago

marchsu commented 2 months ago

What changed? Why?

Tests

Result

StakingBalance { date: '2024-08-14T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.566622738 ETH' participantType: 'VALIDATOR' }
StakingBalance { date: '2024-08-13T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.564549466 ETH' participantType: 'VALIDATOR' }
StakingBalance { date: '2024-08-12T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.562466119 ETH' participantType: 'VALIDATOR' }
StakingBalance { date: '2024-08-11T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.560385432 ETH' participantType: 'VALIDATOR' }
StakingBalance { date: '2024-08-10T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.558446722 ETH' participantType: 'VALIDATOR' }
StakingBalance { date: '2024-08-09T00:00:00.000Z' address: '0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a' bondedStake: '32 ETH' unbondedBalance: '5.556376299 ETH' participantType: 'VALIDATOR' }

Static Method

async function main() {
    let now = new Date();
    let tenDaysAgo = new Date();
    tenDaysAgo.setDate(now.getDate() - 10);
    const coinbase = Coinbase.configureFromJson({ filePath: "", basePath: "" });

    let stakingBalances = await StakingBalance.list(
        "ethereum-mainnet", "eth",
        "0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a",
        tenDaysAgo.toISOString(), now.toISOString(),
    );

    // Loop through the historical staking balances and print each balance
    stakingBalances.forEach(stakingBalance => console.log(stakingBalance));
}

main();

External Address Class

const coinbase = Coinbase.configureFromJson({ filePath: "", basePath: "" });

const addr = new ExternalAddress(Coinbase.networks.EthereumMainnet, "0x80000001677f23a227dfed6f61b132d114be83b8ad0aa5f3c5d1d77e6ee0bf5f73b0af750cc34e8f2dae73c21dc36f4a") 
addr.historicalStakingBalances(Coinbase.assets.Eth, "2024-07-01T00:00:00Z", "2024-07-05T00:00:00Z").then(balances => { balances.forEach(balance => {console.log(balance)}); } ).catch(error => { console.log(error); });

Qualified Impact

cb-heimdall commented 2 months ago

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1