Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,6 @@ export type NetworkProtocolFamilyEnum = typeof NetworkProtocolFamilyEnum[keyof t
export const NetworkIdentifier = {
BaseSepolia: 'base-sepolia',
BaseMainnet: 'base-mainnet',
EthereumHolesky: 'ethereum-holesky',
EthereumHoodi: 'ethereum-hoodi',
EthereumSepolia: 'ethereum-sepolia',
EthereumMainnet: 'ethereum-mainnet',
Expand Down
8 changes: 4 additions & 4 deletions src/tests/address_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Decimal from "decimal.js";
import { randomUUID } from "crypto";

describe("Address", () => {
const newAddress = newAddressModel("", randomUUID(), Coinbase.networks.EthereumHolesky);
const newAddress = newAddressModel("", randomUUID(), Coinbase.networks.EthereumHoodi);

const address = new Address(newAddress.network_id, newAddress.address_id);

Expand Down Expand Up @@ -147,7 +147,7 @@ describe("Address", () => {
block_height: "12345",
asset: {
asset_id: "usdc",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 6,
},
},
Expand All @@ -157,7 +157,7 @@ describe("Address", () => {
block_height: "67890",
asset: {
asset_id: "usdc",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 6,
},
},
Expand Down Expand Up @@ -242,7 +242,7 @@ describe("Address", () => {
block_height: "67890",
asset: {
asset_id: "usdc",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 6,
},
},
Expand Down
18 changes: 9 additions & 9 deletions src/tests/external_address_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { StakingReward } from "../coinbase/staking_reward";
import { StakingBalance } from "../coinbase/staking_balance";

describe("ExternalAddress", () => {
const newAddress = newAddressModel("", randomUUID(), Coinbase.networks.EthereumHolesky);
const newAddress = newAddressModel("", randomUUID(), Coinbase.networks.EthereumHoodi);

const address = new ExternalAddress(newAddress.network_id, newAddress.address_id);
const STAKING_CONTEXT_MODEL: StakingContextModel = {
Expand All @@ -42,7 +42,7 @@ describe("ExternalAddress", () => {
amount: "128000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
contract_address: "0x",
},
Expand All @@ -51,7 +51,7 @@ describe("ExternalAddress", () => {
amount: "2000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
contract_address: "0x",
},
Expand All @@ -60,7 +60,7 @@ describe("ExternalAddress", () => {
amount: "1000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
contract_address: "0x",
},
Expand All @@ -69,7 +69,7 @@ describe("ExternalAddress", () => {
amount: "1000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
contract_address: "0x",
},
Expand All @@ -78,7 +78,7 @@ describe("ExternalAddress", () => {
};
const STAKING_OPERATION_MODEL: StakingOperationModel = {
id: randomUUID(),
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
address_id: "0x1234567890",
status: StakingOperationStatusEnum.Initialized,
transactions: [
Expand Down Expand Up @@ -654,15 +654,15 @@ describe("ExternalAddress", () => {
amount: "1000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
},
},
{
amount: "5000000",
asset: {
asset_id: "usdc",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 6,
},
},
Expand Down Expand Up @@ -714,7 +714,7 @@ describe("ExternalAddress", () => {
amount: "5000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
decimals: 18,
},
};
Expand Down
12 changes: 6 additions & 6 deletions src/tests/stake_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ describe("Validator", () => {
});
});

it("should return a list of validators for ethereum holesky and eth asset", async () => {
it("should return a list of validators for ethereum hoodi and eth asset", async () => {
Coinbase.apiClients.stake!.listValidators = mockReturnValue(VALID_ACTIVE_VALIDATOR_LIST);

const validators = await Validator.list(
Coinbase.networks.EthereumHolesky,
Coinbase.networks.EthereumHoodi,
Coinbase.assets.Eth,
ValidatorStatus.ACTIVE,
);

expect(Coinbase.apiClients.stake!.listValidators).toHaveBeenCalledWith(
Coinbase.networks.EthereumHolesky,
Coinbase.networks.EthereumHoodi,
Coinbase.assets.Eth,
ValidatorStatus.ACTIVE,
);
Expand All @@ -121,19 +121,19 @@ describe("Validator", () => {
expect(validators[2].getStatus()).toEqual(ValidatorStatus.ACTIVE);
});

it("should return a validator for ethereum holesky and eth asset", async () => {
it("should return a validator for ethereum hoodi and eth asset", async () => {
Coinbase.apiClients.stake!.getValidator = mockReturnValue(
mockEthereumValidator("100", ValidatorStatus.EXITING, "0x123"),
);

const validator = await Validator.fetch(
Coinbase.networks.EthereumHolesky,
Coinbase.networks.EthereumHoodi,
Coinbase.assets.Eth,
"0x123",
);

expect(Coinbase.apiClients.stake!.getValidator).toHaveBeenCalledWith(
Coinbase.networks.EthereumHolesky,
Coinbase.networks.EthereumHoodi,
Coinbase.assets.Eth,
"0x123",
);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/staking_historical_balance_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ExternalAddress } from "../coinbase/address/external_address";
describe("StakingBalance", () => {
const startTime = "2024-05-01T00:00:00Z";
const endTime = "2024-05-21T00:00:00Z";
const newAddress = newAddressModel("", "some-address-id", Coinbase.networks.EthereumHolesky);
const newAddress = newAddressModel("", "some-address-id", Coinbase.networks.EthereumHoodi);
const address = new ExternalAddress(newAddress.network_id, newAddress.address_id);
const asset = {
asset_id: Coinbase.assets.Eth,
Expand Down
14 changes: 7 additions & 7 deletions src/tests/staking_operation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("StakingOperation", () => {

it("should return a string representation with id, status, network_id, and address_id", () => {
const op = new StakingOperation(VALID_STAKING_OPERATION_MODEL);
const expectedString = `StakingOperation { id: some-id status: initialized network_id: ethereum-holesky address_id: some-address-id }`;
const expectedString = `StakingOperation { id: some-id status: initialized network_id: ethereum-hoodi address_id: some-address-id }`;
expect(op.toString()).toEqual(expectedString);
});

Expand Down Expand Up @@ -184,7 +184,7 @@ describe("StakingOperation", () => {
const stakingOperation = new StakingOperation(VALID_STAKING_OPERATION_MODEL);
expect(stakingOperation.getID()).toBe("some-id");
expect(stakingOperation.getStatus()).toBe(StakingOperationStatusEnum.Initialized);
expect(stakingOperation.getNetworkID()).toBe(Coinbase.networks.EthereumHolesky);
expect(stakingOperation.getNetworkID()).toBe(Coinbase.networks.EthereumHoodi);
expect(stakingOperation.isTerminalState()).toBe(false);
expect(stakingOperation.getTransactions().length).toBe(1);
expect(stakingOperation.getSignedVoluntaryExitMessages().length).toBe(0);
Expand All @@ -198,7 +198,7 @@ describe("StakingOperation", () => {
...VALID_STAKING_OPERATION_MODEL,
transactions: [
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload: "payload1",
Expand All @@ -207,7 +207,7 @@ describe("StakingOperation", () => {
status: TransactionStatusEnum.Pending,
},
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload: "payload2",
Expand All @@ -216,7 +216,7 @@ describe("StakingOperation", () => {
status: TransactionStatusEnum.Pending,
},
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload: "payload3",
Expand All @@ -240,7 +240,7 @@ describe("StakingOperation", () => {
// Step 3: Call reload and add two new transactions (payload4 and payload5)
op["model"].transactions.push(
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload: "payload4",
Expand All @@ -249,7 +249,7 @@ describe("StakingOperation", () => {
status: TransactionStatusEnum.Pending,
},
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload: "payload5",
Expand Down
2 changes: 1 addition & 1 deletion src/tests/staking_reward_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Decimal from "decimal.js";
describe("StakingReward", () => {
const startTime = "2024-05-01T00:00:00Z";
const endTime = "2024-05-21T00:00:00Z";
const newAddress = newAddressModel("", "some-address-id", Coinbase.networks.EthereumHolesky);
const newAddress = newAddressModel("", "some-address-id", Coinbase.networks.EthereumHoodi);
const address = new ExternalAddress(newAddress.network_id, newAddress.address_id);
const asset = Asset.fromModel({
asset_id: Coinbase.assets.Eth,
Expand Down
14 changes: 7 additions & 7 deletions src/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ export const VALID_TRANSFER_SPONSORED_SEND_MODEL: TransferModel = {

export const VALID_STAKING_OPERATION_MODEL: StakingOperationModel = {
id: "some-id",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
address_id: "some-address-id",
status: StakingOperationStatusEnum.Initialized,
transactions: [
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "dummy-from-address-id",
to_address_id: "dummy-to-address-id",
unsigned_payload:
Expand Down Expand Up @@ -559,12 +559,12 @@ export const VALID_FUND_OPERATION_MODEL: FundOperationModel = {
export function mockStakingOperation(status: StakingOperationStatusEnum): StakingOperationModel {
return {
id: "some-id",
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
address_id: "some-address-id",
status: status,
transactions: [
{
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
from_address_id: "0xdeadbeef",
unsigned_payload:
"7b2274797065223a22307832222c22636861696e4964223a2230783134613334222c226e6f6e63" +
Expand Down Expand Up @@ -652,7 +652,7 @@ export function mockEthereumValidator(
): Validator {
return {
validator_id: public_key,
network_id: "ethereum-holesky",
network_id: "ethereum-hoodi",
asset_id: "eth",
status: status,
details: {
Expand All @@ -670,14 +670,14 @@ export function mockEthereumValidator(
amount: "32000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
},
},
effective_balance: {
amount: "32000000000000000000",
asset: {
asset_id: Coinbase.assets.Eth,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
},
},
},
Expand Down
12 changes: 6 additions & 6 deletions src/tests/validator_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ describe("Validator", () => {
const mockModel: ValidatorModel = {
validator_id: "123",
status: APIValidatorStatus.Active,
network_id: Coinbase.networks.EthereumHolesky,
network_id: Coinbase.networks.EthereumHoodi,
asset_id: Coinbase.assets.Eth,
details: {
effective_balance: {
amount: "100",
asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth },
asset: { network_id: Coinbase.networks.EthereumHoodi, asset_id: Coinbase.assets.Eth },
},
balance: {
amount: "200",
asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth },
asset: { network_id: Coinbase.networks.EthereumHoodi, asset_id: Coinbase.assets.Eth },
},
exitEpoch: "epoch-1",
activationEpoch: "epoch-0",
Expand All @@ -46,7 +46,7 @@ describe("Validator", () => {
});

test("getNetworkId should return the correct network ID", () => {
expect(validator.getNetworkId()).toBe(Coinbase.networks.EthereumHolesky);
expect(validator.getNetworkId()).toBe(Coinbase.networks.EthereumHoodi);
});

test("getAssetId should return the correct asset ID", () => {
Expand Down Expand Up @@ -96,14 +96,14 @@ describe("Validator", () => {
test("getEffectiveBalance should return the correct effective balance", () => {
expect(validator.getEffectiveBalance()).toEqual({
amount: "100",
asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth },
asset: { network_id: Coinbase.networks.EthereumHoodi, asset_id: Coinbase.assets.Eth },
});
});

test("getBalance should return the correct balance", () => {
expect(validator.getBalance()).toEqual({
amount: "200",
asset: { network_id: Coinbase.networks.EthereumHolesky, asset_id: Coinbase.assets.Eth },
asset: { network_id: Coinbase.networks.EthereumHoodi, asset_id: Coinbase.assets.Eth },
});
});
});
Loading