-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
13 changed files
with
214 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,64 @@ | ||
{ | ||
"name": "@effectai/effect-js", | ||
"version": "2.0.0", | ||
"description": "Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))", | ||
"main": "./dist/exports/index.js", | ||
"module": "./dist/exports/index.js", | ||
"browser": "dist/exports/index.js", | ||
"types": "./dist/exports/index.d.ts", | ||
"files": ["dist"], | ||
"scripts": { | ||
"test": "bun --env-file=.env test", | ||
"test:watch": "bun --env-file=.env test --watch", | ||
"test:coverage": "bun --env-file=.env test --coverage", | ||
"test:mainnet": "bun --env-file=.env.mainnet test", | ||
"dev": "tsc -w", | ||
"build": "tsc --module es2020", | ||
"lint": "bun biome lint --apply .", | ||
"format": "biome format --write .", | ||
"check": "bun biome check --apply .", | ||
"changeset": "changeset", | ||
"changeset:public": "bun scripts/updateVersion.ts && bun build && changeset publish", | ||
"changeset:version": "changeset version && bun install --frozen-lockfile && bun scripts/updateVersion.ts", | ||
"docs:dev": "cd docs && bun run dev", | ||
"docs:build": "cd docs && bun run build", | ||
"docs:preview": "cd docs && bun run preview" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/effectai/effect-js.git" | ||
}, | ||
"keywords": ["efx", "AI", "blockchain", "microtasks"], | ||
"author": { | ||
"name": "Effect-AI", | ||
"url": "https://effect.network", | ||
"email": "[email protected]" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/effectai/effect-js/issues" | ||
}, | ||
"homepage": "https://github.com/effectai/effect-js#readme", | ||
"devDependencies": { | ||
"@biomejs/biome": "1.7.0", | ||
"@changesets/changelog-github": "^0.4.5", | ||
"@changesets/cli": "^2.23.2", | ||
"@size-limit/preset-big-lib": "^11.1.2", | ||
"@greymass/abi2core": "^2.0.1", | ||
"typescript": "^5.4.3" | ||
}, | ||
"dependencies": { | ||
"@wharfkit/antelope": "^1.0.7", | ||
"@wharfkit/session": "^1.2.8", | ||
"@wharfkit/wallet-plugin-privatekey": "^1.0.0", | ||
"ajv": "^8.12.0", | ||
"atomicassets": "^1.5.1", | ||
"idb-keyval": "^6.2.1", | ||
"node-localstorage": "^3.0.5" | ||
}, | ||
"trustedDependencies": ["@biomejs/biome"] | ||
"name": "@effectai/effect-js", | ||
"version": "2.0.0", | ||
"description": "Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))", | ||
"main": "./dist/exports/index.js", | ||
"module": "./dist/exports/index.js", | ||
"browser": "dist/exports/index.js", | ||
"types": "./dist/exports/index.d.ts", | ||
"files": ["dist"], | ||
"scripts": { | ||
"test": "bun --env-file=.env test", | ||
"test:watch": "bun --env-file=.env test --watch", | ||
"test:coverage": "bun --env-file=.env test --coverage", | ||
"test:mainnet": "bun --env-file=.env.mainnet test", | ||
"dev": "tsc -w", | ||
"build": "tsc --module es2020", | ||
"lint": "bun biome lint --apply .", | ||
"format": "biome format --write .", | ||
"check": "bun biome check --apply .", | ||
"changeset": "changeset", | ||
"changeset:public": "bun scripts/updateVersion.ts && bun build && changeset publish", | ||
"changeset:version": "changeset version && bun install --frozen-lockfile && bun scripts/updateVersion.ts", | ||
"docs:dev": "cd docs && bun run dev", | ||
"docs:build": "cd docs && bun run build", | ||
"docs:preview": "cd docs && bun run preview" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/effectai/effect-js.git" | ||
}, | ||
"keywords": ["efx", "AI", "blockchain", "microtasks"], | ||
"author": { | ||
"name": "Effect-AI", | ||
"url": "https://effect.network", | ||
"email": "[email protected]" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/effectai/effect-js/issues" | ||
}, | ||
"homepage": "https://github.com/effectai/effect-js#readme", | ||
"devDependencies": { | ||
"@biomejs/biome": "1.7.0", | ||
"@changesets/changelog-github": "^0.4.5", | ||
"@changesets/cli": "^2.23.2", | ||
"@greymass/abi2core": "^2.0.1", | ||
"@size-limit/preset-big-lib": "^11.1.2", | ||
"@types/bun": "^1.1.1", | ||
"typescript": "^5.4.3" | ||
}, | ||
"dependencies": { | ||
"@wharfkit/antelope": "^1.0.7", | ||
"@wharfkit/session": "^1.2.8", | ||
"@wharfkit/wallet-plugin-privatekey": "^1.0.0", | ||
"ajv": "^8.12.0", | ||
"atomicassets": "^1.5.1", | ||
"idb-keyval": "^6.2.1", | ||
"node-localstorage": "^3.0.5" | ||
}, | ||
"trustedDependencies": ["@biomejs/biome"] | ||
} |
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
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,25 @@ | ||
import { describe, test, expect } from "bun:test"; | ||
import { getPrice } from "./getPrice"; | ||
import { getBalance } from "./getBalance"; | ||
import { swap, type SwapArgs } from "./swap"; | ||
import { createClient } from "../../client"; | ||
import { testClientSession } from "../../testHelper"; | ||
import { eos, jungle4 } from "../../exports"; | ||
import { Name } from "@wharfkit/antelope"; | ||
|
||
describe("getBalance", async () => { | ||
test("getBalance() should retrieve balance from user on mainnet", async () => { | ||
const client = createClient({ network: jungle4 }); | ||
const actor = Name.from("forcedev1234"); | ||
const balance = await getBalance({ client, actor }); | ||
expect(balance).toBeDefined(); | ||
expect(balance.toString()).toBeDefined(); | ||
expect(balance.toString()).toContain("EFX"); | ||
}); | ||
|
||
test("getBalance() should throw Error retrieving balance from unknown user.", async () => { | ||
const client = createClient({ network: eos }); | ||
const actor = Name.from("cryptonode99"); | ||
expect(async () => await getBalance({ client, actor })).toThrowError(); | ||
}); | ||
}); |
Empty file.
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,8 @@ | ||
describe("getPrice", async () => { | ||
test("getPrice() should retrieve price on mainnet", async () => { | ||
const client = createClient({ network: eos }); | ||
const price = await getPrice(); | ||
expect(price).toBeDefined(); | ||
expect(price).toBeNumber(); | ||
}); | ||
}); |
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,29 @@ | ||
describe("buildSwapAction", async () => { | ||
test.todo("buildSwapAction() should return a swap action object."); | ||
}); | ||
|
||
describe("Swap", async () => { | ||
// Use Mainnet | ||
|
||
test("swap() should throw an error when Session is not set on Client.", async () => { | ||
const swapArgs: SwapArgs = { | ||
client: createClient({ network: jungle4 }), | ||
amount: 1, | ||
direction: "UsdtToEfx", | ||
}; | ||
|
||
expect(async () => await swap(swapArgs)).toThrow( | ||
new Error("Error swapping: Error: Session is required for this method."), | ||
); | ||
}); | ||
|
||
test("swap() should fail when amount is 0", async () => { | ||
const swapArgs: SwapArgs = { | ||
client: await testClientSession({ testEnvNetwork: jungle4 }), | ||
amount: 0, | ||
direction: "UsdtToEfx", | ||
}; | ||
|
||
expect(async () => await swap(swapArgs)).toThrow(); | ||
}); | ||
}); |
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
Oops, something went wrong.