diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index 5a0a1b99..33f0d35e 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -40,23 +40,23 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - release: - name: Release - needs: verify - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: write - id-token: write + # release: + # name: Release + # needs: verify + # runs-on: ubuntu-latest + # timeout-minutes: 5 + # permissions: + # contents: write + # id-token: write - steps: - - name: Clone repository - uses: actions/checkout@v4 + # steps: + # - name: Clone repository + # uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v1 + # - uses: oven-sh/setup-bun@v1 - - name: Install dependencies - run: bun install --frozen-lockfile + # - name: Install dependencies + # run: bun install --frozen-lockfile # - name: Publish to NPM # uses: changesets/action@v1 diff --git a/package.json b/package.json index e2572cb1..97c8eee5 100644 --- a/package.json +++ b/package.json @@ -1,63 +1,63 @@ { - "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": "vitest run", - "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": "hello@effect.ai" - }, - "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/dotenv": "^8.2.0", - "dotenv": "^16.3.1", - "typescript": "^5.4.3", - "vitest": "^1.4.0" - }, - "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": "vitest run", + "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": "hello@effect.ai" + }, + "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/dotenv": "^8.2.0", + "dotenv": "^16.3.1", + "typescript": "^5.4.3", + "vitest": "^1.4.0" + }, + "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"] } diff --git a/src/actions/token/swap.ts b/src/actions/token/swap.ts index 18c3a65c..a83e4398 100644 --- a/src/actions/token/swap.ts +++ b/src/actions/token/swap.ts @@ -2,6 +2,7 @@ import { type AnyAction, Asset, type Name } from "@wharfkit/antelope"; import type { Client } from "../../client"; import { DefiBoxPairEnum } from "./getDefiBoxPair"; import { getPrice } from "./getPrice"; +import { useEFXContracts } from "../../utils/state"; export const swapDirection = { EfxToUsdt: `${DefiBoxPairEnum.EosEfx}-${DefiBoxPairEnum.EosUsdt}`, @@ -13,6 +14,7 @@ export const buildSwapAction = ( actor: Name, authorization: { permission: Name; actor: Name }[], amount: number, + tokenContract: string, efxPrice: number, ) => { if (!authorization || !authorization.length || !actor) { @@ -29,7 +31,7 @@ export const buildSwapAction = ( [key: string]: AnyAction; } = { [swapDirection.EfxToUsdt]: { - account: "effecttokens", + account: tokenContract, name: "transfer", authorization, data: { @@ -66,6 +68,7 @@ export const swap = async ( } const { transact, actor, authorization } = client.session; + const { token } = useEFXContracts(client); const efxPrice = await getPrice(); const action = buildSwapAction( @@ -73,6 +76,7 @@ export const swap = async ( actor, authorization, amount, + token, efxPrice, ); diff --git a/src/exports/index.ts b/src/exports/index.ts index 02bb7495..d9f26fde 100644 --- a/src/exports/index.ts +++ b/src/exports/index.ts @@ -148,6 +148,13 @@ export { type vTransferActionArgs, } from "./../actions/vaccount/transfer"; +export { + deposit, + depositAction, + type DepositActionArgs, + type DepositArgs, +} from "./../actions/vaccount/deposit"; + export { payout, type PayoutArgs } from "../actions/vaccount/payout"; export { type Client, type ClientOpts, createClient } from "./../client";