@taquito/rpc 10.2.1 → 11.0.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.
@@ -5,9 +5,9 @@
5
5
  import { HttpBackend } from '@taquito/http-utils';
6
6
  import BigNumber from 'bignumber.js';
7
7
  import { RpcClientInterface, RPCOptions } from './rpc-client-interface';
8
- import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, BallotListResponse, BallotsResponse, BigMapGetResponse, BigMapKey, BigMapResponse, BlockHeaderResponse, BlockMetadata, BlockResponse, ConstantsResponse, ContractResponse, CurrentProposalResponse, CurrentQuorumResponse, DelegateResponse, DelegatesResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, OperationHash, PackDataParams, PeriodKindResponse, PreapplyParams, PreapplyResponse, ProposalsResponse, RPCRunCodeParam, RPCRunOperationParam, RunCodeResult, SaplingDiffResponse, ScriptResponse, StorageResponse, VotesListingsResponse, VotingPeriodBlockResult } from './types';
8
+ import { BakingRightsQueryArguments, BakingRightsResponse, BalanceResponse, BallotListResponse, BallotsResponse, BigMapGetResponse, BigMapKey, BigMapResponse, BlockHeaderResponse, BlockMetadata, BlockResponse, ConstantsResponse, ContractResponse, CurrentProposalResponse, CurrentQuorumResponse, DelegateResponse, DelegatesResponse, EndorsingRightsQueryArguments, EndorsingRightsResponse, EntrypointsResponse, ForgeOperationsParams, ManagerKeyResponse, OperationHash, PackDataParams, PeriodKindResponse, PreapplyParams, PreapplyResponse, ProposalsResponse, RPCRunCodeParam, RPCRunOperationParam, RunCodeResult, SaplingDiffResponse, ScriptResponse, StorageResponse, UnparsingMode, VotesListingsResponse, VotingPeriodBlockResult } from './types';
9
9
  export { castToBigNumber } from './utils/utils';
10
- export { RPCOptions, defaultChain, defaultRPCOptions, RpcClientInterface } from './rpc-client-interface';
10
+ export { RPCOptions, defaultChain, defaultRPCOptions, RpcClientInterface, } from './rpc-client-interface';
11
11
  export { RpcClientCache } from './rpc-client-modules/rpc-cache';
12
12
  export * from './types';
13
13
  export { OpKind } from './opkind';
