@taquito/taquito 23.0.3 → 24.0.0-RC.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 (65) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/batch/constants.js +16 -0
  3. package/dist/lib/batch/rpc-batch-provider.js +5 -9
  4. package/dist/lib/constants.js +5 -32
  5. package/dist/lib/contract/constants.js +4 -0
  6. package/dist/lib/contract/contract-methods/contract-method-factory.js +0 -4
  7. package/dist/lib/contract/contract-methods/contract-method-object-param.js +13 -8
  8. package/dist/lib/contract/contract.js +9 -32
  9. package/dist/lib/contract/index.js +0 -1
  10. package/dist/lib/contract/rpc-contract-provider.js +6 -39
  11. package/dist/lib/estimate/rpc-estimate-provider.js +6 -6
  12. package/dist/lib/import-key.js +51 -0
  13. package/dist/lib/operations/batch-operation.js +2 -2
  14. package/dist/lib/operations/transfer-ticket-operation.js +1 -1
  15. package/dist/lib/prepare/prepare-provider.js +6 -6
  16. package/dist/lib/provider.js +0 -9
  17. package/dist/lib/subscribe/polling-subcribe-provider.js +3 -3
  18. package/dist/lib/taquito.js +3 -2
  19. package/dist/lib/version.js +2 -2
  20. package/dist/lib/wallet/batch-operation.js +11 -3
  21. package/dist/lib/wallet/index.js +1 -0
  22. package/dist/lib/wallet/legacy.js +5 -0
  23. package/dist/lib/wallet/operation-factory.js +6 -0
  24. package/dist/lib/wallet/register-global-constant-operation.js +62 -0
  25. package/dist/lib/wallet/wallet.js +31 -10
  26. package/dist/taquito.es6.js +3399 -3442
  27. package/dist/taquito.es6.js.map +1 -1
  28. package/dist/taquito.min.js +1 -1
  29. package/dist/taquito.min.js.LICENSE.txt +2 -0
  30. package/dist/taquito.umd.js +3391 -3437
  31. package/dist/taquito.umd.js.map +1 -1
  32. package/dist/types/batch/constants.d.ts +3 -0
  33. package/dist/types/batch/rpc-batch-provider.d.ts +2 -5
  34. package/dist/types/constants.d.ts +4 -31
  35. package/dist/types/contract/constants.d.ts +1 -0
  36. package/dist/types/contract/contract-methods/contract-method-factory.d.ts +2 -4
  37. package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +4 -3
  38. package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +2 -2
  39. package/dist/types/contract/contract.d.ts +4 -23
  40. package/dist/types/contract/index.d.ts +0 -1
  41. package/dist/types/contract/interface.d.ts +0 -13
  42. package/dist/types/contract/rpc-contract-provider.d.ts +0 -13
  43. package/dist/types/estimate/estimate-provider-interface.d.ts +2 -2
  44. package/dist/types/estimate/rpc-estimate-provider.d.ts +2 -2
  45. package/dist/types/import-key.d.ts +13 -0
  46. package/dist/types/operations/transfer-ticket-operation.d.ts +1 -1
  47. package/dist/types/operations/types.d.ts +7 -2
  48. package/dist/types/prepare/interface.d.ts +2 -3
  49. package/dist/types/prepare/prepare-provider.d.ts +1 -2
  50. package/dist/types/provider.d.ts +1 -6
  51. package/dist/types/taquito.d.ts +1 -6
  52. package/dist/types/wallet/batch-operation.d.ts +2 -1
  53. package/dist/types/wallet/index.d.ts +1 -0
  54. package/dist/types/wallet/interface.d.ts +7 -2
  55. package/dist/types/wallet/legacy.d.ts +2 -1
  56. package/dist/types/wallet/operation-factory.d.ts +2 -0
  57. package/dist/types/wallet/register-global-constant-operation.d.ts +13 -0
  58. package/dist/types/wallet/wallet.d.ts +20 -11
  59. package/package.json +13 -11
  60. package/dist/400.taquito.min.js +0 -1
  61. package/dist/993.taquito.min.js +0 -1
  62. package/dist/lib/contract/contract-methods/contract-method-flat-param.js +0 -92
  63. package/dist/lib/contract/lambda-view.js +0 -253
  64. package/dist/types/contract/contract-methods/contract-method-flat-param.d.ts +0 -43
  65. package/dist/types/contract/lambda-view.d.ts +0 -19
