starknet 3.10.0 → 3.10.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 +10 -0
- package/account/default.d.ts +10 -6
- package/account/default.js +3 -3
- package/account/interface.d.ts +2 -0
- package/contract/contractFactory.d.ts +5 -5
- package/contract/default.js +1 -1
- package/dist/account/default.d.ts +6 -6
- package/dist/account/default.js +3 -3
- package/dist/account/interface.d.ts +2 -0
- package/dist/contract/contractFactory.d.ts +5 -5
- package/dist/contract/default.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/provider/default.d.ts +1 -1
- package/dist/provider/default.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/provider/default.d.ts +1 -1
- package/provider/default.js +2 -1
- package/src/account/default.ts +10 -6
- package/src/account/interface.ts +3 -0
- package/src/contract/contractFactory.ts +5 -5
- package/src/contract/default.ts +1 -1
- package/src/index.ts +1 -0
- package/src/provider/default.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [3.10.1](https://github.com/seanjameshan/starknet.js/compare/v3.10.0...v3.10.1) (2022-04-20)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **account:** function documentation fix ([34a9779](https://github.com/seanjameshan/starknet.js/commit/34a977953c2bfea53f9cd1157809919b1dd2ed04))
|
|
6
|
+
- **contractFactory:** wrong prop type ([598bcd0](https://github.com/seanjameshan/starknet.js/commit/598bcd0d589c00e2219522d4a342316598678d4e))
|
|
7
|
+
- **contract:** recursion function name fix ([803b6dc](https://github.com/seanjameshan/starknet.js/commit/803b6dcf5cad5cdfd8258a53e176bcd96300cef3))
|
|
8
|
+
- typings ([1fadf41](https://github.com/seanjameshan/starknet.js/commit/1fadf418b04d96ced8d994b35699f40be9a8c898))
|
|
9
|
+
- **utils:** adding transaction utils to the utils export ([6429179](https://github.com/seanjameshan/starknet.js/commit/642917922a5d5278e8c575a2b4ffd60fff53cf42))
|
|
10
|
+
|
|
1
11
|
# [3.10.0](https://github.com/seanjameshan/starknet.js/compare/v3.9.0...v3.10.0) (2022-04-20)
|
|
2
12
|
|
|
3
13
|
### Bug Fixes
|
package/account/default.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Provider } from '../provider';
|
|
1
|
+
import { Provider, ProviderInterface } from '../provider';
|
|
2
2
|
import { BlockIdentifier } from '../provider/utils';
|
|
3
3
|
import { SignerInterface } from '../signer';
|
|
4
4
|
import {
|
|
@@ -16,8 +16,12 @@ import { TypedData } from '../utils/typedData';
|
|
|
16
16
|
import { AccountInterface } from './interface';
|
|
17
17
|
export declare class Account extends Provider implements AccountInterface {
|
|
18
18
|
address: string;
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
19
|
+
signer: SignerInterface;
|
|
20
|
+
constructor(
|
|
21
|
+
provider: ProviderInterface,
|
|
22
|
+
address: string,
|
|
23
|
+
keyPairOrSigner: KeyPair | SignerInterface
|
|
24
|
+
);
|
|
21
25
|
getNonce(): Promise<string>;
|
|
22
26
|
estimateFee(
|
|
23
27
|
calls: Call | Call[],
|
|
@@ -64,7 +68,8 @@ export declare class Account extends Provider implements AccountInterface {
|
|
|
64
68
|
*/
|
|
65
69
|
hashMessage(typedData: TypedData): Promise<string>;
|
|
66
70
|
/**
|
|
67
|
-
* Verify a signature of a
|
|
71
|
+
* Verify a signature of a given hash
|
|
72
|
+
* @warning This method is not recommended, use verifyMessage instead
|
|
68
73
|
*
|
|
69
74
|
* @param hash - JSON object to be verified
|
|
70
75
|
* @param signature - signature of the JSON object
|
|
@@ -73,8 +78,7 @@ export declare class Account extends Provider implements AccountInterface {
|
|
|
73
78
|
*/
|
|
74
79
|
verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
|
|
75
80
|
/**
|
|
76
|
-
* Verify a signature of a
|
|
77
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
81
|
+
* Verify a signature of a JSON object
|
|
78
82
|
*
|
|
79
83
|
* @param hash - hash to be verified
|
|
80
84
|
* @param signature - signature of the hash
|
package/account/default.js
CHANGED
|
@@ -510,7 +510,8 @@ var Account = /** @class */ (function (_super) {
|
|
|
510
510
|
});
|
|
511
511
|
};
|
|
512
512
|
/**
|
|
513
|
-
* Verify a signature of a
|
|
513
|
+
* Verify a signature of a given hash
|
|
514
|
+
* @warning This method is not recommended, use verifyMessage instead
|
|
514
515
|
*
|
|
515
516
|
* @param hash - JSON object to be verified
|
|
516
517
|
* @param signature - signature of the JSON object
|
|
@@ -550,8 +551,7 @@ var Account = /** @class */ (function (_super) {
|
|
|
550
551
|
});
|
|
551
552
|
};
|
|
552
553
|
/**
|
|
553
|
-
* Verify a signature of a
|
|
554
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
554
|
+
* Verify a signature of a JSON object
|
|
555
555
|
*
|
|
556
556
|
* @param hash - hash to be verified
|
|
557
557
|
* @param signature - signature of the hash
|
package/account/interface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderInterface } from '../provider';
|
|
2
|
+
import { SignerInterface } from '../signer';
|
|
2
3
|
import {
|
|
3
4
|
Abi,
|
|
4
5
|
AddTransactionResponse,
|
|
@@ -13,6 +14,7 @@ import { BigNumberish } from '../utils/number';
|
|
|
13
14
|
import { TypedData } from '../utils/typedData/types';
|
|
14
15
|
export declare abstract class AccountInterface extends ProviderInterface {
|
|
15
16
|
abstract address: string;
|
|
17
|
+
abstract signer: SignerInterface;
|
|
16
18
|
/**
|
|
17
19
|
* Deploys a given compiled contract (json) to starknet
|
|
18
20
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AccountInterface } from '../account';
|
|
2
|
+
import { ProviderInterface } from '../provider';
|
|
3
3
|
import { Abi, CompiledContract, RawCalldata } from '../types';
|
|
4
4
|
import { BigNumberish } from '../utils/number';
|
|
5
5
|
import { Contract } from './default';
|
|
6
6
|
export declare class ContractFactory {
|
|
7
7
|
abi: Abi;
|
|
8
8
|
compiledContract: CompiledContract;
|
|
9
|
-
providerOrAccount:
|
|
9
|
+
providerOrAccount: ProviderInterface | AccountInterface;
|
|
10
10
|
constructor(
|
|
11
11
|
compiledContract: CompiledContract,
|
|
12
|
-
providerOrAccount?:
|
|
12
|
+
providerOrAccount?: ProviderInterface | AccountInterface,
|
|
13
13
|
abi?: Abi
|
|
14
14
|
);
|
|
15
15
|
/**
|
|
@@ -25,7 +25,7 @@ export declare class ContractFactory {
|
|
|
25
25
|
*
|
|
26
26
|
* @param providerOrAccount - new Provider or Account to attach to
|
|
27
27
|
*/
|
|
28
|
-
connect(providerOrAccount:
|
|
28
|
+
connect(providerOrAccount: ProviderInterface | AccountInterface): ContractFactory;
|
|
29
29
|
/**
|
|
30
30
|
* Attaches current abi and provider or account to the new address
|
|
31
31
|
*
|
package/contract/default.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Provider } from '../provider';
|
|
1
|
+
import { Provider, ProviderInterface } from '../provider';
|
|
2
2
|
import { BlockIdentifier } from '../provider/utils';
|
|
3
3
|
import { SignerInterface } from '../signer';
|
|
4
4
|
import { Abi, AddTransactionResponse, Call, EstimateFeeResponse, InvocationsDetails, KeyPair, Signature, Transaction } from '../types';
|
|
@@ -7,8 +7,8 @@ import { TypedData } from '../utils/typedData';
|
|
|
7
7
|
import { AccountInterface } from './interface';
|
|
8
8
|
export declare class Account extends Provider implements AccountInterface {
|
|
9
9
|
address: string;
|
|
10
|
-
|
|
11
|
-
constructor(provider:
|
|
10
|
+
signer: SignerInterface;
|
|
11
|
+
constructor(provider: ProviderInterface, address: string, keyPairOrSigner: KeyPair | SignerInterface);
|
|
12
12
|
getNonce(): Promise<string>;
|
|
13
13
|
estimateFee(calls: Call | Call[], { nonce: providedNonce, blockIdentifier, }?: {
|
|
14
14
|
nonce?: BigNumberish;
|
|
@@ -45,7 +45,8 @@ export declare class Account extends Provider implements AccountInterface {
|
|
|
45
45
|
*/
|
|
46
46
|
hashMessage(typedData: TypedData): Promise<string>;
|
|
47
47
|
/**
|
|
48
|
-
* Verify a signature of a
|
|
48
|
+
* Verify a signature of a given hash
|
|
49
|
+
* @warning This method is not recommended, use verifyMessage instead
|
|
49
50
|
*
|
|
50
51
|
* @param hash - JSON object to be verified
|
|
51
52
|
* @param signature - signature of the JSON object
|
|
@@ -54,8 +55,7 @@ export declare class Account extends Provider implements AccountInterface {
|
|
|
54
55
|
*/
|
|
55
56
|
verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
|
|
56
57
|
/**
|
|
57
|
-
* Verify a signature of a
|
|
58
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
58
|
+
* Verify a signature of a JSON object
|
|
59
59
|
*
|
|
60
60
|
* @param hash - hash to be verified
|
|
61
61
|
* @param signature - signature of the hash
|
package/dist/account/default.js
CHANGED
|
@@ -340,7 +340,8 @@ var Account = /** @class */ (function (_super) {
|
|
|
340
340
|
});
|
|
341
341
|
};
|
|
342
342
|
/**
|
|
343
|
-
* Verify a signature of a
|
|
343
|
+
* Verify a signature of a given hash
|
|
344
|
+
* @warning This method is not recommended, use verifyMessage instead
|
|
344
345
|
*
|
|
345
346
|
* @param hash - JSON object to be verified
|
|
346
347
|
* @param signature - signature of the JSON object
|
|
@@ -374,8 +375,7 @@ var Account = /** @class */ (function (_super) {
|
|
|
374
375
|
});
|
|
375
376
|
};
|
|
376
377
|
/**
|
|
377
|
-
* Verify a signature of a
|
|
378
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
378
|
+
* Verify a signature of a JSON object
|
|
379
379
|
*
|
|
380
380
|
* @param hash - hash to be verified
|
|
381
381
|
* @param signature - signature of the hash
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ProviderInterface } from '../provider';
|
|
2
|
+
import { SignerInterface } from '../signer';
|
|
2
3
|
import { Abi, AddTransactionResponse, Call, DeployContractPayload, EstimateFeeResponse, Invocation, InvocationsDetails, Signature } from '../types';
|
|
3
4
|
import { BigNumberish } from '../utils/number';
|
|
4
5
|
import { TypedData } from '../utils/typedData/types';
|
|
5
6
|
export declare abstract class AccountInterface extends ProviderInterface {
|
|
6
7
|
abstract address: string;
|
|
8
|
+
abstract signer: SignerInterface;
|
|
7
9
|
/**
|
|
8
10
|
* Deploys a given compiled contract (json) to starknet
|
|
9
11
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AccountInterface } from '../account';
|
|
2
|
+
import { ProviderInterface } from '../provider';
|
|
3
3
|
import { Abi, CompiledContract, RawCalldata } from '../types';
|
|
4
4
|
import { BigNumberish } from '../utils/number';
|
|
5
5
|
import { Contract } from './default';
|
|
6
6
|
export declare class ContractFactory {
|
|
7
7
|
abi: Abi;
|
|
8
8
|
compiledContract: CompiledContract;
|
|
9
|
-
providerOrAccount:
|
|
10
|
-
constructor(compiledContract: CompiledContract, providerOrAccount?:
|
|
9
|
+
providerOrAccount: ProviderInterface | AccountInterface;
|
|
10
|
+
constructor(compiledContract: CompiledContract, providerOrAccount?: ProviderInterface | AccountInterface, abi?: Abi);
|
|
11
11
|
/**
|
|
12
12
|
* Deploys contract and returns new instance of the Contract
|
|
13
13
|
*
|
|
@@ -21,7 +21,7 @@ export declare class ContractFactory {
|
|
|
21
21
|
*
|
|
22
22
|
* @param providerOrAccount - new Provider or Account to attach to
|
|
23
23
|
*/
|
|
24
|
-
connect(providerOrAccount:
|
|
24
|
+
connect(providerOrAccount: ProviderInterface | AccountInterface): ContractFactory;
|
|
25
25
|
/**
|
|
26
26
|
* Attaches current abi and provider or account to the new address
|
|
27
27
|
*
|
package/dist/contract/default.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * as encode from './utils/encode';
|
|
|
14
14
|
export * as hash from './utils/hash';
|
|
15
15
|
export * as json from './utils/json';
|
|
16
16
|
export * as number from './utils/number';
|
|
17
|
+
export * as transaction from './utils/transaction';
|
|
17
18
|
export * as stark from './utils/stark';
|
|
18
19
|
export * as ec from './utils/ellipticCurve';
|
|
19
20
|
export * as uint256 from './utils/uint256';
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.typedData = exports.shortString = exports.uint256 = exports.ec = exports.stark = exports.number = exports.json = exports.hash = exports.encode = exports.constants = void 0;
|
|
25
|
+
exports.typedData = exports.shortString = exports.uint256 = exports.ec = exports.stark = exports.transaction = exports.number = exports.json = exports.hash = exports.encode = exports.constants = void 0;
|
|
26
26
|
/**
|
|
27
27
|
* Main
|
|
28
28
|
*/
|
|
@@ -39,6 +39,7 @@ exports.encode = __importStar(require("./utils/encode"));
|
|
|
39
39
|
exports.hash = __importStar(require("./utils/hash"));
|
|
40
40
|
exports.json = __importStar(require("./utils/json"));
|
|
41
41
|
exports.number = __importStar(require("./utils/number"));
|
|
42
|
+
exports.transaction = __importStar(require("./utils/transaction"));
|
|
42
43
|
exports.stark = __importStar(require("./utils/stark"));
|
|
43
44
|
exports.ec = __importStar(require("./utils/ellipticCurve"));
|
|
44
45
|
exports.uint256 = __importStar(require("./utils/uint256"));
|
|
@@ -14,7 +14,7 @@ export declare class Provider implements ProviderInterface {
|
|
|
14
14
|
feederGatewayUrl: string;
|
|
15
15
|
gatewayUrl: string;
|
|
16
16
|
chainId: StarknetChainId;
|
|
17
|
-
constructor(optionsOrProvider?: ProviderOptions |
|
|
17
|
+
constructor(optionsOrProvider?: ProviderOptions | ProviderInterface);
|
|
18
18
|
protected static getNetworkFromName(name: NetworkName): "https://alpha-mainnet.starknet.io" | "https://alpha4.starknet.io";
|
|
19
19
|
protected static getChainIdFromBaseUrl(baseUrl: string): StarknetChainId;
|
|
20
20
|
private getFetchUrl;
|
package/dist/provider/default.js
CHANGED
|
@@ -74,6 +74,7 @@ var hash_1 = require("../utils/hash");
|
|
|
74
74
|
var json_1 = require("../utils/json");
|
|
75
75
|
var number_1 = require("../utils/number");
|
|
76
76
|
var stark_1 = require("../utils/stark");
|
|
77
|
+
var interface_1 = require("./interface");
|
|
77
78
|
var utils_1 = require("./utils");
|
|
78
79
|
function wait(delay) {
|
|
79
80
|
return new Promise(function (res) { return setTimeout(res, delay); });
|
|
@@ -91,7 +92,7 @@ var Provider = /** @class */ (function () {
|
|
|
91
92
|
function Provider(optionsOrProvider) {
|
|
92
93
|
if (optionsOrProvider === void 0) { optionsOrProvider = { network: 'goerli-alpha' }; }
|
|
93
94
|
var _a;
|
|
94
|
-
if (optionsOrProvider instanceof
|
|
95
|
+
if (optionsOrProvider instanceof interface_1.ProviderInterface) {
|
|
95
96
|
this.baseUrl = optionsOrProvider.baseUrl;
|
|
96
97
|
this.feederGatewayUrl = optionsOrProvider.feederGatewayUrl;
|
|
97
98
|
this.gatewayUrl = optionsOrProvider.gatewayUrl;
|
package/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * as encode from './utils/encode';
|
|
|
14
14
|
export * as hash from './utils/hash';
|
|
15
15
|
export * as json from './utils/json';
|
|
16
16
|
export * as number from './utils/number';
|
|
17
|
+
export * as transaction from './utils/transaction';
|
|
17
18
|
export * as stark from './utils/stark';
|
|
18
19
|
export * as ec from './utils/ellipticCurve';
|
|
19
20
|
export * as uint256 from './utils/uint256';
|
package/index.js
CHANGED
|
@@ -49,6 +49,7 @@ exports.typedData =
|
|
|
49
49
|
exports.uint256 =
|
|
50
50
|
exports.ec =
|
|
51
51
|
exports.stark =
|
|
52
|
+
exports.transaction =
|
|
52
53
|
exports.number =
|
|
53
54
|
exports.json =
|
|
54
55
|
exports.hash =
|
|
@@ -71,6 +72,7 @@ exports.encode = __importStar(require('./utils/encode'));
|
|
|
71
72
|
exports.hash = __importStar(require('./utils/hash'));
|
|
72
73
|
exports.json = __importStar(require('./utils/json'));
|
|
73
74
|
exports.number = __importStar(require('./utils/number'));
|
|
75
|
+
exports.transaction = __importStar(require('./utils/transaction'));
|
|
74
76
|
exports.stark = __importStar(require('./utils/stark'));
|
|
75
77
|
exports.ec = __importStar(require('./utils/ellipticCurve'));
|
|
76
78
|
exports.uint256 = __importStar(require('./utils/uint256'));
|
package/package.json
CHANGED
package/provider/default.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Provider implements ProviderInterface {
|
|
|
31
31
|
feederGatewayUrl: string;
|
|
32
32
|
gatewayUrl: string;
|
|
33
33
|
chainId: StarknetChainId;
|
|
34
|
-
constructor(optionsOrProvider?: ProviderOptions |
|
|
34
|
+
constructor(optionsOrProvider?: ProviderOptions | ProviderInterface);
|
|
35
35
|
protected static getNetworkFromName(
|
|
36
36
|
name: NetworkName
|
|
37
37
|
): 'https://alpha-mainnet.starknet.io' | 'https://alpha4.starknet.io';
|
package/provider/default.js
CHANGED
|
@@ -180,6 +180,7 @@ var hash_1 = require('../utils/hash');
|
|
|
180
180
|
var json_1 = require('../utils/json');
|
|
181
181
|
var number_1 = require('../utils/number');
|
|
182
182
|
var stark_1 = require('../utils/stark');
|
|
183
|
+
var interface_1 = require('./interface');
|
|
183
184
|
var utils_1 = require('./utils');
|
|
184
185
|
function wait(delay) {
|
|
185
186
|
return new Promise(function (res) {
|
|
@@ -205,7 +206,7 @@ var Provider = /** @class */ (function () {
|
|
|
205
206
|
optionsOrProvider = { network: 'goerli-alpha' };
|
|
206
207
|
}
|
|
207
208
|
var _a;
|
|
208
|
-
if (optionsOrProvider instanceof
|
|
209
|
+
if (optionsOrProvider instanceof interface_1.ProviderInterface) {
|
|
209
210
|
this.baseUrl = optionsOrProvider.baseUrl;
|
|
210
211
|
this.feederGatewayUrl = optionsOrProvider.feederGatewayUrl;
|
|
211
212
|
this.gatewayUrl = optionsOrProvider.gatewayUrl;
|
package/src/account/default.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert';
|
|
2
2
|
|
|
3
3
|
import { ZERO } from '../constants';
|
|
4
|
-
import { Provider } from '../provider';
|
|
4
|
+
import { Provider, ProviderInterface } from '../provider';
|
|
5
5
|
import { BlockIdentifier } from '../provider/utils';
|
|
6
6
|
import { Signer, SignerInterface } from '../signer';
|
|
7
7
|
import {
|
|
@@ -33,9 +33,13 @@ import { AccountInterface } from './interface';
|
|
|
33
33
|
export class Account extends Provider implements AccountInterface {
|
|
34
34
|
public address: string;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
public signer: SignerInterface;
|
|
37
37
|
|
|
38
|
-
constructor(
|
|
38
|
+
constructor(
|
|
39
|
+
provider: ProviderInterface,
|
|
40
|
+
address: string,
|
|
41
|
+
keyPairOrSigner: KeyPair | SignerInterface
|
|
42
|
+
) {
|
|
39
43
|
super(provider);
|
|
40
44
|
this.signer =
|
|
41
45
|
'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair);
|
|
@@ -250,7 +254,8 @@ export class Account extends Provider implements AccountInterface {
|
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
/**
|
|
253
|
-
* Verify a signature of a
|
|
257
|
+
* Verify a signature of a given hash
|
|
258
|
+
* @warning This method is not recommended, use verifyMessage instead
|
|
254
259
|
*
|
|
255
260
|
* @param hash - JSON object to be verified
|
|
256
261
|
* @param signature - signature of the JSON object
|
|
@@ -274,8 +279,7 @@ export class Account extends Provider implements AccountInterface {
|
|
|
274
279
|
}
|
|
275
280
|
|
|
276
281
|
/**
|
|
277
|
-
* Verify a signature of a
|
|
278
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
282
|
+
* Verify a signature of a JSON object
|
|
279
283
|
*
|
|
280
284
|
* @param hash - hash to be verified
|
|
281
285
|
* @param signature - signature of the hash
|
package/src/account/interface.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderInterface } from '../provider';
|
|
2
|
+
import { SignerInterface } from '../signer';
|
|
2
3
|
import {
|
|
3
4
|
Abi,
|
|
4
5
|
AddTransactionResponse,
|
|
@@ -15,6 +16,8 @@ import { TypedData } from '../utils/typedData/types';
|
|
|
15
16
|
export abstract class AccountInterface extends ProviderInterface {
|
|
16
17
|
public abstract address: string;
|
|
17
18
|
|
|
19
|
+
public abstract signer: SignerInterface;
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* Deploys a given compiled contract (json) to starknet
|
|
20
23
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AccountInterface } from '../account';
|
|
4
|
+
import { ProviderInterface, defaultProvider } from '../provider';
|
|
5
5
|
import { Abi, CompiledContract, RawCalldata } from '../types';
|
|
6
6
|
import { BigNumberish } from '../utils/number';
|
|
7
7
|
import { Contract } from './default';
|
|
@@ -11,11 +11,11 @@ export class ContractFactory {
|
|
|
11
11
|
|
|
12
12
|
compiledContract: CompiledContract;
|
|
13
13
|
|
|
14
|
-
providerOrAccount:
|
|
14
|
+
providerOrAccount: ProviderInterface | AccountInterface;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
17
|
compiledContract: CompiledContract,
|
|
18
|
-
providerOrAccount:
|
|
18
|
+
providerOrAccount: ProviderInterface | AccountInterface = defaultProvider,
|
|
19
19
|
abi: Abi = compiledContract.abi // abi can be different from the deployed contract ie for proxy contracts
|
|
20
20
|
) {
|
|
21
21
|
this.abi = abi;
|
|
@@ -59,7 +59,7 @@ export class ContractFactory {
|
|
|
59
59
|
*
|
|
60
60
|
* @param providerOrAccount - new Provider or Account to attach to
|
|
61
61
|
*/
|
|
62
|
-
connect(providerOrAccount:
|
|
62
|
+
connect(providerOrAccount: ProviderInterface | AccountInterface): ContractFactory {
|
|
63
63
|
this.providerOrAccount = providerOrAccount;
|
|
64
64
|
return this;
|
|
65
65
|
}
|
package/src/contract/default.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * as encode from './utils/encode';
|
|
|
15
15
|
export * as hash from './utils/hash';
|
|
16
16
|
export * as json from './utils/json';
|
|
17
17
|
export * as number from './utils/number';
|
|
18
|
+
export * as transaction from './utils/transaction';
|
|
18
19
|
export * as stark from './utils/stark';
|
|
19
20
|
export * as ec from './utils/ellipticCurve';
|
|
20
21
|
export * as uint256 from './utils/uint256';
|
package/src/provider/default.ts
CHANGED
|
@@ -52,8 +52,10 @@ export class Provider implements ProviderInterface {
|
|
|
52
52
|
|
|
53
53
|
public chainId: StarknetChainId;
|
|
54
54
|
|
|
55
|
-
constructor(
|
|
56
|
-
|
|
55
|
+
constructor(
|
|
56
|
+
optionsOrProvider: ProviderOptions | ProviderInterface = { network: 'goerli-alpha' }
|
|
57
|
+
) {
|
|
58
|
+
if (optionsOrProvider instanceof ProviderInterface) {
|
|
57
59
|
this.baseUrl = optionsOrProvider.baseUrl;
|
|
58
60
|
this.feederGatewayUrl = optionsOrProvider.feederGatewayUrl;
|
|
59
61
|
this.gatewayUrl = optionsOrProvider.gatewayUrl;
|