starknet 3.5.0 → 3.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.5.1](https://github.com/seanjameshan/starknet.js/compare/v3.5.0...v3.5.1) (2022-03-11)
2
+
3
+ ### Bug Fixes
4
+
5
+ - account detection ([b3b3ba7](https://github.com/seanjameshan/starknet.js/commit/b3b3ba74dde72027ba7f0e1234fed34a604fdcec))
6
+ - contract interface ([696116d](https://github.com/seanjameshan/starknet.js/commit/696116d383ba16c587e7ed708f7b47d02610b9d9))
7
+
1
8
  # [3.5.0](https://github.com/seanjameshan/starknet.js/compare/v3.4.0...v3.5.0) (2022-03-11)
2
9
 
3
10
  ### Bug Fixes
@@ -1,5 +1,5 @@
1
- import { Account } from '../account';
2
- import { Provider } from '../provider';
1
+ import { AccountInterface } from '../account';
2
+ import { ProviderInterface } from '../provider';
3
3
  import {
4
4
  Abi,
5
5
  AbiEntry,
@@ -18,7 +18,7 @@ import { ContractInterface } from './interface';
18
18
  export declare class Contract implements ContractInterface {
19
19
  abi: Abi;
20
20
  address: string;
21
- providerOrAccount: Provider | Account;
21
+ providerOrAccount: ProviderInterface | AccountInterface;
22
22
  deployTransactionHash?: string;
23
23
  protected readonly structs: {
24
24
  [name: string]: StructAbi;
@@ -43,7 +43,7 @@ export declare class Contract implements ContractInterface {
43
43
  * @param address (optional) - address to connect to
44
44
  * @param providerOrAccount (optional) - Provider or Account to attach to
45
45
  */
46
- constructor(abi: Abi, address: string, providerOrAccount?: Provider | Account);
46
+ constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface);
47
47
  /**
48
48
  * Saves the address of the contract deployed on network that will be used for interaction
49
49
  *
@@ -55,7 +55,7 @@ export declare class Contract implements ContractInterface {
55
55
  *
56
56
  * @param providerOrAccount - new Provider or Account to attach to
57
57
  */
58
- connect(providerOrAccount: Provider | Account): void;
58
+ connect(providerOrAccount: ProviderInterface | AccountInterface): void;
59
59
  /**
60
60
  * Resolves when contract is deployed on the network or when no deployment transaction is found
61
61
  *
@@ -187,7 +187,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
187
187
  exports.Contract = void 0;
188
188
  var bn_js_1 = __importDefault(require('bn.js'));
189
189
  var minimalistic_assert_1 = __importDefault(require('minimalistic-assert'));
190
- var account_1 = require('../account');
191
190
  var provider_1 = require('../provider');
192
191
  var hash_1 = require('../utils/hash');
193
192
  var number_1 = require('../utils/number');
@@ -746,7 +745,7 @@ var Contract = /** @class */ (function () {
746
745
  calldata: calldata,
747
746
  entrypoint: method,
748
747
  };
749
- if (this.providerOrAccount instanceof account_1.Account) {
748
+ if ('execute' in this.providerOrAccount) {
750
749
  return this.providerOrAccount.execute(invocation);
751
750
  }
752
751
  return this.providerOrAccount.invokeFunction(
@@ -1,5 +1,5 @@
1
- import { Account } from '../account';
2
- import { Provider } from '../provider';
1
+ import { AccountInterface } from '../account';
2
+ import { ProviderInterface } from '../provider';
3
3
  import {
4
4
  Abi,
5
5
  AddTransactionResponse,
@@ -11,7 +11,7 @@ import {
11
11
  export declare abstract class ContractInterface {
12
12
  abstract abi: Abi;
13
13
  abstract address: string;
14
- abstract providerOrAccount: Provider | Account;
14
+ abstract providerOrAccount: ProviderInterface | AccountInterface;
15
15
  abstract deployTransactionHash?: string;
16
16
  readonly functions: {
17
17
  [name: string]: AsyncContractFunction;
@@ -37,7 +37,7 @@ export declare abstract class ContractInterface {
37
37
  *
38
38
  * @param providerOrAccount - new Provider or Account to attach to
39
39
  */
40
- abstract connect(providerOrAccount: Provider | Account): void;
40
+ abstract connect(providerOrAccount: ProviderInterface | AccountInterface): void;
41
41
  /**
42
42
  * Resolves when contract is deployed on the network or when no deployment transaction is found
43
43
  *
@@ -1,12 +1,12 @@
1
- import { Account } from '../account';
2
- import { Provider } from '../provider';
1
+ import { AccountInterface } from '../account';
2
+ import { ProviderInterface } from '../provider';
3
3
  import { Abi, AbiEntry, AddTransactionResponse, Args, AsyncContractFunction, Calldata, ContractFunction, Invocation, ParsedStruct, Result, StructAbi } from '../types';
4
4
  import { BigNumberish } from '../utils/number';
5
5
  import { ContractInterface } from './interface';
6
6
  export declare class Contract implements ContractInterface {
7
7
  abi: Abi;
8
8
  address: string;
9
- providerOrAccount: Provider | Account;
9
+ providerOrAccount: ProviderInterface | AccountInterface;
10
10
  deployTransactionHash?: string;
11
11
  protected readonly structs: {
12
12
  [name: string]: StructAbi;
@@ -31,7 +31,7 @@ export declare class Contract implements ContractInterface {
31
31
  * @param address (optional) - address to connect to
32
32
  * @param providerOrAccount (optional) - Provider or Account to attach to
33
33
  */
34
- constructor(abi: Abi, address: string, providerOrAccount?: Provider | Account);
34
+ constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface);
35
35
  /**
36
36
  * Saves the address of the contract deployed on network that will be used for interaction
37
37
  *
@@ -43,7 +43,7 @@ export declare class Contract implements ContractInterface {
43
43
  *
44
44
  * @param providerOrAccount - new Provider or Account to attach to
45
45
  */
46
- connect(providerOrAccount: Provider | Account): void;
46
+ connect(providerOrAccount: ProviderInterface | AccountInterface): void;
47
47
  /**
48
48
  * Resolves when contract is deployed on the network or when no deployment transaction is found
49
49
  *
@@ -78,7 +78,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
78
78
  exports.Contract = void 0;
79
79
  var bn_js_1 = __importDefault(require("bn.js"));
80
80
  var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
81
- var account_1 = require("../account");
82
81
  var provider_1 = require("../provider");
83
82
  var hash_1 = require("../utils/hash");
84
83
  var number_1 = require("../utils/number");
@@ -579,7 +578,7 @@ var Contract = /** @class */ (function () {
579
578
  calldata: calldata,
580
579
  entrypoint: method,
581
580
  };
582
- if (this.providerOrAccount instanceof account_1.Account) {
581
+ if ('execute' in this.providerOrAccount) {
583
582
  return this.providerOrAccount.execute(invocation);
584
583
  }
585
584
  return this.providerOrAccount.invokeFunction(__assign(__assign({}, invocation), { signature: signature }));
@@ -1,10 +1,10 @@
1
- import { Account } from '../account';
2
- import { Provider } from '../provider';
1
+ import { AccountInterface } from '../account';
2
+ import { ProviderInterface } from '../provider';
3
3
  import { Abi, AddTransactionResponse, AsyncContractFunction, ContractFunction, Invocation, Result } from '../types';
4
4
  export declare abstract class ContractInterface {
5
5
  abstract abi: Abi;
6
6
  abstract address: string;
7
- abstract providerOrAccount: Provider | Account;
7
+ abstract providerOrAccount: ProviderInterface | AccountInterface;
8
8
  abstract deployTransactionHash?: string;
9
9
  readonly functions: {
10
10
  [name: string]: AsyncContractFunction;
@@ -30,7 +30,7 @@ export declare abstract class ContractInterface {
30
30
  *
31
31
  * @param providerOrAccount - new Provider or Account to attach to
32
32
  */
33
- abstract connect(providerOrAccount: Provider | Account): void;
33
+ abstract connect(providerOrAccount: ProviderInterface | AccountInterface): void;
34
34
  /**
35
35
  * Resolves when contract is deployed on the network or when no deployment transaction is found
36
36
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,8 +1,8 @@
1
1
  import BN from 'bn.js';
2
2
  import assert from 'minimalistic-assert';
3
3
 
4
- import { Account } from '../account';
5
- import { Provider, defaultProvider } from '../provider';
4
+ import { AccountInterface } from '../account';
5
+ import { ProviderInterface, defaultProvider } from '../provider';
6
6
  import {
7
7
  Abi,
8
8
  AbiEntry,
@@ -85,7 +85,7 @@ export class Contract implements ContractInterface {
85
85
 
86
86
  address: string;
87
87
 
88
- providerOrAccount: Provider | Account;
88
+ providerOrAccount: ProviderInterface | AccountInterface;
89
89
 
90
90
  deployTransactionHash?: string;
91
91
 
@@ -108,7 +108,11 @@ export class Contract implements ContractInterface {
108
108
  * @param address (optional) - address to connect to
109
109
  * @param providerOrAccount (optional) - Provider or Account to attach to
110
110
  */
111
- constructor(abi: Abi, address: string, providerOrAccount: Provider | Account = defaultProvider) {
111
+ constructor(
112
+ abi: Abi,
113
+ address: string,
114
+ providerOrAccount: ProviderInterface | AccountInterface = defaultProvider
115
+ ) {
112
116
  this.address = address;
113
117
  this.providerOrAccount = providerOrAccount;
114
118
  this.abi = abi;
@@ -202,7 +206,7 @@ export class Contract implements ContractInterface {
202
206
  *
203
207
  * @param providerOrAccount - new Provider or Account to attach to
204
208
  */
205
- public connect(providerOrAccount: Provider | Account) {
209
+ public connect(providerOrAccount: ProviderInterface | AccountInterface) {
206
210
  this.providerOrAccount = providerOrAccount;
207
211
  }
208
212
 
@@ -554,7 +558,7 @@ export class Contract implements ContractInterface {
554
558
  calldata,
555
559
  entrypoint: method,
556
560
  };
557
- if (this.providerOrAccount instanceof Account) {
561
+ if ('execute' in this.providerOrAccount) {
558
562
  return this.providerOrAccount.execute(invocation);
559
563
  }
560
564
  return this.providerOrAccount.invokeFunction({
@@ -1,5 +1,5 @@
1
- import { Account } from '../account';
2
- import { Provider } from '../provider';
1
+ import { AccountInterface } from '../account';
2
+ import { ProviderInterface } from '../provider';
3
3
  import {
4
4
  Abi,
5
5
  AddTransactionResponse,
@@ -14,7 +14,7 @@ export abstract class ContractInterface {
14
14
 
15
15
  public abstract address: string;
16
16
 
17
- public abstract providerOrAccount: Provider | Account;
17
+ public abstract providerOrAccount: ProviderInterface | AccountInterface;
18
18
 
19
19
  public abstract deployTransactionHash?: string;
20
20
 
@@ -40,7 +40,7 @@ export abstract class ContractInterface {
40
40
  *
41
41
  * @param providerOrAccount - new Provider or Account to attach to
42
42
  */
43
- public abstract connect(providerOrAccount: Provider | Account): void;
43
+ public abstract connect(providerOrAccount: ProviderInterface | AccountInterface): void;
44
44
 
45
45
  /**
46
46
  * Resolves when contract is deployed on the network or when no deployment transaction is found