@@ -65,6 +65,11 @@ class LegacyWalletProvider {
65
65
  return (0, types_1.attachKind)(yield params(), types_1.OpKind.TRANSFER_TICKET);
66
66
  });
67
67
  }
68
+ mapRegisterGlobalConstantParamsToWalletParams(params) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ return (0, types_1.attachKind)(yield params(), types_1.OpKind.REGISTER_GLOBAL_CONSTANT);
71
+ });
72
+ }
68
73
  sendOperations(params) {
69
74
  return __awaiter(this, void 0, void 0, function* () {
70
75
  const op = yield this.context.batch.batch(params).send();
@@ -22,6 +22,7 @@ const origination_operation_1 = require("./origination-operation");
22
22
  const transaction_operation_1 = require("./transaction-operation");
23
23
  const transfer_ticket_operation_1 = require("./transfer-ticket-operation");
24
24
  const errors_1 = require("../errors");
25
+ const register_global_constant_operation_1 = require("./register-global-constant-operation");
25
26
  function timeoutAfter(timeoutMillisec) {
26
27
  return function inner(source) {
27
28
  return new rxjs_1.BehaviorSubject(null).pipe((0, operators_1.timeout)({
@@ -107,5 +108,10 @@ class OperationFactory {
107
108
  return new increase_paid_storage_operation_1.IncreasePaidStorageWalletOperation(hash, this.context.clone(), yield this.createHeadObservableFromConfig(config));
108
109
  });
109
110
  }
111
+ createRegisterGlobalConstantOperation(hash_1) {
112
+ return __awaiter(this, arguments, void 0, function* (hash, config = {}) {
113
+ return new register_global_constant_operation_1.RegisterGlobalConstantWalletOperation(hash, this.context.clone(), yield this.createHeadObservableFromConfig(config));
114
+ });
115
+ }
110
116
  }
111
117
  exports.OperationFactory = OperationFactory;
@@ -0,0 +1,62 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RegisterGlobalConstantWalletOperation = void 0;
13
+ const rpc_1 = require("@taquito/rpc");
14
+ const types_1 = require("../operations/types");
15
+ const operation_1 = require("./operation");
16
+ const errors_1 = require("./errors");
17
+ class RegisterGlobalConstantWalletOperation extends operation_1.WalletOperation {
18
+ constructor(opHash, context, newHead$) {
19
+ super(opHash, context, newHead$);
20
+ this.opHash = opHash;
21
+ this.context = context;
22
+ }
23
+ revealOperation() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const operationResult = yield this.operationResults();
26
+ if (!operationResult) {
27
+ throw new errors_1.ObservableError('operationResult returned undefined');
28
+ }
29
+ return operationResult.find((x) => x.kind === rpc_1.OpKind.REVEAL);
30
+ });
31
+ }
32
+ registerGlobalConstantOperation() {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const operationResult = yield this.operationResults();
35
+ if (operationResult) {
36
+ return (0, types_1.findWithKind)(operationResult, rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT);
37
+ }
38
+ else {
39
+ throw new errors_1.ObservableError('Unable to fetch operation result');
40
+ }
41
+ });
42
+ }
43
+ status() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (!this._included) {
46
+ return 'pending';
47
+ }
48
+ const op = yield this.registerGlobalConstantOperation();
49
+ if (!op) {
50
+ return 'unknown';
51
+ }
52
+ return op.metadata.operation_result.status;
53
+ });
54
+ }
55
+ globalConstantHash() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const op = yield this.registerGlobalConstantOperation();
58
+ return op === null || op === void 0 ? void 0 : op.metadata.operation_result.global_address;
59
+ });
60
+ }
61
+ }
62
+ exports.RegisterGlobalConstantWalletOperation = RegisterGlobalConstantWalletOperation;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Wallet = exports.WalletOperationBatch = void 0;
13
- const contract_1 = require("../contract");
13
+ const contract_1 = require("../contract/contract");
14
14
  const types_1 = require("../operations/types");
