starknet 3.0.0 → 3.3.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/__mocks__/ArgentAccount.json +68548 -51944
  3. package/__mocks__/TestDapp.json +12962 -0
  4. package/__mocks__/contract.json +33191 -0
  5. package/__mocks__/multicall.json +8139 -0
  6. package/__tests__/account.test.ts +63 -49
  7. package/__tests__/accountContract.test.ts +51 -70
  8. package/__tests__/contract.test.ts +182 -35
  9. package/__tests__/fixtures.ts +13 -0
  10. package/__tests__/provider.test.ts +4 -14
  11. package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +2 -2
  12. package/__tests__/utils/__snapshots__/utils.test.ts.snap +2 -2
  13. package/__tests__/utils/ellipticalCurve.test.ts +20 -13
  14. package/__tests__/utils/utils.test.ts +3 -3
  15. package/account/default.d.ts +4 -4
  16. package/account/default.js +43 -92
  17. package/account/interface.d.ts +2 -2
  18. package/contract.d.ts +68 -9
  19. package/contract.js +229 -77
  20. package/dist/account/default.d.ts +3 -3
  21. package/dist/account/default.js +31 -57
  22. package/dist/account/interface.d.ts +2 -2
  23. package/dist/contract.d.ts +68 -6
  24. package/dist/contract.js +207 -55
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/provider/default.d.ts +15 -2
  28. package/dist/provider/default.js +61 -17
  29. package/dist/provider/interface.d.ts +5 -1
  30. package/dist/signer/default.d.ts +1 -1
  31. package/dist/signer/default.js +6 -18
  32. package/dist/signer/interface.d.ts +3 -2
  33. package/dist/types/api.d.ts +12 -0
  34. package/dist/types/lib.d.ts +3 -3
  35. package/dist/utils/ellipticCurve.js +1 -1
  36. package/dist/utils/hash.d.ts +12 -2
  37. package/dist/utils/hash.js +37 -9
  38. package/dist/utils/number.d.ts +1 -0
  39. package/dist/utils/number.js +28 -2
  40. package/dist/utils/stark.d.ts +2 -9
  41. package/dist/utils/stark.js +44 -14
  42. package/dist/utils/transaction.d.ts +19 -0
  43. package/dist/utils/transaction.js +75 -0
  44. package/dist/utils/typedData/index.d.ts +1 -1
  45. package/dist/utils/typedData/index.js +2 -3
  46. package/index.d.ts +1 -0
  47. package/index.js +1 -0
  48. package/package.json +2 -2
  49. package/provider/default.d.ts +20 -1
  50. package/provider/default.js +83 -19
  51. package/provider/interface.d.ts +5 -1
  52. package/signer/default.d.ts +1 -1
  53. package/signer/default.js +10 -44
  54. package/signer/interface.d.ts +3 -2
  55. package/src/account/default.ts +21 -43
  56. package/src/account/interface.ts +2 -2
  57. package/src/contract.ts +232 -62
  58. package/src/index.ts +1 -0
  59. package/src/provider/default.ts +58 -22
  60. package/src/provider/interface.ts +6 -1
  61. package/src/signer/default.ts +10 -26
  62. package/src/signer/interface.ts +3 -2
  63. package/src/types/api.ts +11 -0
  64. package/src/types/lib.ts +3 -4
  65. package/src/utils/ellipticCurve.ts +1 -1
  66. package/src/utils/hash.ts +39 -12
  67. package/src/utils/number.ts +8 -1
  68. package/src/utils/stark.ts +14 -15
  69. package/src/utils/transaction.ts +50 -0
  70. package/src/utils/typedData/index.ts +2 -3
  71. package/types/api.d.ts +15 -0
  72. package/types/lib.d.ts +3 -3
  73. package/utils/ellipticCurve.js +1 -1
  74. package/utils/hash.d.ts +15 -6
  75. package/utils/hash.js +42 -10
  76. package/utils/number.d.ts +1 -0
  77. package/utils/number.js +46 -1
  78. package/utils/stark.d.ts +2 -9
  79. package/utils/stark.js +64 -15
  80. package/utils/transaction.d.ts +19 -0
  81. package/utils/transaction.js +99 -0
  82. package/utils/typedData/index.d.ts +1 -1
  83. package/utils/typedData/index.js +2 -3
