@taquito/taquito 24.2.0 → 24.3.0-beta.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 (129) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/batch/rpc-batch-provider.js +91 -83
  3. package/dist/lib/context.js +22 -26
  4. package/dist/lib/contract/big-map.js +16 -29
  5. package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
  6. package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
  7. package/dist/lib/contract/contract.js +21 -32
  8. package/dist/lib/contract/errors.js +9 -9
  9. package/dist/lib/contract/prepare.js +36 -45
  10. package/dist/lib/contract/rpc-contract-provider.js +426 -475
  11. package/dist/lib/contract/sapling-state-abstraction.js +3 -14
  12. package/dist/lib/contract/semantic.js +2 -2
  13. package/dist/lib/errors.js +3 -3
  14. package/dist/lib/estimate/errors.js +1 -1
  15. package/dist/lib/estimate/estimate.js +66 -20
  16. package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
  17. package/dist/lib/forger/composite-forger.js +16 -27
  18. package/dist/lib/forger/errors.js +2 -2
  19. package/dist/lib/forger/taquito-local-forger.js +9 -22
  20. package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
  21. package/dist/lib/global-constants/errors.js +2 -2
  22. package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
  23. package/dist/lib/import-key.js +23 -34
  24. package/dist/lib/injector/rpc-injector.js +13 -24
  25. package/dist/lib/operations/ballot-operation.js +2 -3
  26. package/dist/lib/operations/delegate-operation.js +5 -8
  27. package/dist/lib/operations/drain-delegate-operation.js +1 -1
  28. package/dist/lib/operations/errors.js +9 -6
  29. package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
  30. package/dist/lib/operations/operations.js +100 -30
  31. package/dist/lib/operations/origination-operation.js +16 -27
  32. package/dist/lib/operations/proposals-operation.js +2 -3
  33. package/dist/lib/operations/register-global-constant-operation.js +4 -7
  34. package/dist/lib/operations/reveal-operation.js +1 -1
  35. package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
  36. package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
  37. package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
  38. package/dist/lib/operations/transaction-operation.js +2 -2
  39. package/dist/lib/operations/transfer-ticket-operation.js +4 -6
  40. package/dist/lib/operations/types.js +17 -19
  41. package/dist/lib/operations/update-companion-key-operation.js +4 -7
  42. package/dist/lib/operations/update-consensus-key-operation.js +4 -7
  43. package/dist/lib/packer/michel-codec-packer.js +3 -14
  44. package/dist/lib/packer/rpc-packer.js +2 -13
  45. package/dist/lib/parser/michel-codec-parser.js +82 -107
  46. package/dist/lib/parser/noop-parser.js +2 -13
  47. package/dist/lib/prepare/prepare-provider.js +780 -744
  48. package/dist/lib/provider.js +322 -128
  49. package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
  50. package/dist/lib/signer/errors.js +1 -1
  51. package/dist/lib/signer/noop.js +9 -26
  52. package/dist/lib/subscribe/errors.js +2 -2
  53. package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
  54. package/dist/lib/taquito.js +33 -33
  55. package/dist/lib/tz/rpc-tz-provider.js +27 -44
  56. package/dist/lib/version.js +2 -2
  57. package/dist/lib/wallet/batch-operation.js +32 -45
  58. package/dist/lib/wallet/delegation-operation.js +25 -40
  59. package/dist/lib/wallet/errors.js +15 -3
  60. package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
  61. package/dist/lib/wallet/legacy.js +28 -63
  62. package/dist/lib/wallet/operation-factory.js +27 -56
  63. package/dist/lib/wallet/operation.js +123 -59
  64. package/dist/lib/wallet/origination-operation.js +34 -46
  65. package/dist/lib/wallet/register-global-constant-operation.js +26 -43
  66. package/dist/lib/wallet/transaction-operation.js +21 -36
  67. package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
  68. package/dist/lib/wallet/wallet.js +187 -184
  69. package/dist/taquito.es6.js +3424 -3197
  70. package/dist/taquito.es6.js.map +1 -1
  71. package/dist/taquito.min.js +1 -1
  72. package/dist/taquito.umd.js +7930 -7701
  73. package/dist/taquito.umd.js.map +1 -1
  74. package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
  75. package/dist/types/context.d.ts +4 -4
  76. package/dist/types/contract/big-map.d.ts +3 -3
  77. package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
  78. package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
  79. package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
  80. package/dist/types/contract/contract.d.ts +6 -6
  81. package/dist/types/contract/errors.d.ts +11 -11
  82. package/dist/types/contract/interface.d.ts +42 -42
  83. package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
  84. package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
  85. package/dist/types/contract/semantic.d.ts +2 -2
  86. package/dist/types/errors.d.ts +5 -5
  87. package/dist/types/estimate/errors.d.ts +1 -1
  88. package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
  89. package/dist/types/estimate/estimate.d.ts +28 -11
  90. package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
  91. package/dist/types/forger/errors.d.ts +2 -2
  92. package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
  93. package/dist/types/global-constants/errors.d.ts +2 -2
  94. package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
  95. package/dist/types/import-key.d.ts +2 -2
  96. package/dist/types/operations/ballot-operation.d.ts +1 -1
  97. package/dist/types/operations/delegate-operation.d.ts +2 -2
  98. package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
  99. package/dist/types/operations/errors.d.ts +5 -5
  100. package/dist/types/operations/failing-noop-operation.d.ts +1 -1
  101. package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
  102. package/dist/types/operations/operations.d.ts +2 -2
  103. package/dist/types/operations/origination-operation.d.ts +5 -5
  104. package/dist/types/operations/proposals-operation.d.ts +1 -1
  105. package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
  106. package/dist/types/operations/reveal-operation.d.ts +1 -1
  107. package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
  108. package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
  109. package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
  110. package/dist/types/operations/transaction-operation.d.ts +2 -2
  111. package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
  112. package/dist/types/operations/types.d.ts +387 -25
  113. package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
  114. package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
  115. package/dist/types/prepare/interface.d.ts +32 -33
  116. package/dist/types/prepare/prepare-provider.d.ts +34 -60
  117. package/dist/types/provider.d.ts +7 -1
  118. package/dist/types/read-provider/interface.d.ts +21 -21
  119. package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
  120. package/dist/types/signer/errors.d.ts +1 -1
  121. package/dist/types/signer/noop.d.ts +1 -1
  122. package/dist/types/subscribe/errors.d.ts +2 -2
  123. package/dist/types/taquito.d.ts +33 -33
  124. package/dist/types/wallet/errors.d.ts +10 -2
  125. package/dist/types/wallet/interface.d.ts +13 -13
  126. package/dist/types/wallet/operation.d.ts +4 -3
  127. package/dist/types/wallet/wallet.d.ts +36 -35
  128. package/package.json +27 -15
  129. package/LICENSE +0 -202
