mirror of
https://github.com/arx-research/libhalo.git
synced 2026-01-10 13:48:08 -05:00
Generic Viem HaLo account provider (#444)
This commit is contained in:
committed by
GitHub
parent
0106ff9e44
commit
5f222914a7
25
docs/viem-account.md
Normal file
25
docs/viem-account.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Using HaLo with Viem
|
||||
|
||||
```
|
||||
import {createViemHaloAccount} from "@arx-research/libhalo/api/common";
|
||||
import {execHaloCmdWeb} from '@arx-research/libhalo/api/web';
|
||||
import {HaloResSign, HexString} from "@arx-research/libhalo/types";
|
||||
|
||||
const HALO_KEY_NO = 8;
|
||||
const HALO_PASSWORD = "000000";
|
||||
|
||||
async function haloSignDigest(address: Hex, digest: HexString): Promise<HaloResSign> {
|
||||
return await execHaloCmdWeb({
|
||||
digest,
|
||||
keyNo: HALO_KEY_NO,
|
||||
password: HALO_PASSWORD,
|
||||
})
|
||||
}
|
||||
|
||||
const account = createViemHaloAccount(
|
||||
address,
|
||||
async (digest: string): Promise<HaloResSign> => await haloSignDigest(address, digest)
|
||||
)
|
||||
|
||||
// the "account" is ready to be used with Viem wallet/public clients
|
||||
```
|
||||
Reference in New Issue
Block a user