@faremeter/wallet-evm 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -5
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,21 +25,34 @@ pnpm install @faremeter/wallet-evm
|
|
|
25
25
|
|
|
26
26
|
### createLocalWallet
|
|
27
27
|
|
|
28
|
+
Creates a local EVM wallet from a private key.
|
|
29
|
+
|
|
28
30
|
| Function | Type |
|
|
29
31
|
| ------------------- | -------------------------------------------------------------- |
|
|
30
32
|
| `createLocalWallet` | `(chain: ChainInfo, privateKey: string) => Promise<EvmWallet>` |
|
|
31
33
|
|
|
34
|
+
Parameters:
|
|
35
|
+
|
|
36
|
+
- `chain`: - Chain configuration for the wallet.
|
|
37
|
+
- `privateKey`: - Hex-encoded private key with "0x" prefix.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
|
|
41
|
+
An EVM wallet object for signing transactions.
|
|
42
|
+
|
|
32
43
|
## Interfaces
|
|
33
44
|
|
|
34
45
|
- [EvmWallet](#evmwallet)
|
|
35
46
|
|
|
36
47
|
### EvmWallet
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
| `
|
|
49
|
+
An EVM wallet instance with chain info and signing capabilities.
|
|
50
|
+
|
|
51
|
+
| Property | Type | Description |
|
|
52
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
|
53
|
+
| `chain` | `ChainInfo` | Chain configuration for this wallet. |
|
|
54
|
+
| `address` | `0x${string}` | Wallet address as a hex string. |
|
|
55
|
+
| `account` | `{ address: `0x${string}`; nonceManager?: NonceManager or undefined; sign: (parameters: { hash: `0x${string}`; }) => Promise<`0x${string}`>; signAuthorization: (parameters: AuthorizationRequest) => Promise<...>; ... 5 more ...; type: "local"; }` | Viem account for signing operations. |
|
|
43
56
|
|
|
44
57
|
<!-- TSDOC_END -->
|
|
45
58
|
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title EVM Wallet Package
|
|
3
|
+
* @sidebarTitle Wallet EVM
|
|
4
|
+
* @description Local wallet creation for EVM chains using private keys
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
1
7
|
import { type ChainInfo } from "@faremeter/types/evm";
|
|
2
8
|
import { type Hex } from "viem";
|
|
3
9
|
import { privateKeyToAccount } from "viem/accounts";
|
|
10
|
+
/**
|
|
11
|
+
* An EVM wallet instance with chain info and signing capabilities.
|
|
12
|
+
*/
|
|
4
13
|
export interface EvmWallet {
|
|
14
|
+
/** Chain configuration for this wallet. */
|
|
5
15
|
chain: ChainInfo;
|
|
16
|
+
/** Wallet address as a hex string. */
|
|
6
17
|
address: Hex;
|
|
18
|
+
/** Viem account for signing operations. */
|
|
7
19
|
account: ReturnType<typeof privateKeyToAccount>;
|
|
8
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a local EVM wallet from a private key.
|
|
23
|
+
*
|
|
24
|
+
* @param chain - Chain configuration for the wallet.
|
|
25
|
+
* @param privateKey - Hex-encoded private key with "0x" prefix.
|
|
26
|
+
* @returns An EVM wallet object for signing transactions.
|
|
27
|
+
* @throws If the private key format is invalid.
|
|
28
|
+
*/
|
|
9
29
|
export declare function createLocalWallet(chain: ChainInfo, privateKey: string): Promise<EvmWallet>;
|
|
10
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACjD;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,CAAC,CAcpB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB,sCAAsC;IACtC,OAAO,EAAE,GAAG,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACjD;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,CAAC,CAcpB"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title EVM Wallet Package
|
|
3
|
+
* @sidebarTitle Wallet EVM
|
|
4
|
+
* @description Local wallet creation for EVM chains using private keys
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
1
7
|
import { isPrivateKey } from "@faremeter/types/evm";
|
|
2
8
|
import {} from "viem";
|
|
3
9
|
import { privateKeyToAccount } from "viem/accounts";
|
|
10
|
+
/**
|
|
11
|
+
* Creates a local EVM wallet from a private key.
|
|
12
|
+
*
|
|
13
|
+
* @param chain - Chain configuration for the wallet.
|
|
14
|
+
* @param privateKey - Hex-encoded private key with "0x" prefix.
|
|
15
|
+
* @returns An EVM wallet object for signing transactions.
|
|
16
|
+
* @throws If the private key format is invalid.
|
|
17
|
+
*/
|
|
4
18
|
export async function createLocalWallet(chain, privateKey) {
|
|
5
19
|
if (!isPrivateKey(privateKey)) {
|
|
6
20
|
throw new Error(`Invalid private key format. Expected 64-character hex string with '0x' prefix, got: ${privateKey.slice(0, 10)}...`);
|