@@ -1,13 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.MichelCodecParser = void 0;
13
4
  const michel_codec_1 = require("@taquito/michel-codec");
@@ -17,119 +8,103 @@ class MichelCodecParser {
17
8
  constructor(context) {
18
9
  this.context = context;
19
10
  }
20
- getNextProto() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- if (!this.context.proto) {
23
- const nextProto = yield this.context.readProvider.getNextProtocol('head');
24
- this.context.proto = nextProto;
25
- }
26
- return this.context.proto;
27
- });
11
+ async getNextProto() {
12
+ if (!this.context.proto) {
13
+ const nextProto = await this.context.readProvider.getNextProtocol('head');
14
+ this.context.proto = nextProto;
15
+ }
16
+ return this.context.proto;
28
17
  }
29
- parseScript(src) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const parser = new michel_codec_1.Parser({ protocol: yield this.getNextProto() });
32
- return parser.parseScript(src);
33
- });
18
+ async parseScript(src) {
19
+ const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
20
+ return parser.parseScript(src);
34
21
  }
35
- parseMichelineExpression(src) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const parser = new michel_codec_1.Parser({ protocol: yield this.getNextProto() });
38
- return parser.parseMichelineExpression(src);
39
- });
22
+ async parseMichelineExpression(src) {
23
+ const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
24
+ return parser.parseMichelineExpression(src);
40
25
  }