@@ -82,6 +82,18 @@ export declare class RpcClient implements RpcClientInterface {
82
82
  getScript(address: string, { block }?: {
83
83
  block: string;
84
84
  }): Promise<ScriptResponse>;
85
+ /**
86
+ *
87
+ * @param address contract address from which we want to retrieve the script
88
+ * @param unparsingMode default is { unparsing_mode: "Readable" }
89
+ * @param options contains generic configuration for rpc calls
90
+ *
91
+ * @description Access the script of the contract and normalize it using the requested unparsing mode.
92
+ *
93
+ */
94
+ getNormalizedScript(address: string, unparsingMode?: UnparsingMode, { block }?: {
95
+ block: string;
96
+ }): Promise<ScriptResponse>;
85
97
  /**
86
98
  *
87
99
  * @param address contract address from which we want to retrieve
@@ -345,9 +357,14 @@ export declare class RpcClient implements RpcClientInterface {
345
357
  * @param options contains generic configuration for rpc calls
346
358
  *
347
359
  * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
360
+ * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the the RPC to pack.
361
+ * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
362
+ * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint.
363
+ * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package.
348
364
  *
349
365
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
350
366
  *
367
+ *
351
368
  * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data
352
369
  */
353
370
  packData(data: PackDataParams, { block }?: RPCOptions): Promise<{
@@ -151,7 +151,16 @@ export interface OperationContentsDelegation {
151
151
  storage_limit: string;
152
152
  delegate?: string;
153
153
  }
154
- export declare type OperationContents = OperationContentsEndorsement | OperationContentsRevelation | OperationContentsDoubleEndorsement | OperationContentsDoubleBaking | OperationContentsActivateAccount | OperationContentsProposals | OperationContentsBallot | OperationContentsReveal | OperationContentsTransaction | OperationContentsOrigination | OperationContentsDelegation | OperationContentsEndorsementWithSlot | OperationContentsFailingNoop;
154
+ export interface OperationContentsRegisterGlobalConstant {
155
+ kind: OpKind.REGISTER_GLOBAL_CONSTANT;
156
+ source: string;
157
+ fee: string;
158
+ counter: string;
159
+ gas_limit: string;
160
+ storage_limit: string;
161
+ value: MichelsonV1Expression;
162
+ }
163
+ export declare type OperationContents = OperationContentsEndorsement | OperationContentsRevelation | OperationContentsDoubleEndorsement | OperationContentsDoubleBaking | OperationContentsActivateAccount | OperationContentsProposals | OperationContentsBallot | OperationContentsReveal | OperationContentsTransaction | OperationContentsOrigination | OperationContentsDelegation | OperationContentsEndorsementWithSlot | OperationContentsFailingNoop | OperationContentsRegisterGlobalConstant;
155
164
  export interface OperationContentsAndResultMetadataExtended {
156
165
  balance_updates: OperationMetadataBalanceUpdates[];
157
166
  delegate: string;
@@ -172,6 +181,11 @@ export interface OperationContentsAndResultMetadataDelegation {
172
181
  operation_result: OperationResultDelegation;
173
182
  internal_operation_results?: InternalOperationResult[];
174
183
  }
184
+ export interface OperationContentsAndResultMetadataRegisterGlobalConstant {
185
+ balance_updates: OperationMetadataBalanceUpdates[];
186
+ operation_result: OperationResultRegisterGlobalConstant;
187
+ internal_operation_results?: InternalOperationResult[];
188
+ }
175
189
  export interface OperationContentsAndResultMetadata {
176
190
  balance_updates: OperationMetadataBalanceUpdates[];
177
191
  }
@@ -256,7 +270,17 @@ export interface OperationContentsAndResultDelegation {
256
270
  delegate?: string;
257
271
  metadata: OperationContentsAndResultMetadataDelegation;
258
272
  }
259
- export declare type OperationContentsAndResult = OperationContentsAndResultEndorsement | OperationContentsAndResultRevelation | OperationContentsAndResultDoubleEndorsement | OperationContentsAndResultDoubleBaking | OperationContentsAndResultActivateAccount | OperationContentsAndResultProposals | OperationContentsAndResultBallot | OperationContentsAndResultReveal | OperationContentsAndResultTransaction | OperationContentsAndResultOrigination | OperationContentsAndResultDelegation | OperationContentsAndResultEndorsementWithSlot;
273
+ export interface OperationContentsAndResultRegisterGlobalConstant {
274
+ kind: OpKind.REGISTER_GLOBAL_CONSTANT;
275
+ source: string;
276
+ fee: string;
277
+ counter: string;
278
+ gas_limit: string;
279
+ storage_limit: string;
280
+ value: MichelsonV1Expression;
281
+ metadata: OperationContentsAndResultMetadataRegisterGlobalConstant;
282
+ }
283
+ export declare type OperationContentsAndResult = OperationContentsAndResultEndorsement | OperationContentsAndResultRevelation | OperationContentsAndResultDoubleEndorsement | OperationContentsAndResultDoubleBaking | OperationContentsAndResultActivateAccount | OperationContentsAndResultProposals | OperationContentsAndResultBallot | OperationContentsAndResultReveal | OperationContentsAndResultTransaction | OperationContentsAndResultOrigination | OperationContentsAndResultDelegation | OperationContentsAndResultEndorsementWithSlot | OperationContentsAndResultRegisterGlobalConstant;
260
284
  export interface OperationEntry {
261
285
  protocol: string;
262
286
  chain_id: string;
@@ -414,15 +438,23 @@ export interface OperationObject {
414
438
  protocol?: string;
415
439
  signature?: string;
416
440
  }
417
- export declare type InternalOperationResultKindEnum = OpKind.REVEAL | OpKind.TRANSACTION | OpKind.ORIGINATION | OpKind.DELEGATION;
441
+ export declare type InternalOperationResultKindEnum = OpKind.REVEAL | OpKind.TRANSACTION | OpKind.ORIGINATION | OpKind.DELEGATION | OpKind.REGISTER_GLOBAL_CONSTANT;
418
442
  export declare type SuccessfulManagerOperationResultKindEnum = OpKind.REVEAL | OpKind.TRANSACTION | OpKind.ORIGINATION | OpKind.DELEGATION;
419
- export declare type InternalOperationResultEnum = OperationResultReveal | OperationResultTransaction | OperationResultDelegation | OperationResultOrigination;
443
+ export declare type InternalOperationResultEnum = OperationResultReveal | OperationResultTransaction | OperationResultDelegation | OperationResultOrigination | OperationResultRegisterGlobalConstant;
420
444
  export interface OperationResultDelegation {
421
445
  status: OperationResultStatusEnum;
422
446
  consumed_gas?: string;
423
447
  errors?: TezosGenericOperationError[];
424
448
  consumed_milligas?: string;
425
449
  }
450
+ export interface OperationResultRegisterGlobalConstant {
451
+ status: OperationResultStatusEnum;
452
+ balance_updates?: OperationBalanceUpdates;
453
+ consumed_gas?: string;
454
+ storage_size?: string;
455
+ global_address?: string;
456
+ errors?: TezosGenericOperationError[];
457
+ }
426
458
  export interface ContractBigMapDiffItem {
427
459
  key_hash?: string;
428
460
  key?: MichelsonV1Expression;
@@ -474,6 +506,7 @@ export interface InternalOperationResult {
474
506
  balance?: string;
475
507
  delegate?: string;
476
508
  script?: ScriptedContracts;
509
+ value?: MichelsonV1Expression;
477
510
  result: InternalOperationResultEnum;
478
511
  }
479
512
  export interface SuccessfulManagerOperationResult {
@@ -531,7 +564,10 @@ export interface LazyStorageDiffUpdatesBigMap {
531
564
  key: MichelsonV1Expression;
532
565
  value?: MichelsonV1Expression;
533
566
  }
534
- export declare type CommitmentsAndCiphertexts = [SaplingTransactionCommitment, SaplingTransactionCiphertext];
567
+ export declare type CommitmentsAndCiphertexts = [
568
+ SaplingTransactionCommitment,
569
+ SaplingTransactionCiphertext
570
+ ];
535
571
  export declare type SaplingTransactionCommitment = string;
536
572
  export interface LazyStorageDiffUpdatesSaplingState {
537
573
  commitments_and_ciphertexts: CommitmentsAndCiphertexts[];
@@ -562,7 +598,7 @@ export interface OperationContentsAndResultMetadataOrigination {
562
598
  operation_result: OperationResultOrigination;
563
599
  internal_operation_results?: InternalOperationResult[];
564
600
  }
565
- export declare type ConstantsResponse = ConstantsResponseCommon & ConstantsResponseProto011 & ConstantsResponseProto010 & ConstantsResponseProto009 & ConstantsResponseProto008 & ConstantsResponseProto007 & ConstantsResponseProto006 & ConstantsResponseProto005 & ConstantsResponseProto004 & ConstantsResponseProto003 & ConstantsResponseProto001And002;
601
+ export declare type ConstantsResponse = ConstantsResponseCommon & ConstantsResponseProto012 & ConstantsResponseProto011 & ConstantsResponseProto010 & ConstantsResponseProto009 & ConstantsResponseProto008 & ConstantsResponseProto007 & ConstantsResponseProto006 & ConstantsResponseProto005 & ConstantsResponseProto004 & ConstantsResponseProto003 & ConstantsResponseProto001And002;
566
602
  export interface ConstantsResponseCommon {
567
603
  proof_of_work_nonce_size: number;
568
604
  nonce_length: number;
@@ -586,10 +622,31 @@ export interface ConstantsResponseCommon {
586
622
  cost_per_byte: BigNumber;
587
623
  hard_storage_limit_per_operation: BigNumber;
588
624
  }
589
- export interface ConstantsResponseProto011 extends Omit<ConstantsResponseProto010, 'michelson_maximum_type_size'> {
625
+ export declare type Ratio = {
626
+ numerator: number;
627
+ denominator: number;
628
+ };
629
+ export interface ConstantsResponseProto012 extends Omit<ConstantsResponseProto011, 'minimal_block_delay' | 'baking_reward_per_endorsement' | 'initial_endorsers' | 'delay_per_missing_endorsement' | 'test_chain_duration' | 'blocks_per_roll_snapshot' | 'time_between_blocks' | 'endorsers_per_block' | 'block_security_deposit' | 'endorsement_security_deposit' | 'endorsement_reward'> {
630
+ blocks_per_stake_snapshot?: number;
631
+ baking_reward_fixed_portion?: BigNumber;
632
+ baking_reward_bonus_per_slot?: BigNumber;
633
+ endorsing_reward_per_slot?: BigNumber;
634
+ max_operations_time_to_live?: number;
635
+ round_durations?: BigNumber[];
636
+ consensus_committee_size?: number;
637
+ consensus_threshold?: number;
638
+ minimal_participation_ratio?: Ratio;
639
+ max_slashing_period?: number;
640
+ frozen_deposits_percentage?: number;
641
+ double_baking_punishment?: BigNumber;
642
+ ratio_of_frozen_deposits_slashed_per_double_endorsement?: Ratio;
643
+ delegate_selection?: 'random' | string[][];
644
+ }
645
+ export interface ConstantsResponseProto011 extends ConstantsResponseProto010 {
590
646
  max_micheline_node_count?: number;
591
647
  max_allowed_global_constants_depth?: number;
592
648
  max_micheline_bytes_limit?: number;
649
+ cache_layout?: BigNumber[];
593
650
  }
594
651
  export interface ConstantsResponseProto010 extends ConstantsResponseProto007 {
595
652
  minimal_block_delay?: BigNumber;
@@ -726,4 +783,8 @@ export interface VotingPeriodBlockResult {
726
783
  position: number;
727
784
  remaining: number;
728
785
  }
786
+ export declare type UnparsingModeEnum = 'Readable' | 'Optimized' | 'Optimized_legacy';
787
+ export declare type UnparsingMode = {
788
+ unparsing_mode: UnparsingModeEnum;
789
+ };
729
790
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/rpc",
3
- "version": "10.2.1",
3
+ "version": "11.0.1",
4
4
  "description": "Provides low level methods, and types to invoke RPC calls from a Nomadic Tezos RPC node",
5
5
  "keywords": [
6
6
  "tezos",
@@ -40,7 +40,7 @@
40
40
  "lint-staged": {
41
41
  "{src,test}/**/*.ts": [
42
42
  "prettier --write",
43
- "tslint --fix",
43
+ "eslint --fix",
44
44
  "git add"
45
45
  ]
46
46
  },
@@ -67,9 +67,10 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@taquito/http-utils": "^10.2.1",
70
+ "@taquito/http-utils": "^11.0.1",
71
71
  "bignumber.js": "^9.0.1",
72
- "lodash": "^4.17.21"
72
+ "lodash.get": "^4.4.2",
73
+ "lodash.set": "^4.3.2"
73
74
  },
74
75
  "devDependencies": {
75
76
  "@types/jest": "^26.0.23",
@@ -98,7 +99,7 @@
98
99
  "ts-node": "^10.0.0",
99
100
  "tslint-config-prettier": "^1.18.0",
100
101
  "tslint-config-standard": "^9.0.0",
101
- "typescript": "^4.1.5"
102
+ "typescript": "~4.1.5"
102
103
  },
103
- "gitHead": "c3d65aa8a91c161ca2560e10d48f85b6b63255b0"
104
+ "gitHead": "d09ecc8f28d454067553c9e94c85142409f90722"
104
105
  }
package/signature.json CHANGED
@@ -210,7 +210,7 @@
210
210
  "tslint": "^6.1.3",
211
211
  "tslint-config-prettier": "^1.18.0",
212
212
  "tslint-config-standard": "^9.0.0",
213
- "typescript": "^4.1.5"
213
+ "typescript": "~4.1.5"
214
214
  },
215
215
  "gitHead": "551e35aeff7d6dcde1c72284238c0ed3c3aae77e"
216
216
  }