@atomiqlabs/chain-starknet 2.0.0-beta.7 → 2.0.0-beta.8

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.
@@ -3,4 +3,5 @@ export declare class StarknetKeypairWallet extends Account {
3
3
  readonly publicKey: string;
4
4
  constructor(provider: Provider, privateKey: string);
5
5
  getDeploymentData(): DeployAccountContractPayload;
6
+ static generateRandomPrivateKey(): string;
6
7
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StarknetKeypairWallet = void 0;
4
4
  const starknet_1 = require("starknet");
5
5
  const Utils_1 = require("../../utils/Utils");
6
+ const buffer_1 = require("buffer");
6
7
  const OZaccountClassHash = '0x00261c293c8084cd79086214176b33e5911677cec55104fddc8d25b0b736dcad';
7
8
  //Openzeppelin Account wallet
8
9
  class StarknetKeypairWallet extends starknet_1.Account {
@@ -22,5 +23,8 @@ class StarknetKeypairWallet extends starknet_1.Account {
22
23
  contractAddress: this.address
23
24
  };
24
25
  }
26
+ static generateRandomPrivateKey() {
27
+ return "0x" + buffer_1.Buffer.from(starknet_1.ec.starkCurve.utils.randomPrivateKey()).toString("hex");
28
+ }
25
29
  }
26
30
  exports.StarknetKeypairWallet = StarknetKeypairWallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-starknet",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.8",
4
4
  "description": "Starknet specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -1,5 +1,6 @@
1
1
  import {Account, CallData, DeployAccountContractPayload, ec, hash, Provider} from "starknet";
2
2
  import {toHex} from "../../utils/Utils";
3
+ import {Buffer} from "buffer";
3
4
 
4
5
  const OZaccountClassHash = '0x00261c293c8084cd79086214176b33e5911677cec55104fddc8d25b0b736dcad';
5
6
 
@@ -31,4 +32,8 @@ export class StarknetKeypairWallet extends Account {
31
32
  }
32
33
  }
33
34
 
35
+ public static generateRandomPrivateKey(): string {
36
+ return "0x"+Buffer.from(ec.starkCurve.utils.randomPrivateKey()).toString("hex");
37
+ }
38
+
34
39
  }