41
- parseJSON(src) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const parser = new michel_codec_1.Parser({ protocol: yield this.getNextProto() });
44
- return parser.parseJSON(src);
45
- });
26
+ async parseJSON(src) {
27
+ const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
28
+ return parser.parseJSON(src);
46
29
  }
47
- prepareCodeOrigination(params) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- const parsedParams = params;
50
- parsedParams.code = yield this.formatCodeParam(params.code);
51
- if (params.init) {
52
- parsedParams.init = yield this.formatInitParam(params.init);
53
- }
54
- else if (params.storage) {
55
- const storageType = parsedParams.code.find((p) => 'prim' in p && p.prim === 'storage');
56
- if (!(storageType === null || storageType === void 0 ? void 0 : storageType.args)) {
57
- throw new errors_1.InvalidCodeParameter('The storage section is missing from the script', params.code);
58
- }
59
- const schema = new michelson_encoder_1.Schema(storageType.args[0]);
60
- const globalconstantsHashAndValue = yield this.findGlobalConstantsHashAndValue(schema);
61
- if (Object.keys(globalconstantsHashAndValue).length !== 0) {
62
- // If there are global constants in the storage part of the contract code,
63
- // they need to be locally expanded in order to encode the storage arguments
64
- const p = new michel_codec_1.Parser({ expandGlobalConstant: globalconstantsHashAndValue });
65
- const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);
66
- const schemaNoGlobalConst = new michelson_encoder_1.Schema(storageTypeNoGlobalConst);
67
- parsedParams.init = schemaNoGlobalConst.Encode(params.storage);
68
- }
69
- else {
70
- parsedParams.init = schema.Encode(params.storage);
71
- }
72
- delete parsedParams.storage;
30
+ async prepareCodeOrigination(params) {
31
+ const parsedParams = params;
32
+ parsedParams.code = await this.formatCodeParam(params.code);
33
+ if (params.init) {
34
+ parsedParams.init = await this.formatInitParam(params.init);
35
+ }
36
+ else if (params.storage) {
37
+ const storageType = parsedParams.code.find((p) => 'prim' in p && p.prim === 'storage');
38
+ if (!storageType?.args) {
39
+ throw new errors_1.InvalidCodeParameter('The storage section is missing from the script', params.code);
73
40
  }
74
- return parsedParams;
75
- });
76
- }
77
- formatCodeParam(code) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- let parsedCode;
80
- if (typeof code === 'string') {
81
- const c = yield this.parseScript(code);
82
- if (c === null) {
83
- throw new errors_1.InvalidCodeParameter('Unable to parse', code);
84
- }
85
- parsedCode = c;
41
+ const schema = new michelson_encoder_1.Schema(storageType.args[0]);
42
+ const globalconstantsHashAndValue = await this.findGlobalConstantsHashAndValue(schema);
43
+ if (Object.keys(globalconstantsHashAndValue).length !== 0) {
44
+ // If there are global constants in the storage part of the contract code,
45
+ // they need to be locally expanded in order to encode the storage arguments
46
+ const p = new michel_codec_1.Parser({ expandGlobalConstant: globalconstantsHashAndValue });
47
+ const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);
48
+ const schemaNoGlobalConst = new michelson_encoder_1.Schema(storageTypeNoGlobalConst);
49
+ parsedParams.init = schemaNoGlobalConst.Encode(params.storage);
86
50
  }
