From 8dc1f820246de147a34e4cf74a1f3cc8c669c2e9 Mon Sep 17 00:00:00 2001 From: billyjacoby Date: Tue, 29 Oct 2024 09:36:48 -0400 Subject: [PATCH] chore: update docs --- .vscode/settings.json | 22 ++++--- packages/wallets/wallet-cosmos/README.md | 50 +++++++++++++++- .../wallets/wallet-cosmostation/README.md | 50 +++++++++++++++- packages/wallets/wallet-evm/README.md | 57 ++++++++++++++++++- packages/wallets/wallet-ledger/README.md | 53 ++++++++++++++++- packages/wallets/wallet-magic/README.md | 53 ++++++++++++++++- packages/wallets/wallet-private-key/README.md | 54 +++++++++++++++++- packages/wallets/wallet-trezor/README.md | 53 ++++++++++++++++- .../wallets/wallet-wallet-connect/README.md | 55 +++++++++++++++++- 9 files changed, 429 insertions(+), 18 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8fb1fa5ab..8fa9b11d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,9 +1,15 @@ { - "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, - "files.trimTrailingWhitespace": true, - "editor.renderFinalNewline": "on", - "cSpell.words": [ - "chronos" - ] -} + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "editor.renderFinalNewline": "on", + "cSpell.words": ["chronos"], + "[json][jsonc][javascript][javascriptreact][typescript][typescriptreact][vue]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": [ + "source.formatDocument", + "source.fixAll.eslint" + ] + } + } diff --git a/packages/wallets/wallet-cosmos/README.md b/packages/wallets/wallet-cosmos/README.md index 8c011ff20..2f429aead 100644 --- a/packages/wallets/wallet-cosmos/README.md +++ b/packages/wallets/wallet-cosmos/README.md @@ -20,7 +20,55 @@ yarn add @injectivelabs/wallet-cosmos ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { CosmosWalletStrategy } from '@injectivelabs/wallet-cosmos'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Keplr, + strategies: { + [Wallet.Keplr]: new CosmosWalletStrategy({ + chainId: ChainId.Mainnet + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-cosmostation/README.md b/packages/wallets/wallet-cosmostation/README.md index 9f21496b3..9b86ffd10 100644 --- a/packages/wallets/wallet-cosmostation/README.md +++ b/packages/wallets/wallet-cosmostation/README.md @@ -20,7 +20,55 @@ yarn add @injectivelabs/wallet-cosmostation ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { CosmostationWalletStrategy } from '@injectivelabs/wallet-cosmostation'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Cosmostation, + strategies: { + [Wallet.Cosmostation]: new CosmostationWalletStrategy({ + chainId: ChainId.Mainnet, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-evm/README.md b/packages/wallets/wallet-evm/README.md index c0afacae1..675429830 100644 --- a/packages/wallets/wallet-evm/README.md +++ b/packages/wallets/wallet-evm/README.md @@ -20,7 +20,58 @@ yarn add @injectivelabs/wallet-evm ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { EvmWalletStrategy } from '@injectivelabs/wallet-evm'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Metamask, + strategies: { + [Wallet.Metamask]: new EvmWalletStrategy({ + chainId: ChainId.Mainnet, + ethereumOptions: { + ethereumChainId: EthereumChainId.Mainnet, + }, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) @@ -45,14 +96,14 @@ Reach out to us at one of the following places! ## 🔓 License -Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/) +Copyright © 2021 - 2022 Injective Labs Inc. () Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
-http://www.apache.org/licenses/ +

 

diff --git a/packages/wallets/wallet-ledger/README.md b/packages/wallets/wallet-ledger/README.md index ba9e4caed..5cc33b315 100644 --- a/packages/wallets/wallet-ledger/README.md +++ b/packages/wallets/wallet-ledger/README.md @@ -20,7 +20,58 @@ yarn add @injectivelabs/wallet-ledger ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { LedgerLive } from '@injectivelabs/wallet-ledger'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Ledger, + strategies: { + [Wallet.Ledger]: new LedgerLive({ + chainId: ChainId.Mainnet, + ethereumOptions: { + ethereumChainId: EthereumChainId.Mainnet, + }, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-magic/README.md b/packages/wallets/wallet-magic/README.md index 17d3c5245..be5199ff5 100644 --- a/packages/wallets/wallet-magic/README.md +++ b/packages/wallets/wallet-magic/README.md @@ -20,7 +20,58 @@ yarn add @injectivelabs/wallet-magic ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { MagicStrategy } from '@injectivelabs/wallet-magic'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Magic, + strategies: { + [Wallet.Magic]: new MagicStrategy({ + chainId: ChainId.Mainnet, + metadata: { + apiKey: 'YOUR_MAGIC_API_KEY' + } + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-private-key/README.md b/packages/wallets/wallet-private-key/README.md index 5d627097d..c3719bfda 100644 --- a/packages/wallets/wallet-private-key/README.md +++ b/packages/wallets/wallet-private-key/README.md @@ -20,7 +20,59 @@ yarn add @injectivelabs/wallet-evm ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { PrivateKeyWalletStrategy } from '@injectivelabs/wallet-private-key'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.PrivateKey, + strategies: { + [Wallet.PrivateKey]: new PrivateKeyWalletStrategy({ + chainId: ChainId.Mainnet, + privateKey: 'YOUR_PRIVATE_KEY' + ethereumOptions: { + ethereumChainId: EthereumChainId.Mainnet, + }, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-trezor/README.md b/packages/wallets/wallet-trezor/README.md index 7f9a52996..c0f3e4cec 100644 --- a/packages/wallets/wallet-trezor/README.md +++ b/packages/wallets/wallet-trezor/README.md @@ -20,7 +20,58 @@ yarn add @injectivelabs/wallet-trezor ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { TrezorWalletStrategy } from '@injectivelabs/wallet-trezor'; + + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.Trezor, + strategies: { + [Wallet.Trezor]: new TrezorWalletStrategy({ + chainId: ChainId.Mainnet, + ethereumOptions: { + ethereumChainId: EthereumChainId.Mainnet, + }, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) diff --git a/packages/wallets/wallet-wallet-connect/README.md b/packages/wallets/wallet-wallet-connect/README.md index 434a4d450..b514cbfdf 100644 --- a/packages/wallets/wallet-wallet-connect/README.md +++ b/packages/wallets/wallet-wallet-connect/README.md @@ -20,7 +20,60 @@ yarn add @injectivelabs/wallet-wallet-connect ## 📖 Documentation - +Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they +want to include in their projects. + +Regardless of which wallet package(s) you choose to use you must also have `@injectivelabs/wallet-core` and `@injectivelabs/wallet-base` +installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary +dependencies and implementations for their specific wallets. + +Here's a brief example of how to use this package to send 1 INJ.: + +```typescript +import { Wallet } from '@injectivelabs/wallet-base'; +import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'; +import { WalletConnectStrategy } from '@injectivelabs/wallet-wallet-connect'; + +const strategyArgs: WalletStrategyArguments = { + chainId: ChainId.Mainnet, + wallet: Wallet.WalletConnect, + strategies: { + [Wallet.WalletConnect]: new WalletConnectStrategy({ + chainId: ChainId.Mainnet, + metadata: { + projectId: 'YOUR_PROJECT_ID', + }, + ethereumOptions: { + ethereumChainId: EthereumChainId.Mainnet, + }, + }), + }, +} +const walletStrategy = new BaseWalletStrategy(strategyArgs) + +const msgBroadcaster = new MsgBroadcaster({ + walletStrategy, + simulateTx: true, + network: Network.Mainnet, +}) + +const sendTX = async () => { + const injectiveAddress = 'someInjectiveAddress' + + const message = MsgSend.fromJSON({ + srcInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress, + amount: { + amount: '1', + denom: 'inj', + }, + }) + + return await msgBroadcaster.broadcast({ msgs: message }) + } + + const result = await sendTX() +``` Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy)