genlayer-js 0.0.5 → 0.1.0
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/CHANGELOG.md +7 -0
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -4
- package/package.json +1 -1
- package/src/accounts/account.ts +5 -3
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.1.0 (2024-10-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* expose private key generation and extended account creation from a previous private key ([#10](https://github.com/yeagerai/genlayer-js/issues/10)) ([d43940b](https://github.com/yeagerai/genlayer-js/commit/d43940b7237450a0893823b18b4d0ed2e3e42790))
|
|
9
|
+
|
|
3
10
|
## 0.0.5 (2024-09-30)
|
package/dist/index.cjs
CHANGED
|
@@ -149,8 +149,9 @@ var createClient = (config = { chain: _chunkBAGFDCQEcjs.simulator }) => {
|
|
|
149
149
|
|
|
150
150
|
// src/accounts/account.ts
|
|
151
151
|
var _accounts = require('viem/accounts');
|
|
152
|
-
var
|
|
153
|
-
|
|
152
|
+
var generatePrivateKey = () => _accounts.generatePrivateKey.call(void 0, );
|
|
153
|
+
var createAccount = (accountPrivateKey) => {
|
|
154
|
+
const privateKey = accountPrivateKey || generatePrivateKey();
|
|
154
155
|
const account = _accounts.privateKeyToAccount.call(void 0, privateKey);
|
|
155
156
|
return account;
|
|
156
157
|
};
|
|
@@ -158,4 +159,5 @@ var createAccount = () => {
|
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
|
|
161
|
-
|
|
162
|
+
|
|
163
|
+
exports.chains = _chunkBAGFDCQEcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.generatePrivateKey = generatePrivateKey;
|
package/dist/index.d.cts
CHANGED
|
@@ -33,7 +33,8 @@ interface ClientConfig {
|
|
|
33
33
|
}
|
|
34
34
|
declare const createClient: (config?: ClientConfig) => GenLayerClient<Transport, SimulatorChain, Account>;
|
|
35
35
|
|
|
36
|
-
declare const
|
|
36
|
+
declare const generatePrivateKey: () => `0x${string}`;
|
|
37
|
+
declare const createAccount: (accountPrivateKey?: `0x${string}`) => {
|
|
37
38
|
address: viem_accounts.Address;
|
|
38
39
|
nonceManager?: viem_accounts.NonceManager | undefined;
|
|
39
40
|
sign: (parameters: {
|
|
@@ -52,4 +53,4 @@ declare const createAccount: () => {
|
|
|
52
53
|
type: "local";
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
export { createAccount, createClient };
|
|
56
|
+
export { createAccount, createClient, generatePrivateKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,8 @@ interface ClientConfig {
|
|
|
33
33
|
}
|
|
34
34
|
declare const createClient: (config?: ClientConfig) => GenLayerClient<Transport, SimulatorChain, Account>;
|
|
35
35
|
|
|
36
|
-
declare const
|
|
36
|
+
declare const generatePrivateKey: () => `0x${string}`;
|
|
37
|
+
declare const createAccount: (accountPrivateKey?: `0x${string}`) => {
|
|
37
38
|
address: viem_accounts.Address;
|
|
38
39
|
nonceManager?: viem_accounts.NonceManager | undefined;
|
|
39
40
|
sign: (parameters: {
|
|
@@ -52,4 +53,4 @@ declare const createAccount: () => {
|
|
|
52
53
|
type: "local";
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
export { createAccount, createClient };
|
|
56
|
+
export { createAccount, createClient, generatePrivateKey };
|
package/dist/index.js
CHANGED
|
@@ -148,14 +148,16 @@ var createClient = (config = { chain: simulator }) => {
|
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
// src/accounts/account.ts
|
|
151
|
-
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
152
|
-
var
|
|
153
|
-
|
|
151
|
+
import { generatePrivateKey as _generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
152
|
+
var generatePrivateKey = () => _generatePrivateKey();
|
|
153
|
+
var createAccount = (accountPrivateKey) => {
|
|
154
|
+
const privateKey = accountPrivateKey || generatePrivateKey();
|
|
154
155
|
const account = privateKeyToAccount(privateKey);
|
|
155
156
|
return account;
|
|
156
157
|
};
|
|
157
158
|
export {
|
|
158
159
|
chains_exports as chains,
|
|
159
160
|
createAccount,
|
|
160
|
-
createClient
|
|
161
|
+
createClient,
|
|
162
|
+
generatePrivateKey
|
|
161
163
|
};
|
package/package.json
CHANGED
package/src/accounts/account.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {generatePrivateKey, privateKeyToAccount} from "viem/accounts";
|
|
1
|
+
import {generatePrivateKey as _generatePrivateKey, privateKeyToAccount} from "viem/accounts";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
3
|
+
export const generatePrivateKey = () => _generatePrivateKey();
|
|
4
|
+
|
|
5
|
+
export const createAccount = (accountPrivateKey?: `0x${string}`) => {
|
|
6
|
+
const privateKey = accountPrivateKey || generatePrivateKey();
|
|
5
7
|
const account = privateKeyToAccount(privateKey);
|
|
6
8
|
return account;
|
|
7
9
|
};
|
package/src/index.ts
CHANGED