15
15
  const core_1 = require("@taquito/core");
16
16
  const utils_1 = require("@taquito/utils");
@@ -85,6 +85,14 @@ class WalletOperationBatch {
85
85
  this.operations.push(Object.assign({ kind: types_1.OpKind.TRANSFER_TICKET }, params));
86
86
  return this;
87
87
  }
88
+ /**
89
+ * @description Add a RegisterGlobalConstant operation to the batch
90
+ * @param param RegisterGlobalConstant operation parameter
91
+ */
92
+ withRegisterGlobalConstant(params) {
93
+ this.operations.push(Object.assign({ kind: types_1.OpKind.REGISTER_GLOBAL_CONSTANT }, params));
94
+ return this;
95
+ }
88
96
  mapOperation(param) {
89
97
  return __awaiter(this, void 0, void 0, function* () {
90
98
  switch (param.kind) {
@@ -98,6 +106,10 @@ class WalletOperationBatch {
98
106
  return this.walletProvider.mapDelegateParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return param; }));
99
107
  case types_1.OpKind.INCREASE_PAID_STORAGE:
100
108
  return this.walletProvider.mapIncreasePaidStorageWalletParams(() => __awaiter(this, void 0, void 0, function* () { return param; }));
109
+ case types_1.OpKind.REGISTER_GLOBAL_CONSTANT:
110
+ return this.walletProvider.mapRegisterGlobalConstantParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return param; }));
111
+ case types_1.OpKind.TRANSFER_TICKET:
112
+ return this.walletProvider.mapTransferTicketParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return param; }));
101
113
  default:
102
114
  throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind));
103
115
  }
@@ -123,6 +135,12 @@ class WalletOperationBatch {
123
135
  case types_1.OpKind.INCREASE_PAID_STORAGE:
124
136
  this.withIncreasePaidStorage(param);
125
137
  break;
138
+ case types_1.OpKind.REGISTER_GLOBAL_CONSTANT:
139
+ this.withRegisterGlobalConstant(param);
140
+ break;
141
+ case types_1.OpKind.TRANSFER_TICKET:
142
+ this.withTransferTicket(param);
143
+ break;
126
144
  default:
127
145
  throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind));
128
146
  }
@@ -376,6 +394,18 @@ class Wallet {
376
394
  return this.context.operationFactory.createIncreasePaidStorageOperation(opHash);
377
395
  }));
378
396
  }
397
+ /**
398
+ * @description Register a Micheline expression in a global table of constants.
399
+ * @returns a RegisterGlobalConstantWalletOperation promise object when followed by .send()
400
+ * @param params operation parameter
401
+ */
402
+ registerGlobalConstant(params) {
403
+ return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
404
+ const mappedParams = yield this.walletProvider.mapRegisterGlobalConstantParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
405
+ const opHash = yield this.walletProvider.sendOperations([mappedParams]);
406
+ return this.context.operationFactory.createRegisterGlobalConstantOperation(opHash);
407
+ }));
408
+ }
379
409
  /**
380
410
  * @description Create a batch of operation
381
411
  * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch
@@ -408,14 +438,5 @@ class Wallet {
408
438
  return contractAbstractionComposer(abs, this.context);
409
439
  });
410
440
  }
411
- /**
412
- * @deprecated Deprecated in favor of {@link Wallet.pk} will be removed in v19.1
413
- * @description Retrieve the PK of the account that is currently in use by the wallet
414
- */
415
- getPK() {
416
- return __awaiter(this, void 0, void 0, function* () {
417
- return yield this.pk();
418
- });
419
- }
420
441
  }
421
442
  exports.Wallet = Wallet;