Skip to content

Commit

Permalink
Merge pull request #2 from Starkdefi/dev
Browse files Browse the repository at this point in the history
update starknetjs
  • Loading branch information
iddriss authored Nov 3, 2023
2 parents fe1c0bb + 8b6c3d2 commit 2eba13a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Binary file added bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "https://starkdefi.com"
},
"description": "SDK for building StarkDefi applications",
"version": "1.0.1",
"version": "1.2.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -49,7 +49,7 @@
"@types/big.js": "^6.1.6",
"big.js": "^6.2.1",
"decimal.js-light": "^2.5.1",
"starknet": "^5.14.1",
"starknet": "5.21.1",
"tiny-invariant": "^1.3.1",
"toformat": "^2.0.0"
},
Expand Down
14 changes: 11 additions & 3 deletions src/entities/ether.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import { constants } from 'starknet';
import { Ether } from './ether';

describe('Ether', () => {
// it('static constructor uses cache', () => {
// expect(
// Ether.onChain(constants.StarknetChainId.SN_MAIN) ===
// Ether.onChain(constants.StarknetChainId.SN_MAIN)
// ).toEqual(true);
// });
it('static constructor uses cache', () => {
const etherMain = Ether.onChain(constants.StarknetChainId.SN_MAIN);
expect(
Ether.onChain(constants.StarknetChainId.SN_MAIN) ===
Ether.onChain(constants.StarknetChainId.SN_MAIN)
Number.isNaN(etherMain)
? false
: etherMain === Ether.onChain(constants.StarknetChainId.SN_MAIN)
).toEqual(true);
});
it('caches once per chain ID', () => {
Expand All @@ -17,7 +25,7 @@ describe('Ether', () => {
it('#equals returns false for diff chains', () => {
expect(
Ether.onChain(constants.StarknetChainId.SN_MAIN).equals(
Ether.onChain(constants.StarknetChainId.SN_GOERLI2)
Ether.onChain(constants.StarknetChainId.SN_GOERLI)
)
).toEqual(false);
});
Expand Down
4 changes: 1 addition & 3 deletions src/entities/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ describe('Token', () => {
'0xhello00000000000000000000000000000000000000000000000000000000002',
18
).address
).toThrow(
'Cannot convert 0xhello00000000000000000000000000000000000000000000000000000000002 to a BigInt'
);
).toThrow();
});
it('fails with negative decimals', () => {
expect(
Expand Down
9 changes: 1 addition & 8 deletions src/entities/weth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { constants } from 'starknet';
import { Token } from './token';

/**
* Known StarkNet ETH implementation addresses
* Known Starknet ETH implementation addresses
*/
export const ETH: { [chainId: string]: Token } = {
[constants.StarknetChainId.SN_MAIN]: new Token(
Expand All @@ -19,11 +19,4 @@ export const ETH: { [chainId: string]: Token } = {
'ETH',
'Ether'
),
[constants.StarknetChainId.SN_GOERLI2]: new Token(
constants.StarknetChainId.SN_GOERLI2,
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
18,
'ETH',
'Ether'
),
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"include": ["src"],
"compilerOptions": {
"target": "es2018",
"target": "esnext",
"module": "esnext",
"importHelpers": true,
"declaration": true,
Expand Down

0 comments on commit 2eba13a

Please sign in to comment.