starknet 3.6.0 → 3.7.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 CHANGED
@@ -1,3 +1,11 @@
1
+ # [3.7.0](https://github.com/seanjameshan/starknet.js/compare/v3.6.0...v3.7.0) (2022-03-24)
2
+
3
+ ### Features
4
+
5
+ - **Account:** account constructor should take a KeyPair or a Signer as parameter ([ea6ae40](https://github.com/seanjameshan/starknet.js/commit/ea6ae40225d33e293b9d2de7c8509e87fb7a651e))
6
+ - add BigInt support within BigNumberish ([e42427a](https://github.com/seanjameshan/starknet.js/commit/e42427afa9a57673576da68cfbbee1356ffb5c0d))
7
+ - using typeguard to narrow variable's type in Account's constructor ([ed048f3](https://github.com/seanjameshan/starknet.js/commit/ed048f355bee815cc9b2ccc984db900059fa2303))
8
+
1
9
  # [3.6.0](https://github.com/seanjameshan/starknet.js/compare/v3.5.1...v3.6.0) (2022-03-24)
2
10
 
3
11
  ### Bug Fixes
@@ -1,4 +1,5 @@
1
1
  import { Provider } from '../provider';
2
+ import { SignerInterface } from '../signer';
2
3
  import {
3
4
  Abi,
4
5
  AddTransactionResponse,
@@ -15,7 +16,7 @@ import { AccountInterface } from './interface';
15
16
  export declare class Account extends Provider implements AccountInterface {
16
17
  address: string;
17
18
  private signer;
18
- constructor(provider: Provider, address: string, keyPair: KeyPair);
19
+ constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | SignerInterface);
19
20
  getNonce(): Promise<string>;
20
21
  estimateFee(calls: Call | Call[]): Promise<EstimateFeeResponse>;
21
22
  /**
@@ -207,9 +207,10 @@ var transaction_1 = require('../utils/transaction');
207
207
  var typedData_1 = require('../utils/typedData');
208
208
  var Account = /** @class */ (function (_super) {
209
209
  __extends(Account, _super);
210
- function Account(provider, address, keyPair) {
210
+ function Account(provider, address, keyPairOrSigner) {
211
211
  var _this = _super.call(this, provider) || this;
212
- _this.signer = new signer_1.Signer(keyPair);
212
+ _this.signer =
213
+ 'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new signer_1.Signer(keyPairOrSigner);
213
214
  _this.address = address;
214
215
  return _this;
215
216
  }
@@ -1,4 +1,5 @@
1
1
  import { Provider } from '../provider';
2
+ import { SignerInterface } from '../signer';
2
3
  import { Abi, AddTransactionResponse, Call, EstimateFeeResponse, InvocationsDetails, KeyPair, Signature, Transaction } from '../types';
3
4
  import { BigNumberish } from '../utils/number';
4
5
  import { TypedData } from '../utils/typedData';
@@ -6,7 +7,7 @@ import { AccountInterface } from './interface';
6
7
  export declare class Account extends Provider implements AccountInterface {
7
8
  address: string;
8
9
  private signer;
9
- constructor(provider: Provider, address: string, keyPair: KeyPair);
10
+ constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | SignerInterface);
10
11
  getNonce(): Promise<string>;
11
12
  estimateFee(calls: Call | Call[]): Promise<EstimateFeeResponse>;
12
13
  /**
@@ -91,9 +91,10 @@ var transaction_1 = require("../utils/transaction");
91
91
  var typedData_1 = require("../utils/typedData");
92
92
  var Account = /** @class */ (function (_super) {
93
93
  __extends(Account, _super);
94
- function Account(provider, address, keyPair) {
94
+ function Account(provider, address, keyPairOrSigner) {
95
95
  var _this = _super.call(this, provider) || this;
96
- _this.signer = new signer_1.Signer(keyPair);
96
+ _this.signer =
97
+ 'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new signer_1.Signer(keyPairOrSigner);
97
98
  _this.address = address;
98
99
  return _this;
99
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,9 +31,10 @@ export class Account extends Provider implements AccountInterface {
31
31
 
32
32
  private signer: SignerInterface;
33
33
 
34
- constructor(provider: Provider, address: string, keyPair: KeyPair) {
34
+ constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | SignerInterface) {
35
35
  super(provider);
36
- this.signer = new Signer(keyPair);
36
+ this.signer =
37
+ 'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair);
37
38
  this.address = address;
38
39
  }
39
40