@taquito/contracts-library 16.1.2 → 16.2.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.
@@ -1,16 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidScriptFormatError = exports.InvalidAddressError = void 0;
4
- /**
5
- * @category Error
6
- * @description Error that indicates an invalid address being used or passed
7
- */
8
- class InvalidAddressError extends Error {
9
- constructor(message) {
10
- super(message);
11
- }
12
- }
13
- exports.InvalidAddressError = InvalidAddressError;
3
+ exports.InvalidScriptFormatError = void 0;
14
4
  /**
15
5
  * @category Error
16
6
  * @description Error that indicates invalid script format being useed or passed
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAJD,kDAIC;AAED;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAJD,4DAIC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAJD,4DAIC"}
@@ -8,6 +8,7 @@ exports.ContractsLibrary = void 0;
8
8
  const utils_1 = require("@taquito/utils");
9
9
  const errors_1 = require("./errors");
10
10
  const read_provider_wrapper_1 = require("./read-provider-wrapper");
11
+ const core_1 = require("@taquito/core");
11
12
  /**
12
13
  * @description Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.
13
14
  *
@@ -62,8 +63,9 @@ class ContractsLibrary {
62
63
  });
63
64
  }
64
65
  validateContractAddress(address) {
65
- if (utils_1.validateAddress(address) !== utils_1.ValidationResult.VALID) {
66
- throw new errors_1.InvalidAddressError(`Address is invalid: ${address}`);
66
+ const addressValidation = utils_1.validateAddress(address);
67
+ if (addressValidation !== utils_1.ValidationResult.VALID) {
68
+ throw new core_1.InvalidAddressError(address, utils_1.invalidErrorDetail(addressValidation));
67
69
  }
68
70
  }
69
71
  validateContractScriptFormat(script, address) {
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-contracts-library.js","sourceRoot":"","sources":["../../src/taquito-contracts-library.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0CAAmE;AACnE,qCAAyE;AACzE,mEAAsE;AAMtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,gBAAgB;IAA7B;QACU,sBAAiB,GAAkB,EAAE,CAAC;IA4ChD,CAAC;IA1CC;;;;;;;OAOG;IACH,WAAW,CAAC,QAAuB;QACjC,KAAK,MAAM,eAAe,IAAI,QAAQ,EAAE;YACtC,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;YAC9C,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBACpC,CAAC,eAAe,CAAC,oBAAO,QAAQ,CAAC,eAAe,CAAC,CAAE;aACpD,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW,CAAC,eAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB,CAAC,OAAgB;QAC/B,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAgB,EAAE,EAAE;YACrD,OAAO,CAAC,YAAY,GAAG,IAAI,mDAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACnF,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,uBAAuB,CAAC,OAAe;QAC7C,IAAI,uBAAe,CAAC,OAAO,CAAC,KAAK,wBAAgB,CAAC,KAAK,EAAE;YACvD,MAAM,IAAI,4BAAmB,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;SACjE;IACH,CAAC;IAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe;QAC7E,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,IAAI,iCAAwB,CAChC,oDAAoD,OAAO,oFAAoF,OAAO,sBAAsB,MAAM,EAAE,CACrL,CAAC;SACH;IACH,CAAC;CACF;AA7CD,4CA6CC"}
1
+ {"version":3,"file":"taquito-contracts-library.js","sourceRoot":"","sources":["../../src/taquito-contracts-library.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0CAAuF;AACvF,qCAAoD;AACpD,mEAAsE;AACtE,wCAAoD;AAMpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,gBAAgB;IAA7B;QACU,sBAAiB,GAAkB,EAAE,CAAC;IA6ChD,CAAC;IA3CC;;;;;;;OAOG;IACH,WAAW,CAAC,QAAuB;QACjC,KAAK,MAAM,eAAe,IAAI,QAAQ,EAAE;YACtC,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;YAC9C,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBACpC,CAAC,eAAe,CAAC,oBAAO,QAAQ,CAAC,eAAe,CAAC,CAAE;aACpD,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW,CAAC,eAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB,CAAC,OAAgB;QAC/B,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAgB,EAAE,EAAE;YACrD,OAAO,CAAC,YAAY,GAAG,IAAI,mDAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACnF,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,uBAAuB,CAAC,OAAe;QAC7C,MAAM,iBAAiB,GAAG,uBAAe,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,iBAAiB,KAAK,wBAAgB,CAAC,KAAK,EAAE;YAChD,MAAM,IAAI,0BAAmB,CAAC,OAAO,EAAE,0BAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;SAC/E;IACH,CAAC;IAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe;QAC7E,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,IAAI,iCAAwB,CAChC,oDAAoD,OAAO,oFAAoF,OAAO,sBAAsB,MAAM,EAAE,CACrL,CAAC;SACH;IACH,CAAC;CACF;AA9CD,4CA8CC"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
5
5
  exports.VERSION = {
6
- "commitHash": "bcc2118ddfafc1995fd125cd74d198fda042bf48",
7
- "version": "16.1.2"
6
+ "commitHash": "adc0f8c31492e8eb2f03b06ac36ba053e8ba6224",
7
+ "version": "16.2.0"
8
8
  };
9
9
  //# sourceMappingURL=version.js.map
@@ -1,14 +1,6 @@
1
- import { validateAddress, ValidationResult } from '@taquito/utils';
1
+ import { validateAddress, ValidationResult, invalidErrorDetail } from '@taquito/utils';
2
+ import { InvalidAddressError } from '@taquito/core';
2
3
 
3
- /**
4
- * @category Error
5
- * @description Error that indicates an invalid address being used or passed
6
- */
7
- class InvalidAddressError extends Error {
8
- constructor(message) {
9
- super(message);
10
- }
11
- }
12
4
  /**
13
5
  * @category Error
14
6
  * @description Error that indicates invalid script format being useed or passed
@@ -179,8 +171,9 @@ class ContractsLibrary {
179
171
  });
180
172
  }
181
173
  validateContractAddress(address) {
182
- if (validateAddress(address) !== ValidationResult.VALID) {
183
- throw new InvalidAddressError(`Address is invalid: ${address}`);
174
+ const addressValidation = validateAddress(address);
175
+ if (addressValidation !== ValidationResult.VALID) {
176
+ throw new InvalidAddressError(address, invalidErrorDetail(addressValidation));
184
177
  }
185
178
  }
186
179
  validateContractScriptFormat(script, address) {
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-contracts-library.es6.js","sources":["../src/errors.ts","../src/read-provider-wrapper.ts","../src/taquito-contracts-library.ts"],"sourcesContent":["/**\n * @category Error\n * @description Error that indicates an invalid address being used or passed\n */\nexport class InvalidAddressError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * @category Error\n * @description Error that indicates invalid script format being useed or passed\n */\nexport class InvalidScriptFormatError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n","import { BigNumber } from 'bignumber.js';\nimport {\n BlockResponse,\n EntrypointsResponse,\n MichelsonV1Expression,\n SaplingDiffResponse,\n ScriptedContracts,\n} from '@taquito/rpc';\nimport { ContractsLibrary } from './taquito-contracts-library';\nimport { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from '@taquito/taquito';\n\nexport class ReadWrapperContractsLibrary implements TzReadProvider {\n constructor(private readProvider: TzReadProvider, private contractslibrary: ContractsLibrary) {}\n\n async getScript(address: string, block: BlockIdentifier): Promise<ScriptedContracts> {\n const contractData = this.contractslibrary.getContract(address);\n if (contractData) {\n return contractData.script;\n } else {\n return this.readProvider.getScript(address, block);\n }\n }\n\n async getEntrypoints(contract: string): Promise<EntrypointsResponse> {\n const contractData = this.contractslibrary.getContract(contract);\n if (contractData) {\n return contractData.entrypoints;\n } else {\n return this.readProvider.getEntrypoints(contract);\n }\n }\n\n getBalance(address: string, block: BlockIdentifier): Promise<BigNumber> {\n return this.readProvider.getBalance(address, block);\n }\n getDelegate(address: string, block: BlockIdentifier): Promise<string | null> {\n return this.readProvider.getDelegate(address, block);\n }\n getNextProtocol(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getNextProtocol(block);\n }\n getProtocolConstants(block: BlockIdentifier): Promise<{\n time_between_blocks?: BigNumber[] | undefined;\n minimal_block_delay?: BigNumber | undefined;\n hard_gas_limit_per_operation: BigNumber;\n hard_gas_limit_per_block: BigNumber;\n hard_storage_limit_per_operation: BigNumber;\n cost_per_byte: BigNumber;\n smart_rollup_origination_size: number;\n }> {\n return this.readProvider.getProtocolConstants(block);\n }\n getStorage(contract: string, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getStorage(contract, block);\n }\n getBlockHash(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockHash(block);\n }\n getBlockLevel(block: BlockIdentifier): Promise<number> {\n return this.readProvider.getBlockLevel(block);\n }\n getCounter(pkh: string, block: BlockIdentifier): Promise<string> {\n return this.readProvider.getCounter(pkh, block);\n }\n getBlockTimestamp(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockTimestamp(block);\n }\n getBigMapValue(bigMapQuery: BigMapQuery, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getBigMapValue(bigMapQuery, block);\n }\n getSaplingDiffById(\n saplingStateQuery: SaplingStateQuery,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffById(saplingStateQuery, block);\n }\n getSaplingDiffByContract(\n contractAddress: string,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffByContract(contractAddress, block);\n }\n getChainId(): Promise<string> {\n return this.readProvider.getChainId();\n }\n isAccountRevealed(publicKeyHash: string, block: BlockIdentifier): Promise<boolean> {\n return this.readProvider.isAccountRevealed(publicKeyHash, block);\n }\n getBlock(block: BlockIdentifier): Promise<BlockResponse> {\n return this.readProvider.getBlock(block);\n }\n getLiveBlocks(block: BlockIdentifier): Promise<string[]> {\n return this.readProvider.getLiveBlocks(block);\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/contracts-library\n */\n\nimport { EntrypointsResponse, ScriptedContracts } from '@taquito/rpc';\nimport { Extension, Context } from '@taquito/taquito';\nimport { validateAddress, ValidationResult } from '@taquito/utils';\nimport { InvalidAddressError, InvalidScriptFormatError } from './errors';\nimport { ReadWrapperContractsLibrary } from './read-provider-wrapper';\n\ninterface ContractsData {\n [contractAddress: string]: { script: ScriptedContracts; entrypoints: EntrypointsResponse };\n}\n\n/**\n * @description Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.\n *\n * @example\n * ```\n * import { ContractsLibrary } from '@taquito/contracts-library';\n * import { TezosToolkit } from '@taquito/taquito';\n *\n * const Tezos = new TezosToolkit('rpcUrl');\n * const contractsLibrary = new ContractsLibrary();\n *\n * contractsLibrary.addContract({\n * ['contractAddress1']: {\n * script: script1, // obtained from Tezos.rpc.getContract('contractAddress1').script\n * entrypoints: entrypoints1 // obtained from Tezos.rpc.getEntrypoints('contractAddress1')\n * },\n * // load more contracts\n * });\n *\n * Tezos.addExtension(contractsLibrary);\n * ```\n *\n */\nexport class ContractsLibrary implements Extension {\n private _contractsLibrary: ContractsData = {};\n\n /**\n * @description Saves one of several contract in the library\n *\n * @param contract is an object where the key is a contract address and the value is an object having a script and an entrypoints properties.\n * Note: the expected format for the script and entrypoints properties are the same as the one respectivlely returned by\n * `TezosToolkit.rpc.getContract('contractAddress').script` and `TezosToolkit.rpc.getEntrypoints`\n *\n */\n addContract(contract: ContractsData) {\n for (const contractAddress in contract) {\n this.validateContractAddress(contractAddress);\n this.validateContractScriptFormat(contract[contractAddress].script, contractAddress);\n Object.assign(this._contractsLibrary, {\n [contractAddress]: { ...contract[contractAddress] },\n });\n }\n }\n\n getContract(contractAddress: string) {\n return this._contractsLibrary[contractAddress];\n }\n\n configureContext(context: Context) {\n context.registerProviderDecorator((context: Context) => {\n context.readProvider = new ReadWrapperContractsLibrary(context.readProvider, this);\n return context;\n });\n }\n\n private validateContractAddress(address: string) {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Address is invalid: ${address}`);\n }\n }\n\n private validateContractScriptFormat(script: ScriptedContracts, address: string) {\n if (!script.code) {\n throw new InvalidScriptFormatError(\n `An invalid script property has been provided for ${address}. The script property can be retrieved from TezosToolkit.rpc.getNormalizedScript(${address}). Invalid script: ${script}`\n );\n }\n }\n}\n"],"names":[],"mappings":";;AAAA;;;AAGG;AACG,MAAO,mBAAoB,SAAQ,KAAK,CAAA;AAC5C,IAAA,WAAA,CAAY,OAAe,EAAA;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;KAChB;AACF,CAAA;AAED;;;AAGG;AACG,MAAO,wBAAyB,SAAQ,KAAK,CAAA;AACjD,IAAA,WAAA,CAAY,OAAe,EAAA;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;KAChB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;MCPY,2BAA2B,CAAA;IACtC,WAAoB,CAAA,YAA4B,EAAU,gBAAkC,EAAA;QAAxE,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAgB;QAAU,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;KAAI;IAE1F,SAAS,CAAC,OAAe,EAAE,KAAsB,EAAA;;YACrD,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAChE,YAAA,IAAI,YAAY,EAAE;gBAChB,OAAO,YAAY,CAAC,MAAM,CAAC;AAC5B,aAAA;AAAM,iBAAA;gBACL,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACpD,aAAA;SACF,CAAA,CAAA;AAAA,KAAA;AAEK,IAAA,cAAc,CAAC,QAAgB,EAAA;;YACnC,MAAM,YAAY,GA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C,eAAe,CAAC,CAAC;AAC9C,YAAA,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AACrF,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;AACpC,gBAAA,CAAC,eAAe,GAAC,MAAA,CAAA,MAAA,CAAA,EAAA,EAAO,QAAQ,CAAC,eAAe,CAAC,CAAE;AACpD,aAAA,CAAC,CAAC;AACJ,SAAA;KACF;AAED,IAAA,WAAW,CAAC,eAAuB,EAAA;AACjC,QAAA,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;KAChD;AAED,IAAA,gBAAgB,CAAC,OAAgB,EAAA;AAC/B,QAAA,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAgB,KAAI;AACrD,YAAA,OAAO,CAAC,YAAY,GAAG,IAAI,2BAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACnF,YAAA,OAAO,OAAO,CAAC;AACjB,SAAC,CAAC,CAAC;KACJ;AAEO,IAAA,uBAAuB,CAAC,OAAe,EAAA;QAC7C,IAAI,eAAe,CAAC,OAAO,CAAC,KAAK,gBAAgB,CAAC,KAAK,EAAE;AACvD,YAAA,MAAM,IAAI,mBAAmB,CAAC,uBAAuB,OAAO,CAAA,CAAE,CAAC,CAAC;AACjE,SAAA;KACF;IAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe,EAAA;AAC7E,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,IAAI,wBAAwB,CAChC,CAAoD,iDAAA,EAAA,OAAO,CAAoF,iFAAA,EAAA,OAAO,CAAsB,mBAAA,EAAA,MAAM,CAAE,CAAA,CACrL,CAAC;AACH,SAAA;KACF;AACF;;;;"}
1
+ {"version":3,"file":"taquito-contracts-library.es6.js","sources":["../src/errors.ts","../src/read-provider-wrapper.ts","../src/taquito-contracts-library.ts"],"sourcesContent":["/**\n * @category Error\n * @description Error that indicates invalid script format being useed or passed\n */\nexport class InvalidScriptFormatError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n","import { BigNumber } from 'bignumber.js';\nimport {\n BlockResponse,\n EntrypointsResponse,\n MichelsonV1Expression,\n SaplingDiffResponse,\n ScriptedContracts,\n} from '@taquito/rpc';\nimport { ContractsLibrary } from './taquito-contracts-library';\nimport { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from '@taquito/taquito';\n\nexport class ReadWrapperContractsLibrary implements TzReadProvider {\n constructor(private readProvider: TzReadProvider, private contractslibrary: ContractsLibrary) {}\n\n async getScript(address: string, block: BlockIdentifier): Promise<ScriptedContracts> {\n const contractData = this.contractslibrary.getContract(address);\n if (contractData) {\n return contractData.script;\n } else {\n return this.readProvider.getScript(address, block);\n }\n }\n\n async getEntrypoints(contract: string): Promise<EntrypointsResponse> {\n const contractData = this.contractslibrary.getContract(contract);\n if (contractData) {\n return contractData.entrypoints;\n } else {\n return this.readProvider.getEntrypoints(contract);\n }\n }\n\n getBalance(address: string, block: BlockIdentifier): Promise<BigNumber> {\n return this.readProvider.getBalance(address, block);\n }\n getDelegate(address: string, block: BlockIdentifier): Promise<string | null> {\n return this.readProvider.getDelegate(address, block);\n }\n getNextProtocol(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getNextProtocol(block);\n }\n getProtocolConstants(block: BlockIdentifier): Promise<{\n time_between_blocks?: BigNumber[] | undefined;\n minimal_block_delay?: BigNumber | undefined;\n hard_gas_limit_per_operation: BigNumber;\n hard_gas_limit_per_block: BigNumber;\n hard_storage_limit_per_operation: BigNumber;\n cost_per_byte: BigNumber;\n smart_rollup_origination_size: number;\n }> {\n return this.readProvider.getProtocolConstants(block);\n }\n getStorage(contract: string, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getStorage(contract, block);\n }\n getBlockHash(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockHash(block);\n }\n getBlockLevel(block: BlockIdentifier): Promise<number> {\n return this.readProvider.getBlockLevel(block);\n }\n getCounter(pkh: string, block: BlockIdentifier): Promise<string> {\n return this.readProvider.getCounter(pkh, block);\n }\n getBlockTimestamp(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockTimestamp(block);\n }\n getBigMapValue(bigMapQuery: BigMapQuery, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getBigMapValue(bigMapQuery, block);\n }\n getSaplingDiffById(\n saplingStateQuery: SaplingStateQuery,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffById(saplingStateQuery, block);\n }\n getSaplingDiffByContract(\n contractAddress: string,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffByContract(contractAddress, block);\n }\n getChainId(): Promise<string> {\n return this.readProvider.getChainId();\n }\n isAccountRevealed(publicKeyHash: string, block: BlockIdentifier): Promise<boolean> {\n return this.readProvider.isAccountRevealed(publicKeyHash, block);\n }\n getBlock(block: BlockIdentifier): Promise<BlockResponse> {\n return this.readProvider.getBlock(block);\n }\n getLiveBlocks(block: BlockIdentifier): Promise<string[]> {\n return this.readProvider.getLiveBlocks(block);\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/contracts-library\n */\n\nimport { EntrypointsResponse, ScriptedContracts } from '@taquito/rpc';\nimport { Extension, Context } from '@taquito/taquito';\nimport { validateAddress, ValidationResult, invalidErrorDetail } from '@taquito/utils';\nimport { InvalidScriptFormatError } from './errors';\nimport { ReadWrapperContractsLibrary } from './read-provider-wrapper';\nimport { InvalidAddressError } from '@taquito/core';\n\ninterface ContractsData {\n [contractAddress: string]: { script: ScriptedContracts; entrypoints: EntrypointsResponse };\n}\n\n/**\n * @description Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.\n *\n * @example\n * ```\n * import { ContractsLibrary } from '@taquito/contracts-library';\n * import { TezosToolkit } from '@taquito/taquito';\n *\n * const Tezos = new TezosToolkit('rpcUrl');\n * const contractsLibrary = new ContractsLibrary();\n *\n * contractsLibrary.addContract({\n * ['contractAddress1']: {\n * script: script1, // obtained from Tezos.rpc.getContract('contractAddress1').script\n * entrypoints: entrypoints1 // obtained from Tezos.rpc.getEntrypoints('contractAddress1')\n * },\n * // load more contracts\n * });\n *\n * Tezos.addExtension(contractsLibrary);\n * ```\n *\n */\nexport class ContractsLibrary implements Extension {\n private _contractsLibrary: ContractsData = {};\n\n /**\n * @description Saves one of several contract in the library\n *\n * @param contract is an object where the key is a contract address and the value is an object having a script and an entrypoints properties.\n * Note: the expected format for the script and entrypoints properties are the same as the one respectivlely returned by\n * `TezosToolkit.rpc.getContract('contractAddress').script` and `TezosToolkit.rpc.getEntrypoints`\n *\n */\n addContract(contract: ContractsData) {\n for (const contractAddress in contract) {\n this.validateContractAddress(contractAddress);\n this.validateContractScriptFormat(contract[contractAddress].script, contractAddress);\n Object.assign(this._contractsLibrary, {\n [contractAddress]: { ...contract[contractAddress] },\n });\n }\n }\n\n getContract(contractAddress: string) {\n return this._contractsLibrary[contractAddress];\n }\n\n configureContext(context: Context) {\n context.registerProviderDecorator((context: Context) => {\n context.readProvider = new ReadWrapperContractsLibrary(context.readProvider, this);\n return context;\n });\n }\n\n private validateContractAddress(address: string) {\n const addressValidation = validateAddress(address);\n if (addressValidation !== ValidationResult.VALID) {\n throw new InvalidAddressError(address, invalidErrorDetail(addressValidation));\n }\n }\n\n private validateContractScriptFormat(script: ScriptedContracts, address: string) {\n if (!script.code) {\n throw new InvalidScriptFormatError(\n `An invalid script property has been provided for ${address}. The script property can be retrieved from TezosToolkit.rpc.getNormalizedScript(${address}). Invalid script: ${script}`\n );\n }\n }\n}\n"],"names":[],"mappings":";;;AAAA;;;AAGG;AACG,MAAO,wBAAyB,SAAQ,KAAK,CAAA;AACjD,IAAA,WAAA,CAAY,OAAe,EAAA;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;KAChB;AACF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AA,OAAO,OAAO,CAAC;AACjB,SAAC,CAAC,CAAC;KACJ;AAEO,IAAA,uBAAuB,CAAC,OAAe,EAAA;AAC7C,QAAA,MAAM,iBAAiB,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AACnD,QAAA,IAAI,iBAAiB,KAAK,gBAAgB,CAAC,KAAK,EAAE;YAChD,MAAM,IAAI,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC/E,SAAA;KACF;IAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe,EAAA;AAC7E,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,IAAI,wBAAwB,CAChC,CAAoD,iDAAA,EAAA,OAAO,CAAoF,iFAAA,EAAA,OAAO,CAAsB,mBAAA,EAAA,MAAM,CAAE,CAAA,CACrL,CAAC;AACH,SAAA;KACF;AACF;;;;"}
@@ -1,18 +1,9 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@taquito/utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoContractsLibrary = {}, global.utils));
5
- })(this, (function (exports, utils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/utils'), require('@taquito/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@taquito/utils', '@taquito/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoContractsLibrary = {}, global.utils, global.core));
5
+ })(this, (function (exports, utils, core) { 'use strict';
6
6
 
7
- /**
8
- * @category Error
9
- * @description Error that indicates an invalid address being used or passed
10
- */
11
- class InvalidAddressError extends Error {
12
- constructor(message) {
13
- super(message);
14
- }
15
- }
16
7
  /**
17
8
  * @category Error
18
9
  * @description Error that indicates invalid script format being useed or passed
@@ -183,8 +174,9 @@
183
174
  });
184
175
  }
185
176
  validateContractAddress(address) {
186
- if (utils.validateAddress(address) !== utils.ValidationResult.VALID) {
187
- throw new InvalidAddressError(`Address is invalid: ${address}`);
177
+ const addressValidation = utils.validateAddress(address);
178
+ if (addressValidation !== utils.ValidationResult.VALID) {
179
+ throw new core.InvalidAddressError(address, utils.invalidErrorDetail(addressValidation));
188
180
  }
189
181
  }
190
182
  validateContractScriptFormat(script, address) {
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-contracts-library.umd.js","sources":["../src/errors.ts","../src/read-provider-wrapper.ts","../src/taquito-contracts-library.ts"],"sourcesContent":["/**\n * @category Error\n * @description Error that indicates an invalid address being used or passed\n */\nexport class InvalidAddressError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * @category Error\n * @description Error that indicates invalid script format being useed or passed\n */\nexport class InvalidScriptFormatError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n","import { BigNumber } from 'bignumber.js';\nimport {\n BlockResponse,\n EntrypointsResponse,\n MichelsonV1Expression,\n SaplingDiffResponse,\n ScriptedContracts,\n} from '@taquito/rpc';\nimport { ContractsLibrary } from './taquito-contracts-library';\nimport { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from '@taquito/taquito';\n\nexport class ReadWrapperContractsLibrary implements TzReadProvider {\n constructor(private readProvider: TzReadProvider, private contractslibrary: ContractsLibrary) {}\n\n async getScript(address: string, block: BlockIdentifier): Promise<ScriptedContracts> {\n const contractData = this.contractslibrary.getContract(address);\n if (contractData) {\n return contractData.script;\n } else {\n return this.readProvider.getScript(address, block);\n }\n }\n\n async getEntrypoints(contract: string): Promise<EntrypointsResponse> {\n const contractData = this.contractslibrary.getContract(contract);\n if (contractData) {\n return contractData.entrypoints;\n } else {\n return this.readProvider.getEntrypoints(contract);\n }\n }\n\n getBalance(address: string, block: BlockIdentifier): Promise<BigNumber> {\n return this.readProvider.getBalance(address, block);\n }\n getDelegate(address: string, block: BlockIdentifier): Promise<string | null> {\n return this.readProvider.getDelegate(address, block);\n }\n getNextProtocol(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getNextProtocol(block);\n }\n getProtocolConstants(block: BlockIdentifier): Promise<{\n time_between_blocks?: BigNumber[] | undefined;\n minimal_block_delay?: BigNumber | undefined;\n hard_gas_limit_per_operation: BigNumber;\n hard_gas_limit_per_block: BigNumber;\n hard_storage_limit_per_operation: BigNumber;\n cost_per_byte: BigNumber;\n smart_rollup_origination_size: number;\n }> {\n return this.readProvider.getProtocolConstants(block);\n }\n getStorage(contract: string, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getStorage(contract, block);\n }\n getBlockHash(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockHash(block);\n }\n getBlockLevel(block: BlockIdentifier): Promise<number> {\n return this.readProvider.getBlockLevel(block);\n }\n getCounter(pkh: string, block: BlockIdentifier): Promise<string> {\n return this.readProvider.getCounter(pkh, block);\n }\n getBlockTimestamp(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockTimestamp(block);\n }\n getBigMapValue(bigMapQuery: BigMapQuery, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getBigMapValue(bigMapQuery, block);\n }\n getSaplingDiffById(\n saplingStateQuery: SaplingStateQuery,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffById(saplingStateQuery, block);\n }\n getSaplingDiffByContract(\n contractAddress: string,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffByContract(contractAddress, block);\n }\n getChainId(): Promise<string> {\n return this.readProvider.getChainId();\n }\n isAccountRevealed(publicKeyHash: string, block: BlockIdentifier): Promise<boolean> {\n return this.readProvider.isAccountRevealed(publicKeyHash, block);\n }\n getBlock(block: BlockIdentifier): Promise<BlockResponse> {\n return this.readProvider.getBlock(block);\n }\n getLiveBlocks(block: BlockIdentifier): Promise<string[]> {\n return this.readProvider.getLiveBlocks(block);\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/contracts-library\n */\n\nimport { EntrypointsResponse, ScriptedContracts } from '@taquito/rpc';\nimport { Extension, Context } from '@taquito/taquito';\nimport { validateAddress, ValidationResult } from '@taquito/utils';\nimport { InvalidAddressError, InvalidScriptFormatError } from './errors';\nimport { ReadWrapperContractsLibrary } from './read-provider-wrapper';\n\ninterface ContractsData {\n [contractAddress: string]: { script: ScriptedContracts; entrypoints: EntrypointsResponse };\n}\n\n/**\n * @description Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.\n *\n * @example\n * ```\n * import { ContractsLibrary } from '@taquito/contracts-library';\n * import { TezosToolkit } from '@taquito/taquito';\n *\n * const Tezos = new TezosToolkit('rpcUrl');\n * const contractsLibrary = new ContractsLibrary();\n *\n * contractsLibrary.addContract({\n * ['contractAddress1']: {\n * script: script1, // obtained from Tezos.rpc.getContract('contractAddress1').script\n * entrypoints: entrypoints1 // obtained from Tezos.rpc.getEntrypoints('contractAddress1')\n * },\n * // load more contracts\n * });\n *\n * Tezos.addExtension(contractsLibrary);\n * ```\n *\n */\nexport class ContractsLibrary implements Extension {\n private _contractsLibrary: ContractsData = {};\n\n /**\n * @description Saves one of several contract in the library\n *\n * @param contract is an object where the key is a contract address and the value is an object having a script and an entrypoints properties.\n * Note: the expected format for the script and entrypoints properties are the same as the one respectivlely returned by\n * `TezosToolkit.rpc.getContract('contractAddress').script` and `TezosToolkit.rpc.getEntrypoints`\n *\n */\n addContract(contract: ContractsData) {\n for (const contractAddress in contract) {\n this.validateContractAddress(contractAddress);\n this.validateContractScriptFormat(contract[contractAddress].script, contractAddress);\n Object.assign(this._contractsLibrary, {\n [contractAddress]: { ...contract[contractAddress] },\n });\n }\n }\n\n getContract(contractAddress: string) {\n return this._contractsLibrary[contractAddress];\n }\n\n configureContext(context: Context) {\n context.registerProviderDecorator((context: Context) => {\n context.readProvider = new ReadWrapperContractsLibrary(context.readProvider, this);\n return context;\n });\n }\n\n private validateContractAddress(address: string) {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Address is invalid: ${address}`);\n }\n }\n\n private validateContractScriptFormat(script: ScriptedContracts, address: string) {\n if (!script.code) {\n throw new InvalidScriptFormatError(\n `An invalid script property has been provided for ${address}. The script property can be retrieved from TezosToolkit.rpc.getNormalizedScript(${address}). Invalid script: ${script}`\n );\n }\n }\n}\n"],"names":["validateAddress","ValidationResult"],"mappings":";;;;;;EAAA;;;EAGG;EACG,MAAO,mBAAoB,SAAQ,KAAK,CAAA;EAC5C,IAAA,WAAA,CAAY,OAAe,EAAA;UACzB,KAAK,CAAC,OAAO,CAAC,CAAC;OAChB;EACF,CAAA;EAED;;;EAGG;EACG,MAAO,wBAAyB,SAAQ,KAAK,CAAA;EACjD,IAAA,WAAA,CAAY,OAAe,EAAA;UACzB,KAAK,CAAC,OAAO,CAAC,CAAC;OAChB;EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;QCPY,2BAA2B,CAAA;MACtC,WAAoB,CAAA,YAA4B,EAAU,gBAAkC,EAAA;UAAxE,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAgB;UAAU,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;OAAI;MAE1F,SAAS,CAAC,OAAe,EAAE,KAAsB,EAAA;;cACrD,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;EAChE,YAAA,IAAI,YAAY,EAAE;kBAChB,OAAO,YAAY,CAAC,MAAM,CAAC;EAC5B,aAAA;EAAM,iBAAA;kBACL,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;EACpD,aAAA;WACF,CAAA,CAAA;EAAA,KAAA;EAEK,IAAA,cAAc,CAAC,QAAgB,EAAA;;cACnC,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,QAAQ,C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4B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;EACrF,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;EACpC,gBAAA,CAAC,eAAe,GAAC,MAAA,CAAA,MAAA,CAAA,EAAA,EAAO,QAAQ,CAAC,eAAe,CAAC,CAAE;EACpD,aAAA,CAAC,CAAC;EACJ,SAAA;OACF;EAED,IAAA,WAAW,CAAC,eAAuB,EAAA;EACjC,QAAA,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;OAChD;EAED,IAAA,gBAAgB,CAAC,OAAgB,EAAA;EAC/B,QAAA,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAgB,KAAI;EACrD,YAAA,OAAO,CAAC,YAAY,GAAG,IAAI,2BAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;EACnF,YAAA,OAAO,OAAO,CAAC;EACjB,SAAC,CAAC,CAAC;OACJ;EAEO,IAAA,uBAAuB,CAAC,OAAe,EAAA;UAC7C,IAAIA,qBAAe,CAAC,OAAO,CAAC,KAAKC,sBAAgB,CAAC,KAAK,EAAE;EACvD,YAAA,MAAM,IAAI,mBAAmB,CAAC,uBAAuB,OAAO,CAAA,CAAE,CAAC,CAAC;EACjE,SAAA;OACF;MAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe,EAAA;EAC7E,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;cAChB,MAAM,IAAI,wBAAwB,CAChC,CAAoD,iDAAA,EAAA,OAAO,CAAoF,iFAAA,EAAA,OAAO,CAAsB,mBAAA,EAAA,MAAM,CAAE,CAAA,CACrL,CAAC;EACH,SAAA;OACF;EACF;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-contracts-library.umd.js","sources":["../src/errors.ts","../src/read-provider-wrapper.ts","../src/taquito-contracts-library.ts"],"sourcesContent":["/**\n * @category Error\n * @description Error that indicates invalid script format being useed or passed\n */\nexport class InvalidScriptFormatError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n","import { BigNumber } from 'bignumber.js';\nimport {\n BlockResponse,\n EntrypointsResponse,\n MichelsonV1Expression,\n SaplingDiffResponse,\n ScriptedContracts,\n} from '@taquito/rpc';\nimport { ContractsLibrary } from './taquito-contracts-library';\nimport { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from '@taquito/taquito';\n\nexport class ReadWrapperContractsLibrary implements TzReadProvider {\n constructor(private readProvider: TzReadProvider, private contractslibrary: ContractsLibrary) {}\n\n async getScript(address: string, block: BlockIdentifier): Promise<ScriptedContracts> {\n const contractData = this.contractslibrary.getContract(address);\n if (contractData) {\n return contractData.script;\n } else {\n return this.readProvider.getScript(address, block);\n }\n }\n\n async getEntrypoints(contract: string): Promise<EntrypointsResponse> {\n const contractData = this.contractslibrary.getContract(contract);\n if (contractData) {\n return contractData.entrypoints;\n } else {\n return this.readProvider.getEntrypoints(contract);\n }\n }\n\n getBalance(address: string, block: BlockIdentifier): Promise<BigNumber> {\n return this.readProvider.getBalance(address, block);\n }\n getDelegate(address: string, block: BlockIdentifier): Promise<string | null> {\n return this.readProvider.getDelegate(address, block);\n }\n getNextProtocol(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getNextProtocol(block);\n }\n getProtocolConstants(block: BlockIdentifier): Promise<{\n time_between_blocks?: BigNumber[] | undefined;\n minimal_block_delay?: BigNumber | undefined;\n hard_gas_limit_per_operation: BigNumber;\n hard_gas_limit_per_block: BigNumber;\n hard_storage_limit_per_operation: BigNumber;\n cost_per_byte: BigNumber;\n smart_rollup_origination_size: number;\n }> {\n return this.readProvider.getProtocolConstants(block);\n }\n getStorage(contract: string, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getStorage(contract, block);\n }\n getBlockHash(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockHash(block);\n }\n getBlockLevel(block: BlockIdentifier): Promise<number> {\n return this.readProvider.getBlockLevel(block);\n }\n getCounter(pkh: string, block: BlockIdentifier): Promise<string> {\n return this.readProvider.getCounter(pkh, block);\n }\n getBlockTimestamp(block: BlockIdentifier): Promise<string> {\n return this.readProvider.getBlockTimestamp(block);\n }\n getBigMapValue(bigMapQuery: BigMapQuery, block: BlockIdentifier): Promise<MichelsonV1Expression> {\n return this.readProvider.getBigMapValue(bigMapQuery, block);\n }\n getSaplingDiffById(\n saplingStateQuery: SaplingStateQuery,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffById(saplingStateQuery, block);\n }\n getSaplingDiffByContract(\n contractAddress: string,\n block: BlockIdentifier\n ): Promise<SaplingDiffResponse> {\n return this.readProvider.getSaplingDiffByContract(contractAddress, block);\n }\n getChainId(): Promise<string> {\n return this.readProvider.getChainId();\n }\n isAccountRevealed(publicKeyHash: string, block: BlockIdentifier): Promise<boolean> {\n return this.readProvider.isAccountRevealed(publicKeyHash, block);\n }\n getBlock(block: BlockIdentifier): Promise<BlockResponse> {\n return this.readProvider.getBlock(block);\n }\n getLiveBlocks(block: BlockIdentifier): Promise<string[]> {\n return this.readProvider.getLiveBlocks(block);\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/contracts-library\n */\n\nimport { EntrypointsResponse, ScriptedContracts } from '@taquito/rpc';\nimport { Extension, Context } from '@taquito/taquito';\nimport { validateAddress, ValidationResult, invalidErrorDetail } from '@taquito/utils';\nimport { InvalidScriptFormatError } from './errors';\nimport { ReadWrapperContractsLibrary } from './read-provider-wrapper';\nimport { InvalidAddressError } from '@taquito/core';\n\ninterface ContractsData {\n [contractAddress: string]: { script: ScriptedContracts; entrypoints: EntrypointsResponse };\n}\n\n/**\n * @description Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.\n *\n * @example\n * ```\n * import { ContractsLibrary } from '@taquito/contracts-library';\n * import { TezosToolkit } from '@taquito/taquito';\n *\n * const Tezos = new TezosToolkit('rpcUrl');\n * const contractsLibrary = new ContractsLibrary();\n *\n * contractsLibrary.addContract({\n * ['contractAddress1']: {\n * script: script1, // obtained from Tezos.rpc.getContract('contractAddress1').script\n * entrypoints: entrypoints1 // obtained from Tezos.rpc.getEntrypoints('contractAddress1')\n * },\n * // load more contracts\n * });\n *\n * Tezos.addExtension(contractsLibrary);\n * ```\n *\n */\nexport class ContractsLibrary implements Extension {\n private _contractsLibrary: ContractsData = {};\n\n /**\n * @description Saves one of several contract in the library\n *\n * @param contract is an object where the key is a contract address and the value is an object having a script and an entrypoints properties.\n * Note: the expected format for the script and entrypoints properties are the same as the one respectivlely returned by\n * `TezosToolkit.rpc.getContract('contractAddress').script` and `TezosToolkit.rpc.getEntrypoints`\n *\n */\n addContract(contract: ContractsData) {\n for (const contractAddress in contract) {\n this.validateContractAddress(contractAddress);\n this.validateContractScriptFormat(contract[contractAddress].script, contractAddress);\n Object.assign(this._contractsLibrary, {\n [contractAddress]: { ...contract[contractAddress] },\n });\n }\n }\n\n getContract(contractAddress: string) {\n return this._contractsLibrary[contractAddress];\n }\n\n configureContext(context: Context) {\n context.registerProviderDecorator((context: Context) => {\n context.readProvider = new ReadWrapperContractsLibrary(context.readProvider, this);\n return context;\n });\n }\n\n private validateContractAddress(address: string) {\n const addressValidation = validateAddress(address);\n if (addressValidation !== ValidationResult.VALID) {\n throw new InvalidAddressError(address, invalidErrorDetail(addressValidation));\n }\n }\n\n private validateContractScriptFormat(script: ScriptedContracts, address: string) {\n if (!script.code) {\n throw new InvalidScriptFormatError(\n `An invalid script property has been provided for ${address}. The script property can be retrieved from TezosToolkit.rpc.getNormalizedScript(${address}). Invalid script: ${script}`\n );\n }\n }\n}\n"],"names":["validateAddress","ValidationResult","InvalidAddressError","invalidErrorDetail"],"mappings":";;;;;;EAAA;;;EAGG;EACG,MAAO,wBAAyB,SAAQ,KAAK,CAAA;EACjD,IAAA,WAAA,CAAY,OAAe,EAAA;UACzB,KAAK,CAAC,OAAO,CAAC,CAAC;OAChB;E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YAAA,OAAO,OAAO,CAAC;EACjB,SAAC,CAAC,CAAC;OACJ;EAEO,IAAA,uBAAuB,CAAC,OAAe,EAAA;EAC7C,QAAA,MAAM,iBAAiB,GAAGA,qBAAe,CAAC,OAAO,CAAC,CAAC;EACnD,QAAA,IAAI,iBAAiB,KAAKC,sBAAgB,CAAC,KAAK,EAAE;cAChD,MAAM,IAAIC,wBAAmB,CAAC,OAAO,EAAEC,wBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;EAC/E,SAAA;OACF;MAEO,4BAA4B,CAAC,MAAyB,EAAE,OAAe,EAAA;EAC7E,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;cAChB,MAAM,IAAI,wBAAwB,CAChC,CAAoD,iDAAA,EAAA,OAAO,CAAoF,iFAAA,EAAA,OAAO,CAAsB,mBAAA,EAAA,MAAM,CAAE,CAAA,CACrL,CAAC;EACH,SAAA;OACF;EACF;;;;;;;;;;"}
@@ -1,10 +1,3 @@
1
- /**
2
- * @category Error
3
- * @description Error that indicates an invalid address being used or passed
4
- */
5
- export declare class InvalidAddressError extends Error {
6
- constructor(message: string);
7
- }
8
1
  /**
9
2
  * @category Error
10
3
  * @description Error that indicates invalid script format being useed or passed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/contracts-library",
3
- "version": "16.1.2",
3
+ "version": "16.2.0",
4
4
  "description": "Can be used as an extension on the TezosToolkit to provide contracts data",
5
5
  "keywords": [
6
6
  "tezos"
@@ -68,9 +68,10 @@
68
68
  ]
69
69
  },
70
70
  "dependencies": {
71
- "@taquito/rpc": "^16.1.2",
72
- "@taquito/taquito": "^16.1.2",
73
- "@taquito/utils": "^16.1.2",
71
+ "@taquito/core": "^16.2.0",
72
+ "@taquito/rpc": "^16.2.0",
73
+ "@taquito/taquito": "^16.2.0",
74
+ "@taquito/utils": "^16.2.0",
74
75
  "bignumber.js": "^9.1.0"
75
76
  },
76
77
  "devDependencies": {
@@ -102,5 +103,5 @@
102
103
  "ts-toolbelt": "^9.6.0",
103
104
  "typescript": "~4.1.5"
104
105
  },
105
- "gitHead": "f44e0fa20e017142543cf0ad49fc8220021f6d1c"
106
+ "gitHead": "148b11675d2c3d3a10ce20c02dcece388ef59414"
106
107
  }