-
Notifications
You must be signed in to change notification settings - Fork 47
Sync Main >> Develop #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bebd84f
feat: rename to WDK, publish workflow
jonathunne acfb95d
Update tests/wdk-manager.test.js
jonathunne dc8dc2a
Update .github/workflows/build.yml
jonathunne d9d39f9
add README
jonathunne 34fa816
Merge pull request #13 from jonathunne/main
chetasr 8789e1c
chore: public release, bump version
jonathunne c73429c
Merge pull request #14 from jonathunne/public-flag
jonathunne 79b08fb
feat: update bare-node-runtime
nulllpc d8157bc
chore: bump version
nulllpc 3a80121
chore: update deps
nulllpc 5006126
fix: issue template
claudiovb cc7d8b0
feat: bump deps bare-node-runtime
nulllpc ded1cb9
chore: bump version
nulllpc f4ba634
Update package version
nulllpc 824f2d6
Merge pull request #21 from nampc1/update-bare-node-runtime
jonathunne 8a3a0c6
feat: add fiat protocol
nulllpc 237548e
chore: bump wdk-wallet dependency
nulllpc ad04fa7
chore: bump package version
nulllpc e75aa0f
Merge pull request #28 from nampc1/add-fiat-protocol
jonathunne 8736524
Merge pull request #25 from claudiovb/develop
jonathunne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.github/ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE/general.md
This file contains hidden or 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 hidden or 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 hidden or 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,54 @@ | ||
| name: publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Node 22.19.0 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.19.0' | ||
| cache: 'npm' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm clean-install | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Lint code with standard | ||
| run: npm run lint | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
|
|
||
| publish: | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| environment: npm-publish | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Node 22.19.0 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.19.0' | ||
| cache: 'npm' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm clean-install | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
This file contains hidden or 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 +1,153 @@ | ||
| # @wdk/core | ||
| # WDK Core | ||
|
|
||
| **WDK** is a simple tool that enables you to manage the WDK wallet and protocol modules through a single object. | ||
|
|
||
| ### Modules Managed | ||
|
|
||
| **Wallet Modules** - Add wallet support for any blockchain: | ||
| - `@tetherto/wdk-wallet-evm` - Ethereum, Polygon, Arbitrum | ||
| - `@tetherto/wdk-wallet-evm-erc4337` - EVM with no gas fees | ||
| - `@tetherto/wdk-wallet-ton` - TON blockchain | ||
| - `@tetherto/wdk-wallet-ton-gasless` - TON with no gas fees | ||
| - `@tetherto/wdk-wallet-btc` - Bitcoin | ||
| - `@tetherto/wdk-wallet-tron` - TRON blockchain | ||
| - `@tetherto/wdk-wallet-solana` - Solana blockchain | ||
|
|
||
| **Service Modules** - Add swap, bridge, and lending services: | ||
| - `@tetherto/wdk-protocol-swap-paraswap-evm` - Token swaps on EVM | ||
| - `@tetherto/wdk-protocol-bridge-usdt0-evm` - Bridge tokens between EVM chains | ||
| - `@tetherto/wdk-protocol-bridge-usdt0-ton` - Bridge tokens from TON to other chains | ||
| - `@tetherto/wdk-protocol-lending-aave-evm` - Lending and borrowing on EVM | ||
|
|
||
| **📚 Full module list and docs:** [docs.wallet.tether.io](https://docs.wallet.tether.io) | ||
|
|
||
| ## Features | ||
|
|
||
| - **Module Manager**: Controls and connects all WDK wallet and service modules | ||
| - **Wallet Modules**: Works with `@tetherto/wdk-wallet-evm`, `@tetherto/wdk-wallet-evm-erc-4337`, `@tetherto/wdk-wallet-tron` and other wallet packages | ||
| - **Service Modules**: Manages `@tetherto/wdk-protocol-bridge-usdt0-evm`, `@tetherto/wdk-protocol-bridge-usdt0-ton` and other service packages | ||
| - **One Setup**: Add any WDK module when you need it for any blockchain | ||
| - **Simple Control**: Manage all your wallet and service modules in one place | ||
|
|
||
| ## How to Install | ||
|
|
||
| ```bash | ||
| npm install @tetherto/wdk | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```typescript | ||
| import WDK from '@tetherto/wdk' | ||
| import WalletManagerEvm from '@tetherto/wdk-wallet-evm' | ||
| import WalletManagerTon from '@tetherto/wdk-wallet-ton' | ||
| import ParaswapProtocolEvm from '@tetherto/wdk-protocol-swap-paraswap-evm' | ||
| import Usdt0ProtocolTon from '@tetherto/wdk-protocol-bridge-usdt0-ton' | ||
|
|
||
| // Set up WDK with wallets and services | ||
| const wdk = new WDK(seed) //seed are your twelve word phrase | ||
| .registerWallet('ethereum', WalletManagerEvm, ethereumWalletConfig) | ||
| .registerWallet('ton', WalletManagerTon, tonWalletConfig) | ||
| .registerProtocol('ethereum', 'paraswap', ParaswapProtocolEvm, paraswapProtocolConfig) | ||
| .registerProtocol('ton', 'usdt0', Usdt0ProtocolTon, usdt0ProtocolConfig) | ||
|
|
||
| // Get accounts using different ways | ||
| const ethAccount = await wdk.getAccount('ethereum', 3) | ||
| const tonAccount = await wdk.getAccountByPath('ton', "1'/2/3") | ||
|
|
||
| // Send transactions directly | ||
| const { hash: txHash, fee: txFee } = await ethAccount.sendTransaction(tx) | ||
|
|
||
| // Use swap service | ||
| const paraswap = ethAccount.getSwapProtocol('paraswap') | ||
| const { hash: swapHash, fee: swapFee } = await paraswap.swap(swapOptions) | ||
|
|
||
| // Use bridge service | ||
| const usdt0 = tonAccount.getBridgeProtocol('usdt0') | ||
| const { hash: bridgeHash, fee: bridgeFee } = await usdt0.bridge(bridgeOptions) | ||
|
|
||
| // These will throw errors: | ||
| // const accountTron = await wdk.getAccount('tron', 5) // no tron wallet added | ||
| // const badBridge = accountEth.getBridgeProtocol('usdt0') // no usdt0 for ethereum | ||
| // const badSwap = tonAccount.getSwapProtocol('dedust') // no dedust for ton | ||
| ``` | ||
|
|
||
| ## How to Use | ||
|
|
||
| ### WDK | ||
|
|
||
| #### Start | ||
| ```typescript | ||
| constructor(seed: string | Uint8Array) | ||
| ``` | ||
|
|
||
| #### Add Things | ||
| - `registerWallet<W>(blockchain: string, wallet: W, config: WalletConfig): WDK` | ||
| - `registerProtocol<P>(blockchain: string, label: string, protocol: P, config: ProtocolConfig): WDK` | ||
| - `registerMiddleware(blockchain: string, middleware: MiddlewareFunction): WDK` | ||
|
|
||
| #### Get Accounts | ||
| - `getAccount(blockchain: string, index?: number): Promise<IWalletAccountWithProtocols>` | ||
| - `getAccountByPath(blockchain: string, path: string): Promise<IWalletAccountWithProtocols>` | ||
| - `getFeeRates(blockchain: string): Promise<FeeRates>` | ||
|
|
||
| #### Other Tools | ||
| - `dispose(): void` | ||
|
|
||
| #### Helper Tools | ||
| - `getRandomSeedPhrase(): string` | ||
| - `isValidSeedPhrase(seedPhrase: string): boolean` | ||
|
|
||
| ### Account with Services | ||
|
|
||
| Works with a basic wallet account but adds service management: | ||
|
|
||
| - `registerProtocol<P>(label: string, protocol: P, config: ProtocolConfig): IWalletAccountWithProtocols` | ||
| - `getSwapProtocol(label: string): ISwapProtocol` - Gets the swap service with the given name | ||
| - `getBridgeProtocol(label: string): IBridgeProtocol` - Gets the bridge service with the given name | ||
| - `getLendingProtocol(label: string): ILendingProtocol` - Gets the lending service with the given name | ||
|
|
||
| ## How to Use It | ||
|
|
||
| ### Add Many Blockchains | ||
| ```typescript | ||
| const wdk = new WDK(seed) //seed is your twelve word phrase | ||
| .registerWallet('ethereum', WalletManagerEvm, ethereumWalletConfig) | ||
| .registerWallet('arbitrum', WalletManagerEvm, arbitrumWalletConfig) | ||
| .registerWallet('ton', WalletManagerTon, tonWalletConfig) | ||
| ``` | ||
|
|
||
| ### Add Services to One Account | ||
| ```typescript | ||
| const account = await wdk.getAccount('ethereum', 0) | ||
| account.registerProtocol('paraswap', ParaswapProtocolEvm, paraswapProtocolConfig) | ||
|
|
||
| const paraswap = account.getSwapProtocol('paraswap') | ||
| const { hash, fee } = await paraswap.swap(swapOptions) | ||
|
|
||
| // This will throw an error - no service with this name: | ||
| // const uniswap = account.getSwapProtocol('uniswap') | ||
| ``` | ||
|
|
||
| ### Add Extra Tools to Accounts | ||
| ```typescript | ||
| wdk.registerMiddleware('ethereum', async (account) => { | ||
| console.log('New account:', await account.getAddress()) | ||
| }) | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. | ||
|
|
||
| ## Contributing | ||
|
|
||
| Contributions are welcome! Please feel free to submit a Pull Request. | ||
|
|
||
| ## Support | ||
|
|
||
| For support, please open an issue on the GitHub repository. | ||
|
|
||
| ## Learn More | ||
|
|
||
| For full docs, visit [docs.wallet.tether.io](https://docs.wallet.tether.io) |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.