-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8426b10
commit 78eade0
Showing
8 changed files
with
2,396 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { networks, Blockchains } from "../src/index"; | ||
|
||
describe("Blockchain Enums and Objects", () => { | ||
it("should have the correct values for Blockchains enum", () => { | ||
expect(Blockchains.STABILITY_TESTNET).toEqual("stabilitytestnet"); | ||
expect(Blockchains.STABILITY_GTN).toEqual("stabilitygtn"); | ||
}); | ||
|
||
it("should have correct network configurations for STABILITY_TESTNET", () => { | ||
const testnetConfig = networks[Blockchains.STABILITY_TESTNET]; | ||
expect(testnetConfig.id).toEqual(20180427); | ||
expect(testnetConfig.name).toEqual("Stability Testnet"); | ||
expect(testnetConfig.network).toEqual(Blockchains.STABILITY_TESTNET); | ||
expect(testnetConfig.nativeCurrency.decimals).toEqual(18); | ||
expect(testnetConfig.nativeCurrency.name).toEqual( | ||
"Decentralized Native Token" | ||
); | ||
expect(testnetConfig.nativeCurrency.symbol).toEqual("DNT"); | ||
expect(testnetConfig.rpcUrl).toEqual( | ||
"https://free.testnet.stabilityprotocol.com" | ||
); | ||
expect(testnetConfig.blockExplorer).toEqual( | ||
"https://stability-testnet.blockscout.com/" | ||
); | ||
expect(testnetConfig.contracts.multicall3.address).toEqual( | ||
"0x3ed62137c5DB927cb137c26455969116BF0c23Cb" | ||
); | ||
}); | ||
|
||
it("should have correct network configurations for STABILITY_GTN", () => { | ||
const gtnConfig = networks[Blockchains.STABILITY_GTN]; | ||
expect(gtnConfig.id).toEqual(101010); | ||
expect(gtnConfig.name).toEqual("Global Trust Network"); | ||
expect(gtnConfig.network).toEqual(Blockchains.STABILITY_GTN); | ||
expect(gtnConfig.nativeCurrency.decimals).toEqual(18); | ||
expect(gtnConfig.nativeCurrency.name).toEqual("Decentralized Native Token"); | ||
expect(gtnConfig.nativeCurrency.symbol).toEqual("DNT"); | ||
expect(gtnConfig.rpcUrl).toEqual("https://gtn.stabilityprotocol.com"); | ||
expect(gtnConfig.blockExplorer).toEqual( | ||
"https://stability-testnet.blockscout.com/" | ||
); | ||
expect(gtnConfig.contracts.multicall3.address).toEqual( | ||
"0xBA2923DAe45aD6b8B77bff4733c75b0C13F0ce2d" | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Config } from "@jest/types"; | ||
|
||
// Sync object | ||
const config: Config.InitialOptions = { | ||
verbose: true, | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest", | ||
}, | ||
extensionsToTreatAsEsm: [".ts"], | ||
testMatch: ["**/__tests__/**/*.test.ts"], | ||
testTimeout: 30000, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ethers } from "ethers"; | ||
import { networks } from "@stabilityprotocol/config"; | ||
import { | ||
StabilityGtnRpcProvider, | ||
StabilityTestnetRpcProvider, | ||
} from "../src/index"; | ||
|
||
describe("StabilityGtnRpcProvider", () => { | ||
it("correctly configures the provider instance for the Global Trust Network (STABILITY_GTN) with the correct RPC URL", () => { | ||
const apiKey = "dummyApiKey"; | ||
const provider = new StabilityGtnRpcProvider(apiKey); | ||
|
||
expect(provider.connection.url).toBe( | ||
`${networks.stabilitygtn.rpcUrl}/${apiKey}` | ||
); | ||
}); | ||
|
||
it("correctly configures the provider instance for the Stability Testnet (STABILITY_GTN) with the correct CHAIN ID", () => { | ||
const apiKey = "dummyApiKey"; | ||
const provider = new StabilityGtnRpcProvider(apiKey); | ||
|
||
expect(provider.network.chainId).toBe(networks.stabilitygtn.id); | ||
}); | ||
}); | ||
|
||
describe("StabilityTestnetRpcProvider", () => { | ||
it("correctly configures the provider instance for the Stability Testnet (STABILITY_TESTNET) with the correct RPC URL", () => { | ||
const provider = new StabilityTestnetRpcProvider(); | ||
|
||
expect(provider.connection.url).toBe(networks.stabilitytestnet.rpcUrl); | ||
}); | ||
|
||
it("correctly configures the provider instance for the Stability Testnet (STABILITY_TESTNET) with the correct CHAIN ID", () => { | ||
const provider = new StabilityTestnetRpcProvider(); | ||
|
||
expect(provider.network.chainId).toBe(networks.stabilitytestnet.id); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Config } from "@jest/types"; | ||
|
||
// Sync object | ||
const config: Config.InitialOptions = { | ||
verbose: true, | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest", | ||
}, | ||
extensionsToTreatAsEsm: [".ts"], | ||
testMatch: ["**/__tests__/**/*.test.ts"], | ||
testTimeout: 30000, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.