From ef5c4fc0871fc16cef50243cfbdc162aeab728bf Mon Sep 17 00:00:00 2001 From: Aziz Ahmed Date: Wed, 19 Mar 2025 21:52:03 -0500 Subject: [PATCH 1/3] Initial commit --- typescript/packages/core/src/types/Chain.ts | 7 +- typescript/packages/wallets/tron/CHANGELOG.md | 156 ++++++++++++++++++ typescript/packages/wallets/tron/README.md | 49 ++++++ typescript/packages/wallets/tron/package.json | 34 ++++ .../tron/src/TronKeypairWalletClient.ts | 21 +++ .../wallets/tron/src/TronWalletClient.ts | 80 +++++++++ typescript/packages/wallets/tron/src/index.ts | 4 + .../wallets/tron/src/sendTRX.plugin.ts | 47 ++++++ .../wallets/tron/src/types/TronTypes.ts | 9 + .../packages/wallets/tron/src/types/index.ts | 1 + .../packages/wallets/tron/tsconfig.json | 6 + .../packages/wallets/tron/tsup.config.ts | 6 + typescript/packages/wallets/tron/turbo.json | 11 ++ 13 files changed, 430 insertions(+), 1 deletion(-) create mode 100644 typescript/packages/wallets/tron/CHANGELOG.md create mode 100644 typescript/packages/wallets/tron/README.md create mode 100644 typescript/packages/wallets/tron/package.json create mode 100644 typescript/packages/wallets/tron/src/TronKeypairWalletClient.ts create mode 100644 typescript/packages/wallets/tron/src/TronWalletClient.ts create mode 100644 typescript/packages/wallets/tron/src/index.ts create mode 100644 typescript/packages/wallets/tron/src/sendTRX.plugin.ts create mode 100644 typescript/packages/wallets/tron/src/types/TronTypes.ts create mode 100644 typescript/packages/wallets/tron/src/types/index.ts create mode 100644 typescript/packages/wallets/tron/tsconfig.json create mode 100644 typescript/packages/wallets/tron/tsup.config.ts create mode 100644 typescript/packages/wallets/tron/turbo.json diff --git a/typescript/packages/core/src/types/Chain.ts b/typescript/packages/core/src/types/Chain.ts index dc5cd1cfe..ef76256fb 100644 --- a/typescript/packages/core/src/types/Chain.ts +++ b/typescript/packages/core/src/types/Chain.ts @@ -13,7 +13,8 @@ export type Chain = | CosmosChain | StarknetChain | RadixChain - | ZetrixChain; + | ZetrixChain + | TronChain; export type SuiChain = { type: "sui"; @@ -62,3 +63,7 @@ export type RadixChain = { export type ZetrixChain = { type: "zetrix"; }; + +export type TronChain = { + type: "tron"; +}; diff --git a/typescript/packages/wallets/tron/CHANGELOG.md b/typescript/packages/wallets/tron/CHANGELOG.md new file mode 100644 index 000000000..e91965d17 --- /dev/null +++ b/typescript/packages/wallets/tron/CHANGELOG.md @@ -0,0 +1,156 @@ +# @goat-sdk/wallet-solana + +## 0.2.15 + +### Patch Changes + +- Updated dependencies [f73ce74] + - @goat-sdk/core@0.4.9 + +## 0.2.14 + +### Patch Changes + +- Updated dependencies [3091a49] + - @goat-sdk/core@0.4.8 + +## 0.2.13 + +### Patch Changes + +- Updated dependencies [a21a1f3] + - @goat-sdk/core@0.4.7 + +## 0.2.12 + +### Patch Changes + +- 1f361d5: Support raw txs + +## 0.2.11 + +### Patch Changes + +- Updated dependencies [2b4b8e8] + - @goat-sdk/core@0.4.6 + +## 0.2.10 + +### Patch Changes + +- Updated dependencies [b9af25b] + - @goat-sdk/core@0.4.5 + +## 0.2.9 + +### Patch Changes + +- Updated dependencies [50180d4] + - @goat-sdk/core@0.4.4 + +## 0.2.8 + +### Patch Changes + +- 87eed18: Support pump.fun plugin + +## 0.2.7 + +### Patch Changes + +- Updated dependencies [778440b] + - @goat-sdk/core@0.4.3 + +## 0.2.6 + +### Patch Changes + +- Updated dependencies [279dfcd] + - @goat-sdk/core@0.4.2 + +## 0.2.5 + +### Patch Changes + +- Updated dependencies [6c03f61] + - @goat-sdk/core@0.4.1 + +## 0.2.4 + +### Patch Changes + +- de8533d: Fix transaction instructions + +## 0.2.3 + +### Patch Changes + +- b9cb39c: Wait for transaction confirmation + +## 0.2.2 + +### Patch Changes + +- 608f9f1: Move to imperative prompts + +## 0.2.1 + +### Patch Changes + +- ab3b1dc: Add accountsToSign to Solana tx + +## 0.2.0 + +### Minor Changes + +- d3d9a7d: Upgrade to new plugin architecture + +### Patch Changes + +- Updated dependencies [d3d9a7d] + - @goat-sdk/core@0.4.0 + +## 0.1.9 + +### Patch Changes + +- a66ceec: Fix jupiter swap tokens tx +- Updated dependencies [a66ceec] + - @goat-sdk/core@0.3.15 + +## 0.1.8 + +### Patch Changes + +- d289856: Fix send transaction options + +## 0.1.7 + +### Patch Changes + +- 16271ab: Simplify core architecture +- Updated dependencies [16271ab] + - @goat-sdk/core@0.3.14 + +## 0.1.6 + +### Patch Changes + +- Updated dependencies [cad06c0] +- Updated dependencies [ad45f94] + - @goat-sdk/core@0.3.13 + +## 0.1.5 + +### Patch Changes + +- Updated dependencies [bf161b7] + - @goat-sdk/core@0.3.12 + +## 0.1.4 + +### Patch Changes + +- Updated dependencies [f5ea302] +- Updated dependencies [e61b658] + - @goat-sdk/core@0.3.11 diff --git a/typescript/packages/wallets/tron/README.md b/typescript/packages/wallets/tron/README.md new file mode 100644 index 000000000..abd9f8a7a --- /dev/null +++ b/typescript/packages/wallets/tron/README.md @@ -0,0 +1,49 @@ +
+ + +GOAT + +
+ +# TRON Wallet for GOAT + +## Installation +``` +npm install @goat-sdk/wallet-tron +yarn add @goat-sdk/wallet-tron +pnpm add @goat-sdk/wallet-tron +``` + +## Usage +```typescript +import { getOnChainTools } from "@goat-sdk/adapter-vercel-ai"; +import { tron } from "@goat-sdk/wallet-tron"; + +import { Connection, Keypair } from "@solana/web3.js"; +import * as bip39 from "bip39"; + +const connection = new Connection( + "https://api.mainnet-beta.solana.com", + "confirmed" +); + +const mnemonic = process.env.WALLET_MNEMONIC; + +const seed = bip39.mnemonicToSeedSync(mnemonic); +const keypair = Keypair.fromSeed(Uint8Array.from(seed).subarray(0, 32)); + +const tools = await getOnChainTools({ + wallet: solana({ + keypair, + connection, + }), +}); +``` + +