87
51
  else {
88
- const c = yield this.parseJSON(code);
89
- const order = ['parameter', 'storage', 'code'];
90
- // Ensure correct ordering for RPC
91
- parsedCode = c.sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));
52
+ parsedParams.init = schema.Encode(params.storage);
92
53
  }
93
- return parsedCode;
94
- });
54
+ delete parsedParams.storage;
55
+ }
56
+ return parsedParams;
95
57
  }
96
- formatInitParam(init) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- let parsedInit;
99
- if (typeof init === 'string') {
100
- const c = yield this.parseMichelineExpression(init);
101
- if (c === null) {
102
- throw new errors_1.InvalidInitParameter('Invalid init parameter', init);
103
- }
104
- parsedInit = c;
58
+ async formatCodeParam(code) {
59
+ let parsedCode;
60
+ if (typeof code === 'string') {
61
+ const c = await this.parseScript(code);
62
+ if (c === null) {
63
+ throw new errors_1.InvalidCodeParameter('Unable to parse', code);
105
64
  }
106
- else {
107
- parsedInit = yield this.parseJSON(init);
65
+ parsedCode = c;
66
+ }
67
+ else {
68
+ const c = await this.parseJSON(code);
69
+ const order = ['parameter', 'storage', 'code'];
70
+ // Ensure correct ordering for RPC
71
+ parsedCode = c.sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));
72
+ }
73
+ return parsedCode;
74
+ }
75
+ async formatInitParam(init) {
76
+ let parsedInit;
77
+ if (typeof init === 'string') {
78
+ const c = await this.parseMichelineExpression(init);
79
+ if (c === null) {
80
+ throw new errors_1.InvalidInitParameter('Invalid init parameter', init);
108
81
  }
109
- return parsedInit;
110
- });
82
+ parsedInit = c;
83
+ }
84
+ else {
85
+ parsedInit = await this.parseJSON(init);
86
+ }
87
+ return parsedInit;
111
88
  }
112
- findGlobalConstantsHashAndValue(schema) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const globalConstantTokens = schema.findToken('constant');
115
- const globalConstantsHashAndValue = {};
116
- if (globalConstantTokens.length !== 0) {
117
- for (const token of globalConstantTokens) {
118
- const tokenArgs = token.tokenVal.args;
119
- if (tokenArgs) {
120
- const expression = tokenArgs[0];
121
- if (expression.string) {
122
- const hash = expression.string;
123
- const michelineValue = yield this.context.globalConstantsProvider.getGlobalConstantByHash(hash);
124
- Object.assign(globalConstantsHashAndValue, {
125
- [hash]: michelineValue,
126
- });
127
- }
89
+ async findGlobalConstantsHashAndValue(schema) {
90
+ const globalConstantTokens = schema.findToken('constant');
91
+ const globalConstantsHashAndValue = {};
92
+ if (globalConstantTokens.length !== 0) {
93
+ for (const token of globalConstantTokens) {
94
+ const tokenArgs = token.tokenVal.args;
95
+ if (tokenArgs) {
96
+ const expression = tokenArgs[0];
97
+ if (expression.string) {
98
+ const hash = expression.string;
99
+ const michelineValue = await this.context.globalConstantsProvider.getGlobalConstantByHash(hash);
100
+ Object.assign(globalConstantsHashAndValue, {
101
+ [hash]: michelineValue,
102
+ });
128
103
  }
129
104
  }
130
105
  }
131
- return globalConstantsHashAndValue;
132
- });
106
+ }
107
+ return globalConstantsHashAndValue;
133
108
  }
134
109
  }
135
110
  exports.MichelCodecParser = MichelCodecParser;
@@ -1,20 +1,9 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.NoopParser = void 0;
13
4
  class NoopParser {
14
- prepareCodeOrigination(params) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- return params;
17
- });
5
+ async prepareCodeOrigination(params) {
6
+ return params;
18
7
  }
19
8
  }
20
9
  exports.NoopParser = NoopParser;