@atomiqlabs/chain-starknet 7.0.0 → 7.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-starknet",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Starknet specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,7 +0,0 @@
1
- import { Account, DeployAccountContractPayload, Provider } from "starknet";
2
- export declare class StarknetKeypairWallet extends Account {
3
- readonly publicKey: string;
4
- constructor(provider: Provider, privateKey: string);
5
- getDeploymentData(): DeployAccountContractPayload;
6
- static generateRandomPrivateKey(): string;
7
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StarknetKeypairWallet = void 0;
4
- const starknet_1 = require("starknet");
5
- const Utils_1 = require("../../utils/Utils");
6
- const buffer_1 = require("buffer");
7
- const OZaccountClassHash = '0x00261c293c8084cd79086214176b33e5911677cec55104fddc8d25b0b736dcad';
8
- //Openzeppelin Account wallet
9
- class StarknetKeypairWallet extends starknet_1.Account {
10
- constructor(provider, privateKey) {
11
- const publicKey = starknet_1.ec.starkCurve.getStarkKey((0, Utils_1.toHex)(privateKey));
12
- // Calculate future address of the account
13
- const OZaccountConstructorCallData = starknet_1.CallData.compile({ publicKey });
14
- const OZcontractAddress = starknet_1.hash.calculateContractAddressFromHash(publicKey, OZaccountClassHash, OZaccountConstructorCallData, 0);
15
- super({
16
- provider,
17
- address: OZcontractAddress,
18
- signer: privateKey,
19
- cairoVersion: "1"
20
- });
21
- this.publicKey = publicKey;
22
- }
23
- getDeploymentData() {
24
- return {
25
- classHash: OZaccountClassHash,
26
- constructorCalldata: starknet_1.CallData.compile({ publicKey: this.publicKey }),
27
- addressSalt: this.publicKey,
28
- contractAddress: this.address
29
- };
30
- }
31
- static generateRandomPrivateKey() {
32
- return "0x" + buffer_1.Buffer.from(starknet_1.ec.starkCurve.utils.randomPrivateKey()).toString("hex");
33
- }
34
- }
35
- exports.StarknetKeypairWallet = StarknetKeypairWallet;