@@ -1,7 +1,7 @@
1
1
  import type { ec as EC } from 'elliptic';
2
2
  import type { BigNumberish } from '../utils/number';
3
3
  export declare type KeyPair = EC.KeyPair;
4
- export declare type Signature = BigNumberish[];
4
+ export declare type Signature = string[];
5
5
  export declare type RawCalldata = BigNumberish[];
6
6
  export declare type DeployContractPayload = {
7
7
  contract: CompiledContract | string;
@@ -14,11 +14,11 @@ export declare type Invocation = {
14
14
  calldata?: RawCalldata;
15
15
  signature?: Signature;
16
16
  };
17
- export declare type ExecuteInvocation = Omit<Invocation, 'signature'>;
17
+ export declare type Call = Omit<Invocation, 'signature'>;
18
18
  export declare type InvocationsDetails = {
19
19
  nonce?: BigNumberish;
20
+ maxFee?: BigNumberish;
20
21
  };
21
- export declare type Call = Omit<Invocation, 'signature' | 'nonce'>;
22
22
  export declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
23
23
  export declare type TransactionStatus = 'TRANSACTION_RECEIVED';
24
24
  export declare type Type = 'DEPLOY' | 'INVOKE_FUNCTION';
@@ -93,7 +93,7 @@ function sign(keyPair, msgHash) {
93
93
  (0, number_1.assertInRange)(r, constants_1.ONE, (0, number_1.toBN)((0, encode_1.addHexPrefix)(constants_1.MAX_ECDSA_VAL)), 'r');
94
94
  (0, number_1.assertInRange)(s, constants_1.ONE, (0, number_1.toBN)((0, encode_1.addHexPrefix)(constants_1.EC_ORDER)), 's');
95
95
  (0, number_1.assertInRange)(w, constants_1.ONE, (0, number_1.toBN)((0, encode_1.addHexPrefix)(constants_1.MAX_ECDSA_VAL)), 'w');
96
- return [r, s];
96
+ return [r.toString(), s.toString()];
97
97
  }
98
98
  exports.sign = sign;
99
99
  function chunkArray(arr, n) {
@@ -1,5 +1,8 @@
1
1
  import BN from 'bn.js';
2
+ import { Call } from '../types';
2
3
  import { BigNumberish } from './number';
4
+ export declare const transactionPrefix: string;
5
+ export declare const transactionVersion = 0;
3
6
  /**
4
7
  * Function to get the starknet keccak hash from a string
5
8
  *
@@ -8,7 +11,14 @@ import { BigNumberish } from './number';
8
11
  * @returns starknet keccak hash as BigNumber
9
12
  */
10
13
  export declare function starknetKeccak(value: string): BN;
14
+ /**
15
+ * Function to get the hex selector from a given function name
16
+ *
17
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/public/abi.py#L25-L26)
18
+ * @param funcName - selectors abi function name
19
+ * @returns hex selector of given abi function name
20
+ */
21
+ export declare function getSelectorFromName(funcName: string): string;
11
22
  export declare function pedersen(input: [BigNumberish, BigNumberish]): string;
12
23
  export declare function computeHashOnElements(data: BigNumberish[]): string;
13
- export declare function hashCalldata(calldata: string[]): string;
14
- export declare function hashMessage(account: string, to: string, selector: string, calldata: string[], nonce: string): string;
24
+ export declare function hashMulticall(account: string, transactions: Call[], nonce: string, maxFee: string): string;
@@ -28,13 +28,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.hashMessage = exports.hashCalldata = exports.computeHashOnElements = exports.pedersen = exports.starknetKeccak = void 0;
31
+ exports.hashMulticall = exports.computeHashOnElements = exports.pedersen = exports.getSelectorFromName = exports.starknetKeccak = exports.transactionVersion = exports.transactionPrefix = void 0;
32
32
  var keccak_1 = require("ethereum-cryptography/keccak");
33
33
  var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
34
34
  var constants_1 = require("../constants");
35
35
  var ellipticCurve_1 = require("./ellipticCurve");
36
36
  var encode_1 = require("./encode");
37
37
  var number_1 = require("./number");
38
+ var shortString_1 = require("./shortString");
39
+ exports.transactionPrefix = (0, shortString_1.encodeShortString)('StarkNet Transaction');
40
+ exports.transactionVersion = 0;
38
41
  function keccakHex(value) {
39
42
  return (0, encode_1.addHexPrefix)((0, encode_1.buf2hex)((0, keccak_1.keccak256)((0, encode_1.utf8ToArray)(value))));
40
43
  }
@@ -49,6 +52,18 @@ function starknetKeccak(value) {
49
52
  return (0, number_1.toBN)(keccakHex(value)).and(constants_1.MASK_250);
50
53
  }
51
54
  exports.starknetKeccak = starknetKeccak;
55
+ /**
56
+ * Function to get the hex selector from a given function name
57
+ *
58
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/public/abi.py#L25-L26)
59
+ * @param funcName - selectors abi function name
60
+ * @returns hex selector of given abi function name
61
+ */
62
+ function getSelectorFromName(funcName) {
63
+ // sometimes BigInteger pads the hex string with zeros, which isnt allowed in the starknet api
64
+ return (0, number_1.toHex)(starknetKeccak(funcName));
65
+ }
66
+ exports.getSelectorFromName = getSelectorFromName;
52
67
  var constantPoints = constants_1.CONSTANT_POINTS.map(function (coords) {
53
68
  return ellipticCurve_1.ec.curve.point(coords[0], coords[1]);
54
69
  });
@@ -73,12 +88,25 @@ function computeHashOnElements(data) {
73
88
  return __spreadArray(__spreadArray([], __read(data), false), [data.length], false).reduce(function (x, y) { return pedersen([x, y]); }, 0).toString();
74
89
  }
75
90
  exports.computeHashOnElements = computeHashOnElements;
76
- function hashCalldata(calldata) {
77
- return computeHashOnElements(calldata);
78
- }
79
- exports.hashCalldata = hashCalldata;
80
- function hashMessage(account, to, selector, calldata, nonce) {
81
- var calldataHash = hashCalldata(calldata);
82
- return computeHashOnElements([account, to, selector, calldataHash, nonce]);
91
+ function hashMulticall(account, transactions, nonce, maxFee) {
92
+ var hashArray = transactions
93
+ .map(function (_a) {
94
+ var contractAddress = _a.contractAddress, entrypoint = _a.entrypoint, calldata = _a.calldata;
95
+ return [
96
+ contractAddress,
97
+ getSelectorFromName(entrypoint),
98
+ computeHashOnElements(calldata || []),
99
+ ];
100
+ })
101
+ .map(number_1.bigNumberishArrayToDecimalStringArray)
102
+ .map(computeHashOnElements);
103
+ return computeHashOnElements([
104
+ exports.transactionPrefix,
105
+ account,
106
+ computeHashOnElements(hashArray),
107
+ nonce,
108
+ maxFee,
109
+ exports.transactionVersion,
110
+ ]);
83
111
  }
84
- exports.hashMessage = hashMessage;
112
+ exports.hashMulticall = hashMulticall;
@@ -4,5 +4,6 @@ export declare function isHex(hex: string): boolean;
4
4
  export declare function toBN(number: BigNumberish, base?: number | 'hex'): BN;
5
5
  export declare function toHex(number: BN): string;
6
6
  export declare function hexToDecimalString(hex: string): string;
7
+ export declare function toFelt(num: BigNumberish): string;
7
8
  export declare function assertInRange(input: BigNumberish, lowerBound: BigNumberish, upperBound: BigNumberish, inputName?: string): void;
8
9
  export declare function bigNumberishArrayToDecimalStringArray(rawCalldata: BigNumberish[]): string[];
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
5
24
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
7
- var bn_js_1 = __importDefault(require("bn.js"));
25
+ exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.toFelt = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
26
+ var bn_js_1 = __importStar(require("bn.js"));
8
27
  var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
9
28
  var encode_1 = require("./encode");
10
29
  function isHex(hex) {
@@ -25,6 +44,13 @@ function hexToDecimalString(hex) {
25
44
  return toBN("0x" + hex.replace(/^0x/, '')).toString();
26
45
  }
27
46
  exports.hexToDecimalString = hexToDecimalString;
47
+ function toFelt(num) {
48
+ if ((0, bn_js_1.isBN)(num)) {
49
+ return num.toString();
50
+ }
51
+ return toBN(num).toString();
52
+ }
53
+ exports.toFelt = toFelt;
28
54
  /*
29
55
  Asserts input is equal to or greater then lowerBound and lower then upperBound.
30
56
  Assert message specifies inputName.
@@ -1,4 +1,4 @@
1
- import { CompressedProgram, Program, Signature } from '../types';
1
+ import { Calldata, CompressedProgram, Program, RawArgs, Signature } from '../types';
2
2
  /**
3
3
  * Function to compress compiled cairo program
4
4
  *
@@ -7,14 +7,7 @@ import { CompressedProgram, Program, Signature } from '../types';
7
7
  * @returns Compressed cairo program
8
8
  */
9
9
  export declare function compressProgram(jsonProgram: Program | string): CompressedProgram;
10
- /**
11
- * Function to get the hex selector from a given function name
12
- *
13
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/public/abi.py#L25-L26)
14
- * @param funcName - selectors abi function name
15
- * @returns hex selector of given abi function name
16
- */
17
- export declare function getSelectorFromName(funcName: string): string;
18
10
  export declare function randomAddress(): string;
19
11
  export declare function makeAddress(input: string): string;
20
12
  export declare function formatSignature(sig?: Signature): string[];
13
+ export declare function compileCalldata(args: RawArgs): Calldata;
@@ -1,10 +1,34 @@
1
1
  "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
2
27
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatSignature = exports.makeAddress = exports.randomAddress = exports.getSelectorFromName = exports.compressProgram = void 0;
28
+ exports.compileCalldata = exports.formatSignature = exports.makeAddress = exports.randomAddress = exports.compressProgram = void 0;
4
29
  var pako_1 = require("pako");
5
30
  var ellipticCurve_1 = require("./ellipticCurve");
6
31
  var encode_1 = require("./encode");
7
- var hash_1 = require("./hash");
8
32
  var json_1 = require("./json");
9
33
  var number_1 = require("./number");
10
34
  /**
@@ -20,18 +44,6 @@ function compressProgram(jsonProgram) {
20
44
  return (0, encode_1.btoaUniversal)(compressedProgram);
21
45
  }
22
46
  exports.compressProgram = compressProgram;
23
- /**
24
- * Function to get the hex selector from a given function name
25
- *
26
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/public/abi.py#L25-L26)
27
- * @param funcName - selectors abi function name
28
- * @returns hex selector of given abi function name
29
- */
30
- function getSelectorFromName(funcName) {
31
- // sometimes BigInteger pads the hex string with zeros, which isnt allowed in the starknet api
32
- return (0, number_1.toHex)((0, hash_1.starknetKeccak)(funcName));
33
- }
34
- exports.getSelectorFromName = getSelectorFromName;
35
47
  function randomAddress() {
36
48
  var randomKeyPair = (0, ellipticCurve_1.genKeyPair)();
37
49
  return (0, ellipticCurve_1.getStarkKey)(randomKeyPair);
@@ -52,3 +64,21 @@ function formatSignature(sig) {
52
64
  }
53
65
  }
54
66
  exports.formatSignature = formatSignature;
67
+ function compileCalldata(args) {
68
+ return Object.values(args).flatMap(function (value) {
69
+ if (Array.isArray(value))
70
+ return __spreadArray([(0, number_1.toBN)(value.length).toString()], __read(value.map(function (x) { return (0, number_1.toBN)(x).toString(); })), false);
71
+ if (typeof value === 'object' && 'type' in value)
72
+ return Object.entries(value)
73
+ .filter(function (_a) {
74
+ var _b = __read(_a, 1), k = _b[0];
75
+ return k !== 'type';
76
+ })
77
+ .map(function (_a) {
78
+ var _b = __read(_a, 2), v = _b[1];
79
+ return (0, number_1.toBN)(v).toString();
80
+ });
81
+ return (0, number_1.toBN)(value).toString();
82
+ });
83
+ }
84
+ exports.compileCalldata = compileCalldata;
@@ -0,0 +1,19 @@
1
+ import { ParsedStruct } from '../contract';
2
+ import { Call } from '../types';
3
+ /**
4
+ * Transforms a list of Calls, each with their own calldata, into
5
+ * two arrays: one with the entrypoints, and one with the concatenated calldata.
6
+ * @param calls
7
+ * @returns
8
+ */
9
+ export declare const transformCallsToMulticallArrays: (calls: Call[]) => {
10
+ callArray: ParsedStruct[];
11
+ calldata: string[];
12
+ };
13
+ /**
14
+ * Transforms a list of calls in the full flattened calldata expected
15
+ * by the __execute__ protocol.
16
+ * @param calls
17
+ * @returns
18
+ */
19
+ export declare const fromCallsToExecuteCalldata: (calls: Call[]) => string[];
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.fromCallsToExecuteCalldata = exports.transformCallsToMulticallArrays = void 0;
29
+ var hash_1 = require("./hash");
30
+ var number_1 = require("./number");
31
+ /**
32
+ * Transforms a list of Calls, each with their own calldata, into
33
+ * two arrays: one with the entrypoints, and one with the concatenated calldata.
34
+ * @param calls
35
+ * @returns
36
+ */
37
+ var transformCallsToMulticallArrays = function (calls) {
38
+ var callArray = [];
39
+ var calldata = [];
40
+ calls.forEach(function (call) {
41
+ var data = call.calldata || [];
42
+ callArray.push({
43
+ to: (0, number_1.toBN)(call.contractAddress).toString(10),
44
+ selector: (0, number_1.toBN)((0, hash_1.getSelectorFromName)(call.entrypoint)).toString(10),
45
+ data_offset: calldata.length.toString(),
46
+ data_len: data.length.toString(),
47
+ });
48
+ calldata.push.apply(calldata, __spreadArray([], __read(data), false));
49
+ });
50
+ return {
51
+ callArray: callArray,
52
+ calldata: (0, number_1.bigNumberishArrayToDecimalStringArray)(calldata),
53
+ };
54
+ };
55
+ exports.transformCallsToMulticallArrays = transformCallsToMulticallArrays;
56
+ /**
57
+ * Transforms a list of calls in the full flattened calldata expected
58
+ * by the __execute__ protocol.
59
+ * @param calls
60
+ * @returns
61
+ */
62
+ var fromCallsToExecuteCalldata = function (calls) {
63
+ var _a = (0, exports.transformCallsToMulticallArrays)(calls), callArray = _a.callArray, calldata = _a.calldata;
64
+ return __spreadArray(__spreadArray(__spreadArray([
65
+ callArray.length.toString()
66
+ ], __read(callArray
67
+ .map(function (_a) {
68
+ var to = _a.to, selector = _a.selector, data_offset = _a.data_offset, data_len = _a.data_len;
69
+ return [to, selector, data_offset, data_len];
70
+ })
71
+ .flat()), false), [
72
+ calldata.length.toString()
73
+ ], false), __read(calldata), false);
74
+ };
75
+ exports.fromCallsToExecuteCalldata = fromCallsToExecuteCalldata;
@@ -85,7 +85,7 @@ export declare const getStructHash: <T extends {
85
85
  * with Keccak256.
86
86
  *
87
87
  * @param {TypedData} typedData
88
- * @param {boolean} hash
88
+ * @param {BigNumberish} account
89
89
  * @return {string}
90
90
  */
91
91
  export declare const getMessageHash: (typedData: TypedData, account: BigNumberish) => string;
@@ -39,7 +39,6 @@ exports.getMessageHash = exports.getStructHash = exports.encodeData = exports.ge
39
39
  var hash_1 = require("../hash");
40
40
  var number_1 = require("../number");
41
41
  var shortString_1 = require("../shortString");
42
- var stark_1 = require("../stark");
43
42
  var utils_1 = require("./utils");
44
43
  __exportStar(require("./types"), exports);
45
44
  function getHex(value) {
@@ -104,7 +103,7 @@ exports.encodeType = encodeType;
104
103
  * @return {string}
105
104
  */
106
105
  var getTypeHash = function (typedData, type) {
107
- return (0, stark_1.getSelectorFromName)((0, exports.encodeType)(typedData, type));
106
+ return (0, hash_1.getSelectorFromName)((0, exports.encodeType)(typedData, type));
108
107
  };
109
108
  exports.getTypeHash = getTypeHash;
110
109
  /**
@@ -168,7 +167,7 @@ exports.getStructHash = getStructHash;
168
167
  * with Keccak256.
169
168
  *
170
169
  * @param {TypedData} typedData
171
- * @param {boolean} hash
170
+ * @param {BigNumberish} account
172
171
  * @return {string}
173
172
  */
174
173
  var getMessageHash = function (typedData, account) {
package/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './types';
5
5
  export * from './contract';
6
6
  export * from './provider';
7
7
  export * from './account';
8
+ export * from './signer';
8
9
  /**
9
10
  * Utils
10
11
  */
package/index.js CHANGED
@@ -62,6 +62,7 @@ __exportStar(require('./types'), exports);
62
62
  __exportStar(require('./contract'), exports);
63
63
  __exportStar(require('./provider'), exports);
64
64
  __exportStar(require('./account'), exports);
65
+ __exportStar(require('./signer'), exports);
65
66
  /**
66
67
  * Utils
67
68
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.0.0",
3
+ "version": "3.3.0",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "zk",
24
24
  "rollup"
25
25
  ],
26
- "repository": "github:seanjameshan/starknet.js",
26
+ "repository": "github:0xs34n/starknet.js",
27
27
  "author": "Sean Han",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
@@ -11,6 +11,7 @@ import {
11
11
  GetTransactionResponse,
12
12
  GetTransactionStatusResponse,
13
13
  Invocation,
14
+ Signature,
14
15
  TransactionReceipt,
15
16
  } from '../types';
16
17
  import { BigNumberish } from '../utils/number';
@@ -146,6 +147,15 @@ export declare class Provider implements ProviderInterface {
146
147
  * @returns a confirmation of sending a transaction on the starknet contract
147
148
  */
148
149
  deployContract(payload: DeployContractPayload, _abi?: Abi): Promise<AddTransactionResponse>;
150
+ /**
151
+ * Invokes a function on starknet
152
+ * @deprecated This method wont be supported as soon as fees are mandatory
153
+ *
154
+ * @param invocation
155
+ * @param _abi - (optional) signature to send along
156
+ * @returns response from addTransaction
157
+ */
158
+ invokeFunction(invocation: Invocation, _abi?: Abi): Promise<AddTransactionResponse>;
149
159
  /**
150
160
  * Invokes a function on starknet
151
161
  * @deprecated This method wont be supported as soon as fees are mandatory
@@ -156,7 +166,16 @@ export declare class Provider implements ProviderInterface {
156
166
  * @param signature - (optional) signature to send along
157
167
  * @returns response from addTransaction
158
168
  */
159
- invokeFunction(invocation: Invocation, _abi?: Abi): Promise<AddTransactionResponse>;
169
+ LEGACY_invokeFunction(
170
+ contractAddress: string,
171
+ entrypointSelector: string,
172
+ calldata?: string[],
173
+ signature?: Signature
174
+ ): Promise<AddTransactionResponse>;
175
+ waitForTransaction(txHash: BigNumberish, retryInterval?: number): Promise<void>;
176
+ /**
177
+ * @deprecated use `waitForTransaction` instead
178
+ */
160
179
  waitForTx(txHash: BigNumberish, retryInterval?: number): Promise<void>;
161
180
  }
162
181
  export {};