starknet 4.12.0 → 4.13.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/.eslintrc +1 -0
- package/CHANGELOG.md +14 -0
- package/__tests__/account.test.ts +0 -2
- package/dist/index.d.ts +2683 -24
- package/dist/index.global.js +22994 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +4713 -53
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4655 -0
- package/dist/index.mjs.map +1 -0
- package/index.d.ts +2683 -24
- package/index.global.js +22994 -0
- package/index.global.js.map +1 -0
- package/index.js +4713 -53
- package/index.js.map +1 -0
- package/index.mjs +4655 -0
- package/index.mjs.map +1 -0
- package/package.json +8 -2
- package/src/account/default.ts +43 -8
- package/src/account/interface.ts +25 -2
- package/src/constants.ts +0 -1
- package/src/provider/default.ts +3 -0
- package/src/provider/interface.ts +2 -0
- package/src/provider/rpc.ts +4 -4
- package/src/provider/sequencer.ts +4 -1
- package/src/types/lib.ts +1 -1
- package/src/types/provider.ts +5 -0
- package/src/utils/ellipticCurve.ts +3 -1
- package/src/utils/fetchPonyfill.ts +3 -2
- package/src/utils/hash.ts +3 -2
- package/src/utils/number.ts +2 -2
- package/tsup.config.ts +10 -0
- package/account/default.d.ts +0 -30
- package/account/default.js +0 -526
- package/account/index.d.ts +0 -2
- package/account/index.js +0 -18
- package/account/interface.d.ts +0 -161
- package/account/interface.js +0 -27
- package/constants.d.ts +0 -36
- package/constants.js +0 -2067
- package/contract/contractFactory.d.ts +0 -31
- package/contract/contractFactory.js +0 -102
- package/contract/default.d.ts +0 -108
- package/contract/default.js +0 -640
- package/contract/index.d.ts +0 -3
- package/contract/index.js +0 -19
- package/contract/interface.d.ts +0 -80
- package/contract/interface.js +0 -9
- package/dist/account/default.d.ts +0 -30
- package/dist/account/default.js +0 -526
- package/dist/account/index.d.ts +0 -2
- package/dist/account/index.js +0 -18
- package/dist/account/interface.d.ts +0 -161
- package/dist/account/interface.js +0 -27
- package/dist/constants.d.ts +0 -36
- package/dist/constants.js +0 -2067
- package/dist/contract/contractFactory.d.ts +0 -31
- package/dist/contract/contractFactory.js +0 -102
- package/dist/contract/default.d.ts +0 -108
- package/dist/contract/default.js +0 -640
- package/dist/contract/index.d.ts +0 -3
- package/dist/contract/index.js +0 -19
- package/dist/contract/interface.d.ts +0 -80
- package/dist/contract/interface.js +0 -9
- package/dist/provider/default.d.ts +0 -37
- package/dist/provider/default.js +0 -207
- package/dist/provider/errors.d.ts +0 -9
- package/dist/provider/errors.js +0 -40
- package/dist/provider/index.d.ts +0 -7
- package/dist/provider/index.js +0 -24
- package/dist/provider/interface.d.ts +0 -203
- package/dist/provider/interface.js +0 -9
- package/dist/provider/rpc.d.ts +0 -86
- package/dist/provider/rpc.js +0 -605
- package/dist/provider/sequencer.d.ts +0 -79
- package/dist/provider/sequencer.js +0 -575
- package/dist/provider/utils.d.ts +0 -30
- package/dist/provider/utils.js +0 -84
- package/dist/signer/default.d.ts +0 -13
- package/dist/signer/default.js +0 -102
- package/dist/signer/index.d.ts +0 -2
- package/dist/signer/index.js +0 -18
- package/dist/signer/interface.d.ts +0 -60
- package/dist/signer/interface.js +0 -9
- package/dist/types/account.d.ts +0 -11
- package/dist/types/account.js +0 -2
- package/dist/types/api/index.d.ts +0 -10
- package/dist/types/api/index.js +0 -18
- package/dist/types/api/openrpc.d.ts +0 -572
- package/dist/types/api/openrpc.js +0 -45
- package/dist/types/api/rpc.d.ts +0 -43
- package/dist/types/api/rpc.js +0 -2
- package/dist/types/api/sequencer.d.ts +0 -320
- package/dist/types/api/sequencer.js +0 -2
- package/dist/types/contract.d.ts +0 -5
- package/dist/types/contract.js +0 -2
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.js +0 -35
- package/dist/types/lib.d.ts +0 -120
- package/dist/types/lib.js +0 -8
- package/dist/types/provider.d.ts +0 -99
- package/dist/types/provider.js +0 -2
- package/dist/types/signer.d.ts +0 -19
- package/dist/types/signer.js +0 -2
- package/dist/utils/address.d.ts +0 -5
- package/dist/utils/address.js +0 -41
- package/dist/utils/ellipticCurve.d.ts +0 -29
- package/dist/utils/ellipticCurve.js +0 -132
- package/dist/utils/encode.d.ts +0 -15
- package/dist/utils/encode.js +0 -96
- package/dist/utils/fetchPonyfill.d.ts +0 -2
- package/dist/utils/fetchPonyfill.js +0 -6
- package/dist/utils/hash.d.ts +0 -37
- package/dist/utils/hash.js +0 -162
- package/dist/utils/json.d.ts +0 -16
- package/dist/utils/json.js +0 -19
- package/dist/utils/merkle.d.ts +0 -10
- package/dist/utils/merkle.js +0 -89
- package/dist/utils/number.d.ts +0 -16
- package/dist/utils/number.js +0 -112
- package/dist/utils/provider.d.ts +0 -4
- package/dist/utils/provider.js +0 -38
- package/dist/utils/responseParser/index.d.ts +0 -11
- package/dist/utils/responseParser/index.js +0 -9
- package/dist/utils/responseParser/rpc.d.ts +0 -20
- package/dist/utils/responseParser/rpc.js +0 -44
- package/dist/utils/responseParser/sequencer.d.ts +0 -17
- package/dist/utils/responseParser/sequencer.js +0 -99
- package/dist/utils/shortString.d.ts +0 -4
- package/dist/utils/shortString.js +0 -26
- package/dist/utils/stark.d.ts +0 -16
- package/dist/utils/stark.js +0 -91
- package/dist/utils/transaction.d.ts +0 -20
- package/dist/utils/transaction.js +0 -79
- package/dist/utils/typedData/index.d.ts +0 -72
- package/dist/utils/typedData/index.js +0 -239
- package/dist/utils/typedData/types.d.ts +0 -32
- package/dist/utils/typedData/types.js +0 -2
- package/dist/utils/typedData/utils.d.ts +0 -8
- package/dist/utils/typedData/utils.js +0 -16
- package/dist/utils/uint256.d.ts +0 -11
- package/dist/utils/uint256.js +0 -28
- package/dist/utils/url.d.ts +0 -7
- package/dist/utils/url.js +0 -49
- package/provider/default.d.ts +0 -37
- package/provider/default.js +0 -207
- package/provider/errors.d.ts +0 -9
- package/provider/errors.js +0 -40
- package/provider/index.d.ts +0 -7
- package/provider/index.js +0 -24
- package/provider/interface.d.ts +0 -203
- package/provider/interface.js +0 -9
- package/provider/rpc.d.ts +0 -86
- package/provider/rpc.js +0 -605
- package/provider/sequencer.d.ts +0 -79
- package/provider/sequencer.js +0 -575
- package/provider/utils.d.ts +0 -30
- package/provider/utils.js +0 -84
- package/signer/default.d.ts +0 -13
- package/signer/default.js +0 -102
- package/signer/index.d.ts +0 -2
- package/signer/index.js +0 -18
- package/signer/interface.d.ts +0 -60
- package/signer/interface.js +0 -9
- package/types/account.d.ts +0 -11
- package/types/account.js +0 -2
- package/types/api/index.d.ts +0 -10
- package/types/api/index.js +0 -18
- package/types/api/openrpc.d.ts +0 -572
- package/types/api/openrpc.js +0 -45
- package/types/api/rpc.d.ts +0 -43
- package/types/api/rpc.js +0 -2
- package/types/api/sequencer.d.ts +0 -320
- package/types/api/sequencer.js +0 -2
- package/types/contract.d.ts +0 -5
- package/types/contract.js +0 -2
- package/types/index.d.ts +0 -7
- package/types/index.js +0 -35
- package/types/lib.d.ts +0 -120
- package/types/lib.js +0 -8
- package/types/provider.d.ts +0 -99
- package/types/provider.js +0 -2
- package/types/signer.d.ts +0 -19
- package/types/signer.js +0 -2
- package/utils/address.d.ts +0 -5
- package/utils/address.js +0 -41
- package/utils/ellipticCurve.d.ts +0 -29
- package/utils/ellipticCurve.js +0 -132
- package/utils/encode.d.ts +0 -15
- package/utils/encode.js +0 -96
- package/utils/fetchPonyfill.d.ts +0 -2
- package/utils/fetchPonyfill.js +0 -6
- package/utils/hash.d.ts +0 -37
- package/utils/hash.js +0 -162
- package/utils/json.d.ts +0 -16
- package/utils/json.js +0 -19
- package/utils/merkle.d.ts +0 -10
- package/utils/merkle.js +0 -89
- package/utils/number.d.ts +0 -16
- package/utils/number.js +0 -112
- package/utils/provider.d.ts +0 -4
- package/utils/provider.js +0 -38
- package/utils/responseParser/index.d.ts +0 -11
- package/utils/responseParser/index.js +0 -9
- package/utils/responseParser/rpc.d.ts +0 -20
- package/utils/responseParser/rpc.js +0 -44
- package/utils/responseParser/sequencer.d.ts +0 -17
- package/utils/responseParser/sequencer.js +0 -99
- package/utils/shortString.d.ts +0 -4
- package/utils/shortString.js +0 -26
- package/utils/stark.d.ts +0 -16
- package/utils/stark.js +0 -91
- package/utils/transaction.d.ts +0 -20
- package/utils/transaction.js +0 -79
- package/utils/typedData/index.d.ts +0 -72
- package/utils/typedData/index.js +0 -239
- package/utils/typedData/types.d.ts +0 -32
- package/utils/typedData/types.js +0 -2
- package/utils/typedData/utils.d.ts +0 -8
- package/utils/typedData/utils.js +0 -16
- package/utils/uint256.d.ts +0 -11
- package/utils/uint256.js +0 -28
- package/utils/url.d.ts +0 -7
- package/utils/url.js +0 -49
package/provider/utils.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { BlockNumber } from '../types';
|
|
2
|
-
import { BigNumberish } from '../utils/number';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L148-L153)
|
|
6
|
-
*
|
|
7
|
-
* @param hashValue
|
|
8
|
-
* @param hashField
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatHash(hashValue: BigNumberish): string;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L156-L161)
|
|
14
|
-
* @param txHash
|
|
15
|
-
* @param txId
|
|
16
|
-
*/
|
|
17
|
-
export declare function txIdentifier(txHash?: BigNumberish, txId?: BigNumberish): string;
|
|
18
|
-
export declare type BlockIdentifier = BlockNumber | BigNumberish;
|
|
19
|
-
export declare class Block {
|
|
20
|
-
hash: BlockIdentifier;
|
|
21
|
-
number: BlockIdentifier;
|
|
22
|
-
tag: BlockIdentifier;
|
|
23
|
-
private setIdentifier;
|
|
24
|
-
constructor(_identifier: BlockIdentifier);
|
|
25
|
-
get queryIdentifier(): any;
|
|
26
|
-
get identifier(): any;
|
|
27
|
-
set identifier(_identifier: BlockIdentifier);
|
|
28
|
-
valueOf: () => BlockIdentifier;
|
|
29
|
-
toString: () => BlockIdentifier;
|
|
30
|
-
}
|
package/provider/utils.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Block = exports.txIdentifier = exports.formatHash = void 0;
|
|
4
|
-
var number_1 = require("../utils/number");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L148-L153)
|
|
8
|
-
*
|
|
9
|
-
* @param hashValue
|
|
10
|
-
* @param hashField
|
|
11
|
-
*/
|
|
12
|
-
function formatHash(hashValue) {
|
|
13
|
-
if (typeof hashValue === 'string')
|
|
14
|
-
return hashValue;
|
|
15
|
-
return (0, number_1.toHex)((0, number_1.toBN)(hashValue));
|
|
16
|
-
}
|
|
17
|
-
exports.formatHash = formatHash;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L156-L161)
|
|
21
|
-
* @param txHash
|
|
22
|
-
* @param txId
|
|
23
|
-
*/
|
|
24
|
-
function txIdentifier(txHash, txId) {
|
|
25
|
-
if (!txHash) {
|
|
26
|
-
return "transactionId=".concat(JSON.stringify(txId));
|
|
27
|
-
}
|
|
28
|
-
var hashString = formatHash(txHash);
|
|
29
|
-
return "transactionHash=".concat(hashString);
|
|
30
|
-
}
|
|
31
|
-
exports.txIdentifier = txIdentifier;
|
|
32
|
-
var Block = /** @class */ (function () {
|
|
33
|
-
function Block(_identifier) {
|
|
34
|
-
var _this = this;
|
|
35
|
-
this.hash = null;
|
|
36
|
-
this.number = null;
|
|
37
|
-
this.tag = null;
|
|
38
|
-
this.valueOf = function () { return _this.number; };
|
|
39
|
-
this.toString = function () { return _this.hash; };
|
|
40
|
-
this.setIdentifier = function (__identifier) {
|
|
41
|
-
if (typeof __identifier === 'string' && (0, number_1.isHex)(__identifier)) {
|
|
42
|
-
this.hash = __identifier;
|
|
43
|
-
}
|
|
44
|
-
else if (typeof __identifier === 'number') {
|
|
45
|
-
this.number = __identifier;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.tag = __identifier;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
this.setIdentifier(_identifier);
|
|
52
|
-
}
|
|
53
|
-
Object.defineProperty(Block.prototype, "queryIdentifier", {
|
|
54
|
-
get: function () {
|
|
55
|
-
if (this.number !== null) {
|
|
56
|
-
return "blockNumber=".concat(this.number);
|
|
57
|
-
}
|
|
58
|
-
if (this.hash !== null) {
|
|
59
|
-
return "blockHash=".concat(this.hash);
|
|
60
|
-
}
|
|
61
|
-
return "blockNumber=".concat(this.tag);
|
|
62
|
-
},
|
|
63
|
-
enumerable: false,
|
|
64
|
-
configurable: true
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(Block.prototype, "identifier", {
|
|
67
|
-
get: function () {
|
|
68
|
-
if (this.number !== null) {
|
|
69
|
-
return { block_number: this.number };
|
|
70
|
-
}
|
|
71
|
-
if (this.hash !== null) {
|
|
72
|
-
return { block_hash: this.hash };
|
|
73
|
-
}
|
|
74
|
-
return this.tag;
|
|
75
|
-
},
|
|
76
|
-
set: function (_identifier) {
|
|
77
|
-
this.setIdentifier(_identifier);
|
|
78
|
-
},
|
|
79
|
-
enumerable: false,
|
|
80
|
-
configurable: true
|
|
81
|
-
});
|
|
82
|
-
return Block;
|
|
83
|
-
}());
|
|
84
|
-
exports.Block = Block;
|
package/signer/default.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Abi, Call, DeclareSignerDetails, InvocationsSignerDetails, KeyPair, Signature } from '../types';
|
|
2
|
-
import { DeployAccountSignerDetails } from '../types/signer';
|
|
3
|
-
import { TypedData } from '../utils/typedData';
|
|
4
|
-
import { SignerInterface } from './interface';
|
|
5
|
-
export declare class Signer implements SignerInterface {
|
|
6
|
-
protected keyPair: KeyPair;
|
|
7
|
-
constructor(keyPair?: KeyPair);
|
|
8
|
-
getPubKey(): Promise<string>;
|
|
9
|
-
signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
|
|
10
|
-
signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
|
|
11
|
-
signDeployAccountTransaction({ classHash, contractAddress, constructorCalldata, addressSalt, maxFee, version, chainId, nonce, }: DeployAccountSignerDetails): Promise<Signature>;
|
|
12
|
-
signDeclareTransaction({ classHash, senderAddress, chainId, maxFee, version, nonce }: DeclareSignerDetails): Promise<Signature>;
|
|
13
|
-
}
|
package/signer/default.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Signer = void 0;
|
|
40
|
-
var ellipticCurve_1 = require("../utils/ellipticCurve");
|
|
41
|
-
var hash_1 = require("../utils/hash");
|
|
42
|
-
var transaction_1 = require("../utils/transaction");
|
|
43
|
-
var typedData_1 = require("../utils/typedData");
|
|
44
|
-
var Signer = /** @class */ (function () {
|
|
45
|
-
function Signer(keyPair) {
|
|
46
|
-
if (keyPair === void 0) { keyPair = (0, ellipticCurve_1.genKeyPair)(); }
|
|
47
|
-
this.keyPair = keyPair;
|
|
48
|
-
}
|
|
49
|
-
Signer.prototype.getPubKey = function () {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
return __generator(this, function (_a) {
|
|
52
|
-
return [2 /*return*/, (0, ellipticCurve_1.getStarkKey)(this.keyPair)];
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
Signer.prototype.signMessage = function (typedData, accountAddress) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var msgHash;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
msgHash = (0, typedData_1.getMessageHash)(typedData, accountAddress);
|
|
61
|
-
return [2 /*return*/, (0, ellipticCurve_1.sign)(this.keyPair, msgHash)];
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
Signer.prototype.signTransaction = function (transactions, transactionsDetail, abis) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var calldata, msgHash;
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
if (abis && abis.length !== transactions.length) {
|
|
70
|
-
throw new Error('ABI must be provided for each transaction or no transaction');
|
|
71
|
-
}
|
|
72
|
-
calldata = (0, transaction_1.fromCallsToExecuteCalldata)(transactions);
|
|
73
|
-
msgHash = (0, hash_1.calculateTransactionHash)(transactionsDetail.walletAddress, transactionsDetail.version, calldata, transactionsDetail.maxFee, transactionsDetail.chainId, transactionsDetail.nonce);
|
|
74
|
-
return [2 /*return*/, (0, ellipticCurve_1.sign)(this.keyPair, msgHash)];
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
Signer.prototype.signDeployAccountTransaction = function (_a) {
|
|
79
|
-
var classHash = _a.classHash, contractAddress = _a.contractAddress, constructorCalldata = _a.constructorCalldata, addressSalt = _a.addressSalt, maxFee = _a.maxFee, version = _a.version, chainId = _a.chainId, nonce = _a.nonce;
|
|
80
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var msgHash;
|
|
82
|
-
return __generator(this, function (_b) {
|
|
83
|
-
msgHash = (0, hash_1.calculateDeployAccountTransactionHash)(contractAddress, classHash, constructorCalldata, addressSalt, version, maxFee, chainId, nonce);
|
|
84
|
-
return [2 /*return*/, (0, ellipticCurve_1.sign)(this.keyPair, msgHash)];
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
Signer.prototype.signDeclareTransaction = function (
|
|
89
|
-
// contractClass: ContractClass, // Should be used once class hash is present in ContractClass
|
|
90
|
-
_a) {
|
|
91
|
-
var classHash = _a.classHash, senderAddress = _a.senderAddress, chainId = _a.chainId, maxFee = _a.maxFee, version = _a.version, nonce = _a.nonce;
|
|
92
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var msgHash;
|
|
94
|
-
return __generator(this, function (_b) {
|
|
95
|
-
msgHash = (0, hash_1.calculateDeclareTransactionHash)(classHash, senderAddress, version, maxFee, chainId, nonce);
|
|
96
|
-
return [2 /*return*/, (0, ellipticCurve_1.sign)(this.keyPair, msgHash)];
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
return Signer;
|
|
101
|
-
}());
|
|
102
|
-
exports.Signer = Signer;
|
package/signer/index.d.ts
DELETED
package/signer/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./interface"), exports);
|
|
18
|
-
__exportStar(require("./default"), exports);
|
package/signer/interface.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Abi, Call, DeclareSignerDetails, InvocationsSignerDetails, Signature } from '../types';
|
|
2
|
-
import { DeployAccountSignerDetails } from '../types/signer';
|
|
3
|
-
import { TypedData } from '../utils/typedData';
|
|
4
|
-
export declare abstract class SignerInterface {
|
|
5
|
-
/**
|
|
6
|
-
* Method to get the public key of the signer
|
|
7
|
-
*
|
|
8
|
-
* @returns public key of signer as hex string with 0x prefix
|
|
9
|
-
*/
|
|
10
|
-
abstract getPubKey(): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
|
|
13
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
14
|
-
*
|
|
15
|
-
* @param typedData - JSON object to be signed
|
|
16
|
-
* @param accountAddress - account
|
|
17
|
-
* @returns the signature of the JSON object
|
|
18
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
19
|
-
*/
|
|
20
|
-
abstract signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
|
|
21
|
-
/**
|
|
22
|
-
* Signs a transaction with the starknet private key and returns the signature
|
|
23
|
-
*
|
|
24
|
-
* @param invocation the invocation object containing:
|
|
25
|
-
* - contractAddress - the address of the contract
|
|
26
|
-
* - entrypoint - the entrypoint of the contract
|
|
27
|
-
* - calldata - (defaults to []) the calldata
|
|
28
|
-
* @param abi (optional) the abi of the contract for better displaying
|
|
29
|
-
*
|
|
30
|
-
* @returns signature
|
|
31
|
-
*/
|
|
32
|
-
abstract signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
|
|
33
|
-
/**
|
|
34
|
-
* Signs a DEPLOY_ACCOUNT transaction with the starknet private key and returns the signature
|
|
35
|
-
*
|
|
36
|
-
* @param transaction
|
|
37
|
-
* - contractAddress - the computed address of the contract
|
|
38
|
-
* - constructorCalldata - calldata to be passed in deploy constructor
|
|
39
|
-
* - addressSalt - contract address salt
|
|
40
|
-
* - chainId - the chainId to declare contract on
|
|
41
|
-
* - maxFee - maxFee for the declare transaction
|
|
42
|
-
* - version - transaction version
|
|
43
|
-
* - nonce - Nonce of the declare transaction
|
|
44
|
-
* @returns signature
|
|
45
|
-
*/
|
|
46
|
-
abstract signDeployAccountTransaction(transaction: DeployAccountSignerDetails): Promise<Signature>;
|
|
47
|
-
/**
|
|
48
|
-
* Signs a DECLARE transaction with the starknet private key and returns the signature
|
|
49
|
-
*
|
|
50
|
-
* @param transaction
|
|
51
|
-
* - classHash - computed class hash. Will be replaced by ContractClass in future once class hash is present in CompiledContract
|
|
52
|
-
* - senderAddress - the address of the sender
|
|
53
|
-
* - chainId - the chainId to declare contract on
|
|
54
|
-
* - maxFee - maxFee for the declare transaction
|
|
55
|
-
* - version - transaction version
|
|
56
|
-
* - nonce - Nonce of the declare transaction
|
|
57
|
-
* @returns signature
|
|
58
|
-
*/
|
|
59
|
-
abstract signDeclareTransaction(transaction: DeclareSignerDetails): Promise<Signature>;
|
|
60
|
-
}
|
package/signer/interface.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SignerInterface = void 0;
|
|
4
|
-
var SignerInterface = /** @class */ (function () {
|
|
5
|
-
function SignerInterface() {
|
|
6
|
-
}
|
|
7
|
-
return SignerInterface;
|
|
8
|
-
}());
|
|
9
|
-
exports.SignerInterface = SignerInterface;
|
package/types/account.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import BN from 'bn.js';
|
|
2
|
-
import { BlockIdentifier } from '../provider/utils';
|
|
3
|
-
import { BigNumberish } from '../utils/number';
|
|
4
|
-
import { EstimateFeeResponse } from './provider';
|
|
5
|
-
export interface EstimateFee extends EstimateFeeResponse {
|
|
6
|
-
suggestedMaxFee: BN;
|
|
7
|
-
}
|
|
8
|
-
export interface EstimateFeeDetails {
|
|
9
|
-
nonce?: BigNumberish;
|
|
10
|
-
blockIdentifier?: BlockIdentifier;
|
|
11
|
-
}
|
package/types/account.js
DELETED
package/types/api/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BigNumberish } from '../../utils/number';
|
|
2
|
-
import { Signature } from '../lib';
|
|
3
|
-
export declare type Calldata = string[];
|
|
4
|
-
export declare type Overrides = {
|
|
5
|
-
maxFee?: BigNumberish;
|
|
6
|
-
nonce?: BigNumberish;
|
|
7
|
-
signature?: Signature;
|
|
8
|
-
};
|
|
9
|
-
export * from './sequencer';
|
|
10
|
-
export * from './rpc';
|
package/types/api/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./sequencer"), exports);
|
|
18
|
-
__exportStar(require("./rpc"), exports);
|