1.1.1 • Published 6 months ago
@celo/viem-account-ledger v1.1.1
@celo/viem-account-ledger
This library aims to ease the usage of a ledger device with (viem)https://viem.sh/.
Installation
npm install @celo/viem-account-ledger viem@2 @ledgerhq/transport-node-hid@6.x
# or yarn or bun or ...!IMPORTANT >
viemis a peer dependency and MUST be installed alongside this library.@ledgerhq/transport-node-hidis a peer dependency and MUST be installed alongside this library.
Usage
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import { createWalletClient } from 'viem'
import { celo, celoAlfajores } from 'viem/chains'
import { ledgerToAccount } from '@celo/viem-account-ledger'
async function main() => {
const account = await ledgerToAccount({
transport: await TransportNodeHid.open(''),
})
const client = createWalletClient({
account,
chain: celo,
transport: http()
});
await client.sendTransaction({
to: '0x123...',
value: 10n,
feeCurrency: '0x123...'
});
}You can also use the account directly eg:
const account = await ledgerToAccount({
transport: await TransportNodeHid.open(''),
})
account.signTransaction({
to: '0x123...',
value: 123n,
chainId: celoAlfajores.id,
nonce: 42,
maxFeePerGas: 100n,
maxPriorityFeePerGas: 100n,
feeCurrency: '0x123...',
})1.1.1
9 months ago
1.1.0
10 months ago
1.0.0
12 months ago
1.0.0-beta.2
1 year ago
1.0.1-beta.0
11 months ago
1.0.0-beta.1
1 year ago
1.1.0-beta.1
10 months ago
1.1.1-beta.0
9 months ago
1.2.0-beta.1
7 months ago
1.2.0-beta.0
7 months ago
1.2.0-beta.2
6 months ago
1.0.0-beta.0
1 year ago