@taquito/taquito 11.2.0-beta-RC.0 → 11.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 +1 @@
1
- {"version":3,"file":"taquito.es6.js","sources":["../src/forger/rpc-forger.ts","../src/injector/rpc-injector.ts","../src/signer/noop.ts","../src/constants.ts","../src/format.ts","../src/contract/errors.ts","../src/contract/prepare.ts","../src/operations/types.ts","../src/operations/operation-errors.ts","../src/operations/operations.ts","../src/operations/batch-operation.ts","../src/operations/operation-emitter.ts","../src/batch/rpc-batch-provider.ts","../src/wallet/receipt.ts","../src/wallet/operation.ts","../src/wallet/batch-operation.ts","../src/wallet/delegation-operation.ts","../src/wallet/origination-operation.ts","../src/wallet/transaction-operation.ts","../src/wallet/operation-factory.ts","../src/tz/rpc-tz-provider.ts","../src/contract/estimate.ts","../src/contract/rpc-estimate-provider.ts","../src/operations/delegate-operation.ts","../src/operations/origination-operation.ts","../src/operations/register-global-constant-operation.ts","../src/operations/reveal-operation.ts","../src/operations/transaction-operation.ts","../src/contract/manager-lambda.ts","../src/contract/view_lambda.ts","../src/contract/compose.ts","../src/contract/contract-methods/contract-method-flat-param.ts","../src/wallet/wallet.ts","../src/wallet/legacy.ts","../src/contract/contract-methods/contract-method-object-param.ts","../src/contract/contract-methods/contract-on-chain-view.ts","../src/contract/contract-methods/contract-method-factory.ts","../src/contract/lambda-view.ts","../src/contract/contract.ts","../src/contract/big-map.ts","../src/contract/sapling-state-abstraction.ts","../src/contract/semantic.ts","../src/contract/rpc-contract-provider.ts","../src/parser/michel-codec-parser.ts","../src/packer/rpc-packer.ts","../src/global-constants/error.ts","../src/global-constants/noop-global-constants-provider.ts","../src/context.ts","../src/subscribe/filters.ts","../src/subscribe/observable-subscription.ts","../src/subscribe/polling-provider.ts","../src/version.ts","../src/forger/composite-forger.ts","../src/parser/noop-parser.ts","../src/packer/michel-codec-packer.ts","../src/global-constants/default-global-constants-provider.ts","../src/taquito.ts"],"sourcesContent":["import { Forger, ForgeParams, ForgeResponse } from './interface';\nimport { Context } from '../context';\n\nexport class RpcForger implements Forger {\n constructor(private context: Context) {}\n\n forge({ branch, contents }: ForgeParams): Promise<ForgeResponse> {\n return this.context.rpc.forgeOperations({ branch, contents });\n }\n}\n","import { Injector } from './interface';\nimport { Context } from '../context';\n\nexport class RpcInjector implements Injector {\n constructor(private context: Context) {}\n inject(signedOperationBytes: string): Promise<string> {\n return this.context.rpc.injectOperation(signedOperationBytes);\n }\n}\n","import { Signer } from './interface';\n\nexport class UnconfiguredSignerError extends Error {\n name = 'UnconfiguredSignerError';\n\n constructor() {\n super(\n 'No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance.'\n );\n }\n}\n\n/**\n * @description Default signer implementation which does nothing and produce invalid signature\n */\nexport class NoopSigner implements Signer {\n async publicKey(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async publicKeyHash(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async secretKey(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async sign(_bytes: string, _watermark?: Uint8Array): Promise<any> {\n throw new UnconfiguredSignerError();\n }\n}\n","export enum DEFAULT_GAS_LIMIT {\n DELEGATION = 10600,\n ORIGINATION = 10600,\n TRANSFER = 10600,\n REVEAL = 1100,\n}\nexport enum DEFAULT_FEE {\n DELEGATION = 1257,\n ORIGINATION = 10000,\n TRANSFER = 10000,\n REVEAL = 374,\n}\nexport enum DEFAULT_STORAGE_LIMIT {\n DELEGATION = 0,\n ORIGINATION = 257,\n TRANSFER = 257,\n REVEAL = 0,\n}\n\nexport enum Protocols {\n Pt24m4xi = 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd',\n PsBABY5H = 'PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU',\n PsBabyM1 = 'PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS',\n PsCARTHA = 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb',\n PsDELPH1 = 'PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo',\n PtEdo2Zk = 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA',\n PsFLorena = 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i',\n PtGRANADs = 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV',\n PtHangz2 = 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx',\n PsiThaCa = 'PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP',\n Psithaca2 = 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A',\n ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash\n}\n\nexport const protocols = {\n '004': [Protocols.Pt24m4xi],\n '005': [Protocols.PsBABY5H, Protocols.PsBabyM1],\n '006': [Protocols.PsCARTHA],\n '007': [Protocols.PsDELPH1],\n '008': [Protocols.PtEdo2Zk], // edonet v2\n '009': [Protocols.PsFLorena],\n '010': [Protocols.PtGRANADs],\n '011': [Protocols.PtHangz2], // hangzhou v2,\n '012': [Protocols.PsiThaCa], //Ithaca\n '013': [Protocols.Psithaca2], //Ithaca2\n '014': [Protocols.ProtoALpha],\n};\n\nexport enum DefaultLambdaAddresses {\n MAINNET = 'KT1CPuTzwC7h7uLXd5WQmpMFso1HxrLBUtpE',\n CARTHAGENET = 'KT1VAy1o1FGiXYfD3YT7x7k5eF5HSHhmc1u6',\n DELPHINET = 'KT19abMFs3haqyKYwqdLjK9GbtofryZLvpiK',\n EDONET = 'KT1A64nVZDccAHGAsf1ZyVajXZcbiwjV3SnN',\n FLORENCENET = 'KT1KCe3YqGnudsiCWb5twbe2DH5T3EMdLpSE',\n GRANADANET = 'KT1BCun2vsA4GBQvsKAuGD5x873MfW2jsN9z',\n HANGZHOUNET = 'KT1PWtBAr1hjK9M9s9oZNZFbfzPdkkD6PSJR',\n ITHACANET = 'KT1CsEGfRHWeuUQFh9LfVFLVMbm7DFBuHPPU',\n ITHACANET2 = 'KT1H2a5vGkMLFGBPMs6oRRJshCvYeXSBSadn',\n}\n\nexport enum ChainIds {\n MAINNET = 'NetXdQprcVkpaWU',\n CARTHAGENET = 'NetXjD3HPJJjmcd',\n DELPHINET = 'NetXm8tYqnMWky1',\n EDONET = 'NetXSgo1ZT2DRUG',\n FLORENCENET = 'NetXxkAx4woPLyu',\n GRANADANET = 'NetXz969SFaFn8k',\n HANGZHOUNET = 'NetXZSsxBpMQeAT',\n ITHACANET = 'NetXbhmtAbMukLc',\n ITHACANET2 = 'NetXnHfVqm9iesp',\n}\n","import BigNumber from 'bignumber.js';\n\nconst TZ_DECIMALS = 6;\nconst MTZ_DECIMALS = 3;\n\ntype Format = 'tz' | 'mtz' | 'mutez';\n\nfunction getDecimal(format: Format) {\n switch (format) {\n case 'tz':\n return TZ_DECIMALS;\n case 'mtz':\n return MTZ_DECIMALS;\n case 'mutez':\n default:\n return 0;\n }\n}\n\nexport function format(\n from: Format = 'mutez',\n to: Format = 'mutez',\n amount: number | string | BigNumber\n) {\n const bigNum = new BigNumber(amount);\n if (bigNum.isNaN()) {\n return amount;\n }\n\n return bigNum\n .multipliedBy(Math.pow(10, getDecimal(from)))\n .dividedBy(Math.pow(10, getDecimal(to)));\n}\n","import { HttpResponseError } from '@taquito/http-utils';\nimport { MichelsonV1Expression } from '@taquito/rpc';\n\nexport class InvalidParameterError extends Error {\n name = 'Invalid parameters error';\n constructor(public smartContractMethodName: string, public sigs: any[], public args: any[]) {\n super(\n `${smartContractMethodName} Received ${\n args.length\n } arguments while expecting one of the following signatures (${JSON.stringify(sigs)})`\n );\n }\n}\n\nexport class UndefinedLambdaContractError extends Error {\n name = 'Undefined LambdaContract error';\n constructor() {\n super(\n 'This might happen if you are using a sandbox. Please provide the address of a lambda contract as a parameter of the read method.'\n );\n }\n}\nexport class InvalidDelegationSource extends Error {\n name = 'Invalid delegation source error';\n\n constructor(public source: string) {\n super(\n `Since Babylon delegation source can no longer be a contract address ${source}. Please use the smart contract abstraction to set your delegate.`\n );\n }\n}\n\nexport class InvalidCodeParameter extends Error {\n public name = 'InvalidCodeParameter';\n constructor(public message: string, public readonly data: any) {\n super(message);\n }\n}\n\nexport class InvalidInitParameter extends Error {\n public name = 'InvalidInitParameter';\n constructor(public message: string, public readonly data: any) {\n super(message);\n }\n}\n\nexport class InvalidViewParameterError extends Error {\n name = 'Invalid view parameters error';\n cause: any;\n constructor(\n public smartContractViewName: string,\n public sigs: any,\n public args: any,\n public originalError: any\n ) {\n super(\n `Unable to encode the parameter of the view: ${smartContractViewName}. Received ${args} as parameter while expecting one of the following signatures (${JSON.stringify(\n sigs\n )})`\n );\n this.cause = originalError;\n }\n}\n\nexport class ViewSimulationError extends Error {\n name = 'ViewSimulationError';\n constructor(public message: string, public originalError?: any) {\n super(message);\n }\n}\n\nexport const validateAndExtractFailwith = (\n error: HttpResponseError\n): MichelsonV1Expression | undefined => {\n if (isJsonString(error.body)) {\n const parsedError = JSON.parse(error.body);\n if (Array.isArray(parsedError) && 'with' in parsedError[parsedError.length - 1]) {\n return parsedError[parsedError.length - 1].with;\n }\n }\n};\n\nconst isJsonString = (str: string) => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n};\n\nexport class InvalidViewSimulationContext extends Error {\n public name = 'InvalidViewSimulationContext';\n constructor(public info: string) {\n super(`${info} Please configure the context of the view execution in the executeView method.`);\n }\n}\n","import { Schema } from '@taquito/michelson-encoder';\nimport { OpKind, MichelsonV1Expression } from '@taquito/rpc';\nimport { Prim, Expr } from '@taquito/michel-codec';\nimport {\n OriginateParams,\n RPCOriginationOperation,\n TransferParams,\n RPCTransferOperation,\n DelegateParams,\n RPCDelegateOperation,\n RegisterDelegateParams,\n RPCRevealOperation,\n RevealParams,\n RegisterGlobalConstantParams,\n RPCRegisterGlobalConstantOperation,\n} from '../operations/types';\nimport { DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_STORAGE_LIMIT } from '../constants';\nimport { format } from '../format';\nimport { InvalidCodeParameter, InvalidInitParameter } from './errors';\n\nexport const createOriginationOperation = async ({\n code,\n init,\n balance = '0',\n delegate,\n storage,\n fee = DEFAULT_FEE.ORIGINATION,\n gasLimit = DEFAULT_GAS_LIMIT.ORIGINATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.ORIGINATION,\n mutez = false,\n}: OriginateParams) => {\n if (storage !== undefined && init !== undefined) {\n throw new Error(\n 'Storage and Init cannot be set a the same time. Please either use storage or init but not both.'\n );\n }\n\n if (!Array.isArray(code)) {\n throw new InvalidCodeParameter('Wrong code parameter type, expected an array', code);\n }\n\n let contractStorage: Expr | undefined;\n if (storage !== undefined) {\n const storageType = (code as Expr[]).find(\n (p): p is Prim => 'prim' in p && p.prim === 'storage'\n );\n if (storageType?.args === undefined) {\n throw new InvalidCodeParameter('The storage section is missing from the script', code);\n }\n const schema = new Schema(storageType.args[0] as MichelsonV1Expression); // TODO\n contractStorage = schema.Encode(storage);\n } else if (init !== undefined && typeof init === 'object') {\n contractStorage = init as Expr;\n } else {\n throw new InvalidInitParameter('Wrong init parameter type, expected JSON Michelson', init);\n }\n\n const script = {\n code,\n storage: contractStorage,\n };\n\n const operation: RPCOriginationOperation = {\n kind: OpKind.ORIGINATION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n balance: mutez ? balance.toString() : format('tz', 'mutez', balance).toString(),\n script,\n };\n\n if (delegate) {\n operation.delegate = delegate;\n }\n return operation;\n};\n\nexport const createTransferOperation = async ({\n to,\n amount,\n parameter,\n fee = DEFAULT_FEE.TRANSFER,\n gasLimit = DEFAULT_GAS_LIMIT.TRANSFER,\n storageLimit = DEFAULT_STORAGE_LIMIT.TRANSFER,\n mutez = false,\n}: TransferParams) => {\n const operation: RPCTransferOperation = {\n kind: OpKind.TRANSACTION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n amount: mutez ? amount.toString() : format('tz', 'mutez', amount).toString(),\n destination: to,\n parameters: parameter,\n };\n return operation;\n};\n\nexport const createSetDelegateOperation = async ({\n delegate,\n source,\n fee = DEFAULT_FEE.DELEGATION,\n gasLimit = DEFAULT_GAS_LIMIT.DELEGATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.DELEGATION,\n}: DelegateParams) => {\n const operation: RPCDelegateOperation = {\n kind: OpKind.DELEGATION,\n source,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n delegate,\n };\n return operation;\n};\n\nexport const createRegisterDelegateOperation = async (\n {\n fee = DEFAULT_FEE.DELEGATION,\n gasLimit = DEFAULT_GAS_LIMIT.DELEGATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.DELEGATION,\n }: RegisterDelegateParams,\n source: string\n) => {\n return {\n kind: OpKind.DELEGATION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n delegate: source,\n } as RPCDelegateOperation;\n};\n\nexport const createRevealOperation = async (\n {\n fee = DEFAULT_FEE.REVEAL,\n gasLimit = DEFAULT_GAS_LIMIT.REVEAL,\n storageLimit = DEFAULT_STORAGE_LIMIT.REVEAL,\n }: RevealParams,\n source: string,\n publicKey: string\n) => {\n return {\n kind: OpKind.REVEAL,\n fee,\n public_key: publicKey,\n source,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n } as RPCRevealOperation;\n};\n\nexport const createRegisterGlobalConstantOperation = async ({\n value,\n source,\n fee,\n gasLimit,\n storageLimit,\n}: RegisterGlobalConstantParams) => {\n return {\n kind: OpKind.REGISTER_GLOBAL_CONSTANT,\n value,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n source,\n } as RPCRegisterGlobalConstantOperation;\n};\n","import {\n OperationObject,\n InternalOperationResultKindEnum,\n OpKind,\n TransactionOperationParameter,\n MichelsonV1Expression,\n} from '@taquito/rpc';\n\nexport { OpKind } from '@taquito/rpc';\n\nexport type withKind<T, K extends OpKind> = T & { kind: K };\n\nexport type ParamsWithKind =\n | withKind<OriginateParams, OpKind.ORIGINATION>\n | withKind<DelegateParams, OpKind.DELEGATION>\n | withKind<TransferParams, OpKind.TRANSACTION>\n | withKind<ActivationParams, OpKind.ACTIVATION>\n | withKind<RegisterGlobalConstantParams, OpKind.REGISTER_GLOBAL_CONSTANT>;\n\nexport type ParamsWithKindExtended =\n | ParamsWithKind\n | withKind<RevealParams, OpKind.REVEAL>\n\nexport const attachKind = <T, K extends OpKind>(op: T, kind: K) => {\n return { ...op, kind } as withKind<T, K>;\n};\n\nexport const findWithKind = <T extends { kind: OpKind }, K extends OpKind>(\n arr: T[],\n kind: K\n): (T & { kind: K }) | undefined => {\n if (Array.isArray(arr)) {\n const found = arr.find(op => op.kind === kind);\n\n if (found && isKind(found, kind)) {\n return found;\n }\n }\n};\n\nexport const isKind = <T extends { kind: OpKind }, K extends OpKind>(\n op: T,\n kind: K\n): op is withKind<T, K> => {\n return op.kind === kind;\n};\n\nexport type RPCOpWithFee =\n | RPCTransferOperation\n | RPCOriginationOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCRegisterGlobalConstantOperation;\nexport type RPCOpWithSource =\n | RPCTransferOperation\n | RPCOriginationOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCRegisterGlobalConstantOperation;\n\nexport const isOpWithFee = <T extends { kind: OpKind }>(\n op: T\n): op is withKind<T, InternalOperationResultKindEnum> => {\n return ['transaction', 'delegation', 'origination', 'reveal', 'register_global_constant'].indexOf(op.kind) !== -1;\n};\n\nexport const isOpRequireReveal = <T extends { kind: OpKind }>(\n op: T\n): op is withKind<T, Exclude<InternalOperationResultKindEnum, OpKind.REVEAL>> => {\n return ['transaction', 'delegation', 'origination', 'register_global_constant'].indexOf(op.kind) !== -1;\n};\n\nexport type SourceKinds = InternalOperationResultKindEnum;\n\nexport const isSourceOp = <T extends { kind: OpKind }>(op: T): op is withKind<T, SourceKinds> => {\n return ['transaction', 'delegation', 'origination', 'reveal', 'ballot'].indexOf(op.kind) !== -1;\n};\n\nexport const hasMetadata = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: K;\n} => {\n return 'metadata' in op;\n};\n\nexport const hasMetadataWithResult = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: {\n operation_result: K;\n };\n} => {\n return hasMetadata<T, any>(op) && 'operation_result' in op.metadata;\n};\n\nexport const hasMetadataWithInternalOperationResult = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: {\n internal_operation_results?: K;\n };\n} => {\n return hasMetadata<T, any>(op) && 'internal_operation_results' in op.metadata;\n};\n\nexport interface GasConsumingOperation {\n consumedGas?: string;\n gasLimit: number;\n}\n\nexport interface StorageConsumingOperation {\n storageDiff?: string;\n storageSize?: string;\n storageLimit: number;\n}\n\nexport interface FeeConsumingOperation {\n fee: number;\n}\n\nexport type OriginateParamsBase = {\n balance?: string;\n code: string | object[];\n delegate?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n mutez?: boolean;\n};\n\n/**\n * @description Parameters for originate method\n */\nexport type OriginateParams<TStorage = any> = OriginateParamsBase &\n (\n | {\n init?: never;\n /** JS representation of a storage object */\n storage: TStorage;\n }\n | {\n /** Initial storage object value. Either Micheline or JSON encoded */\n init: string | object;\n storage?: never;\n }\n );\n\nexport interface ActivationParams {\n pkh: string;\n secret: string;\n}\n\n/**\n * @description RPC origination operation\n */\nexport interface RPCOriginationOperation {\n kind: OpKind.ORIGINATION;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n balance: string;\n delegate?: string;\n source?: string;\n script: {\n code: any;\n storage: any;\n };\n}\n\n/**\n * @description RPC reveal operation\n */\nexport interface RPCRevealOperation {\n kind: OpKind.REVEAL;\n fee: number;\n public_key: string;\n source?: string;\n gas_limit: number;\n storage_limit: number;\n}\n\nexport interface RevealParams {\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n\n/**\n * @description Result of a forge operation contains the operation plus its encoded version\n */\nexport interface ForgedBytes {\n opbytes: string;\n opOb: OperationObject;\n counter: number;\n}\n\n/**\n * @description Parameters for setDelegate method\n */\nexport interface DelegateParams {\n source: string;\n delegate?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description Parameters for registerDelegate method\n */\nexport interface RegisterDelegateParams {\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description RPC delegation operation\n */\nexport interface RPCDelegateOperation {\n kind: OpKind.DELEGATION;\n source?: string;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n delegate?: string;\n}\n\n/**\n * @description Parameters for transfer method\n */\nexport interface TransferParams {\n to: string;\n source?: string;\n amount: number;\n fee?: number;\n parameter?: TransactionOperationParameter;\n gasLimit?: number;\n storageLimit?: number;\n mutez?: boolean;\n}\n\n/**\n * @description RPC register global constant operation\n */\n export interface RPCRegisterGlobalConstantOperation {\n kind: OpKind.REGISTER_GLOBAL_CONSTANT;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n source: string;\n value: MichelsonV1Expression;\n}\n\n/**\n * @description Parameters for the `registerGlobalConstant` method\n */\nexport interface RegisterGlobalConstantParams {\n value: MichelsonV1Expression;\n source?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description RPC transfer operation\n */\nexport interface RPCTransferOperation {\n kind: OpKind.TRANSACTION;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n amount: string;\n source?: string;\n destination: string;\n parameters?: TransactionOperationParameter;\n}\n\n/**\n * @description RPC activate account operation\n */\nexport interface RPCActivateOperation {\n kind: OpKind.ACTIVATION;\n pkh: string;\n secret: string;\n}\n\nexport type RPCOperation =\n | RPCOriginationOperation\n | RPCTransferOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCActivateOperation\n | RPCRegisterGlobalConstantOperation;\n\nexport type PrepareOperationParams = {\n operation: RPCOperation | RPCOperation[];\n source?: string;\n};\n","import {\n MichelsonV1ExpressionBase,\n OperationResultDelegation,\n OperationResultOrigination,\n OperationResultRegisterGlobalConstant,\n OperationResultReveal,\n OperationResultTransaction,\n PreapplyResponse,\n TezosGenericOperationError,\n} from '@taquito/rpc';\nimport {\n hasMetadata,\n hasMetadataWithInternalOperationResult,\n hasMetadataWithResult,\n} from './types';\n\nexport interface TezosOperationErrorWithMessage extends TezosGenericOperationError {\n with: MichelsonV1ExpressionBase;\n}\n\nconst isErrorWithMessage = (error: any): error is TezosOperationErrorWithMessage => {\n return 'with' in error;\n};\n\nexport class TezosOperationError extends Error {\n name = 'TezosOperationError';\n id: string;\n kind: string;\n\n constructor(public errors: TezosGenericOperationError[]) {\n super();\n // Last error is 'often' the one with more detail\n const lastError = errors[errors.length - 1];\n\n this.id = lastError.id;\n this.kind = lastError.kind;\n\n this.message = `(${this.kind}) ${this.id}`;\n\n if (isErrorWithMessage(lastError) && lastError.with.string) {\n this.message = lastError.with.string;\n }\n }\n}\n\nexport class TezosPreapplyFailureError extends Error {\n name = 'TezosPreapplyFailureError';\n\n constructor(public result: any) {\n super('Preapply returned an unexpected result');\n }\n}\n\nexport type MergedOperationResult = OperationResultDelegation &\n OperationResultOrigination &\n OperationResultTransaction &\n OperationResultRegisterGlobalConstant &\n OperationResultReveal & {\n fee?: string;\n };\n\n// Flatten all operation content results and internal operation results into a single array\n// Some cases where we can have multiple operation results or internal operation results are:\n// - When an operation includes a reveal operation\n// - When an operation is made using the batch API\n// - Smart contract call can contains internal operation results when they call other smart contract internally or originate contracts\nexport const flattenOperationResult = (response: PreapplyResponse | PreapplyResponse[]) => {\n const results = Array.isArray(response) ? response : [response];\n\n const returnedResults: MergedOperationResult[] = [];\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n const content = results[i].contents[j];\n if (hasMetadataWithResult(content)) {\n returnedResults.push({\n fee: content.fee,\n ...content.metadata.operation_result,\n });\n\n if (Array.isArray(content.metadata.internal_operation_results)) {\n content.metadata.internal_operation_results.forEach((x) =>\n returnedResults.push(x.result)\n );\n }\n }\n }\n }\n\n return returnedResults;\n};\n\n/***\n * @description Flatten all error from preapply response (including internal error)\n */\nexport const flattenErrors = (\n response: PreapplyResponse | PreapplyResponse[],\n status = 'failed'\n) => {\n const results = Array.isArray(response) ? response : [response];\n\n let errors: TezosGenericOperationError[] = [];\n // Transaction that do not fail will be backtracked in case one failure occur\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n const content = results[i].contents[j];\n if (hasMetadata(content)) {\n if (hasMetadataWithResult(content) && content.metadata.operation_result.status === status) {\n errors = errors.concat(content.metadata.operation_result.errors || []);\n }\n if (\n hasMetadataWithInternalOperationResult(content) &&\n Array.isArray(content.metadata.internal_operation_results)\n ) {\n for (const internalResult of content.metadata.internal_operation_results) {\n if ('result' in internalResult && internalResult.result.status === status) {\n errors = errors.concat(internalResult.result.errors || []);\n }\n }\n }\n }\n }\n }\n\n return errors;\n};\n","import {\n BlockResponse,\n OperationContentsAndResult,\n OperationContentsAndResultReveal,\n} from '@taquito/rpc';\nimport { defer, EMPTY, from, of, ReplaySubject, timer } from 'rxjs';\nimport {\n catchError,\n filter,\n first,\n map,\n mapTo,\n shareReplay,\n switchMap,\n switchMapTo,\n tap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { ForgedBytes, hasMetadataWithResult } from './types';\nimport { validateOperation, ValidationResult, InvalidOperationHashError } from '@taquito/utils';\n\ninterface PollingConfig {\n timeout: number;\n interval: number;\n}\n\n/**\n * @description Utility class to interact with Tezos operations\n */\nexport class Operation {\n private _pollingConfig$ = new ReplaySubject<PollingConfig>(1);\n\n private _currentHeadPromise: Promise<BlockResponse> | undefined = undefined;\n\n // Caching the current head for one second\n private currentHead$ = defer(() => {\n if (!this._currentHeadPromise) {\n this._currentHeadPromise = this.context.rpc.getBlock();\n timer(1000)\n .pipe(first())\n .subscribe(() => {\n this._currentHeadPromise = undefined;\n });\n }\n return from(this._currentHeadPromise);\n });\n\n // Polling observable that emit until timeout is reached\n private polling$ = defer(() =>\n this._pollingConfig$.pipe(\n tap(({ timeout, interval }) => {\n if (timeout <= 0) {\n throw new Error('Timeout must be more than 0');\n }\n\n if (interval <= 0) {\n throw new Error('Interval must be more than 0');\n }\n }),\n map((config) => ({\n ...config,\n timeoutAt: Math.ceil(config.timeout / config.interval) + 1,\n count: 0,\n })),\n switchMap((config) => timer(0, config.interval * 1000).pipe(mapTo(config))),\n tap((config) => {\n config.count++;\n if (config.count > config.timeoutAt) {\n throw new Error(`Confirmation polling timed out`);\n }\n })\n )\n );\n\n // Observable that emit once operation is seen in a block\n private confirmed$ = this.polling$.pipe(\n switchMapTo(this.currentHead$),\n map((head) => {\n for (let i = 3; i >= 0; i--) {\n head.operations[i].forEach((op) => {\n if (op.hash === this.hash) {\n this._foundAt = head.header.level;\n }\n });\n }\n\n if (head.header.level - this._foundAt >= 0) {\n return this._foundAt;\n }\n }),\n filter((x) => x !== undefined),\n first(),\n shareReplay()\n );\n\n protected _foundAt = Number.POSITIVE_INFINITY;\n get includedInBlock() {\n return this._foundAt;\n }\n /**\n *\n * @param hash Operation hash\n * @param raw Raw operation that was injected\n * @param context Taquito context allowing access to rpc and signer\n */\n constructor(\n public readonly hash: string,\n public readonly raw: ForgedBytes,\n public readonly results: OperationContentsAndResult[],\n protected readonly context: Context\n ) {\n if (validateOperation(this.hash) !== ValidationResult.VALID) {\n throw new InvalidOperationHashError(`Invalid Operation Hash: ${this.hash}`);\n }\n\n this.confirmed$.pipe(first(),\n catchError(() => {\n return of(EMPTY)\n })\n ).subscribe();\n }\n\n get revealOperation() {\n return (\n Array.isArray(this.results) &&\n (this.results.find((op) => op.kind === 'reveal') as\n | OperationContentsAndResultReveal\n | undefined)\n );\n }\n\n public get revealStatus() {\n if (this.revealOperation) {\n return this.revealOperation.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n public get status() {\n return (\n this.results.map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n\n /**\n *\n * @param confirmations [0] Number of confirmation to wait for\n * @param interval [10] Polling interval\n * @param timeout [180] Timeout\n */\n async confirmation(confirmations?: number, interval?: number, timeout?: number) {\n if (typeof confirmations !== 'undefined' && confirmations < 1) {\n throw new Error('Confirmation count must be at least 1');\n }\n\n const confirmationPollingIntervalSecond =\n this.context.config.confirmationPollingIntervalSecond !== undefined\n ? this.context.config.confirmationPollingIntervalSecond\n : await this.context.getConfirmationPollingInterval();\n\n const { defaultConfirmationCount, confirmationPollingTimeoutSecond } = this.context.config;\n this._pollingConfig$.next({\n interval: interval || confirmationPollingIntervalSecond,\n timeout: timeout || confirmationPollingTimeoutSecond,\n } as Required<PollingConfig>);\n\n const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;\n\n return new Promise<number>((resolve, reject) => {\n this.confirmed$\n .pipe(\n switchMap(() => this.polling$),\n switchMap(() => this.currentHead$),\n filter((head) => head.header.level - this._foundAt >= conf - 1),\n first()\n )\n .subscribe((_) => {\n resolve(this._foundAt + (conf - 1));\n }, reject);\n });\n }\n}\n","import { OperationContentsAndResult } from '@taquito/rpc';\nimport { BATCH_KINDS } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCOperation,\n StorageConsumingOperation,\n hasMetadataWithResult,\n} from './types';\n\nexport class BatchOperation\n extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation\n{\n constructor(\n hash: string,\n private readonly params: RPCOperation[],\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n public get status() {\n return (\n this.results\n .filter((result) => BATCH_KINDS.indexOf(result.kind) !== -1)\n .map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n\n get fee() {\n return this.sumProp(this.params, 'fee');\n }\n\n get gasLimit() {\n return this.sumProp(this.params, 'gas_limit');\n }\n\n get storageLimit() {\n return this.sumProp(this.params, 'storage_limit');\n }\n\n get consumedGas() {\n return String(this.sumProp(flattenOperationResult({ contents: this.results }), 'consumed_gas'));\n }\n\n get storageDiff() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.results }), 'paid_storage_size_diff')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.results });\n }\n}\n","import {\n BlockHeaderResponse,\n OperationContents,\n OperationContentsAndResult,\n OpKind,\n RpcClientInterface,\n RPCRunOperationParam,\n} from '@taquito/rpc';\nimport { Protocols } from '../constants';\nimport { Context } from '../context';\nimport { Estimate } from '../contract/estimate';\nimport { flattenErrors, TezosOperationError, TezosPreapplyFailureError } from './operation-errors';\nimport {\n ForgedBytes,\n isOpRequireReveal,\n ParamsWithKind,\n PrepareOperationParams,\n RPCOperation,\n RPCOpWithFee,\n RPCOpWithSource,\n} from './types';\n\nexport interface PreparedOperation {\n opOb: {\n branch: string;\n contents: OperationContents[];\n protocol: string;\n };\n counter: number;\n}\n\nexport abstract class OperationEmitter {\n get rpc(): RpcClientInterface {\n return this.context.rpc;\n }\n\n get signer() {\n return this.context.signer;\n }\n\n constructor(protected context: Context) {}\n\n protected async isRevealOpNeeded(op: RPCOperation[] | ParamsWithKind[], pkh: string) {\n return !(await this.isAccountRevealRequired(pkh)) || !this.isRevealRequiredForOpType(op)\n ? false\n : true;\n }\n\n protected async isAccountRevealRequired(publicKeyHash: string) {\n const manager = await this.rpc.getManagerKey(publicKeyHash);\n const haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager;\n return !haveManager;\n }\n\n protected isRevealRequiredForOpType(op: RPCOperation[] | ParamsWithKind[]) {\n let opRequireReveal = false;\n for (const operation of op) {\n if (isOpRequireReveal(operation)) {\n opRequireReveal = true;\n }\n }\n return opRequireReveal;\n }\n\n // Originally from sotez (Copyright (c) 2018 Andrew Kishino)\n protected async prepareOperation({\n operation,\n source,\n }: PrepareOperationParams): Promise<PreparedOperation> {\n const counters: { [key: string]: number } = {};\n let ops: RPCOperation[] = [];\n\n const blockHeaderPromise = this.rpc.getBlockHeader({ block: 'head~2' });\n const blockMetaPromise = this.rpc.getBlockMetadata();\n\n if (Array.isArray(operation)) {\n ops = [...operation];\n } else {\n ops = [operation];\n }\n\n // Implicit account who emit the operation\n const publicKeyHash = await this.signer.publicKeyHash();\n let counterPromise: Promise<string | undefined> = Promise.resolve(undefined);\n\n for (let i = 0; i < ops.length; i++) {\n if (isOpRequireReveal(ops[i]) || ops[i].kind === 'reveal') {\n const { counter } = await this.rpc.getContract(publicKeyHash);\n counterPromise = Promise.resolve(counter);\n break;\n }\n }\n\n const [header, metadata, headCounter] = await Promise.all([\n blockHeaderPromise,\n blockMetaPromise,\n counterPromise,\n ]);\n\n if (!header) {\n throw new Error('Unable to fetch latest block header');\n }\n\n if (!metadata) {\n throw new Error('Unable to fetch latest metadata');\n }\n\n const head = header;\n\n const counter = parseInt(headCounter || '0', 10);\n if (!counters[publicKeyHash] || counters[publicKeyHash] < counter) {\n counters[publicKeyHash] = counter;\n }\n\n const getFee = (op: RPCOpWithFee) => {\n const opCounter = ++counters[publicKeyHash];\n return {\n counter: `${opCounter}`,\n fee: typeof op.fee === 'undefined' ? '0' : `${op.fee}`,\n gas_limit: typeof op.gas_limit === 'undefined' ? '0' : `${op.gas_limit}`,\n storage_limit: typeof op.storage_limit === 'undefined' ? '0' : `${op.storage_limit}`,\n };\n };\n\n const getSource = (op: RPCOpWithSource) => {\n return {\n source: typeof op.source === 'undefined' ? source || publicKeyHash : op.source,\n };\n };\n\n const constructOps = (cOps: RPCOperation[]): OperationContents[] =>\n cOps.map((op: RPCOperation) => {\n switch (op.kind) {\n case OpKind.ACTIVATION:\n return {\n ...op,\n };\n case OpKind.REVEAL:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.ORIGINATION:\n return {\n ...op,\n balance: typeof op.balance !== 'undefined' ? `${op.balance}` : '0',\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.TRANSACTION: {\n const cops = {\n ...op,\n amount: typeof op.amount !== 'undefined' ? `${op.amount}` : '0',\n ...getSource(op),\n ...getFee(op),\n };\n if (cops.source.toLowerCase().startsWith('kt1')) {\n throw new Error(\n `KT1 addresses are not supported as source since ${Protocols.PsBabyM1}`\n );\n }\n return cops;\n }\n case OpKind.DELEGATION:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n default:\n throw new Error('Unsupported operation');\n }\n });\n\n const branch = head.hash;\n const contents = constructOps(ops);\n const protocol = metadata.next_protocol;\n\n return {\n opOb: {\n branch,\n contents,\n protocol,\n },\n counter,\n };\n }\n\n protected async forge({ opOb: { branch, contents, protocol }, counter }: PreparedOperation) {\n const forgedBytes = await this.context.forger.forge({ branch, contents });\n\n return {\n opbytes: forgedBytes,\n opOb: {\n branch,\n contents,\n protocol,\n },\n counter,\n };\n }\n\n protected async simulate(op: RPCRunOperationParam) {\n return {\n opResponse: await this.rpc.runOperation(op),\n op,\n context: this.context.clone(),\n };\n }\n\n protected async estimate<T extends { fee?: number; gasLimit?: number; storageLimit?: number }>(\n { fee, gasLimit, storageLimit, ...rest }: T,\n estimator: (param: T) => Promise<Estimate>\n ) {\n let calculatedFee = fee;\n let calculatedGas = gasLimit;\n let calculatedStorage = storageLimit;\n\n if (fee === undefined || gasLimit === undefined || storageLimit === undefined) {\n const estimation = await estimator({ fee, gasLimit, storageLimit, ...(rest as any) });\n\n if (calculatedFee === undefined) {\n calculatedFee = estimation.suggestedFeeMutez;\n }\n\n if (calculatedGas === undefined) {\n calculatedGas = estimation.gasLimit;\n }\n\n if (calculatedStorage === undefined) {\n calculatedStorage = estimation.storageLimit;\n }\n }\n\n return {\n fee: calculatedFee,\n gasLimit: calculatedGas,\n storageLimit: calculatedStorage,\n };\n }\n\n protected async signAndInject(forgedBytes: ForgedBytes) {\n const signed = await this.signer.sign(forgedBytes.opbytes, new Uint8Array([3]));\n forgedBytes.opbytes = signed.sbytes;\n forgedBytes.opOb.signature = signed.prefixSig;\n\n const opResponse: OperationContentsAndResult[] = [];\n const results = await this.rpc.preapplyOperations([forgedBytes.opOb]);\n\n if (!Array.isArray(results)) {\n throw new TezosPreapplyFailureError(results);\n }\n\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n opResponse.push(results[i].contents[j]);\n }\n }\n\n const errors = flattenErrors(results);\n\n if (errors.length) {\n throw new TezosOperationError(errors);\n }\n\n return {\n hash: await this.context.injector.inject(forgedBytes.opbytes),\n forgedBytes,\n opResponse,\n context: this.context.clone(),\n };\n }\n}\n","import { Context } from '../context';\nimport { ContractStorageType, DefaultContractType } from '../contract/contract';\nimport { ContractMethod } from '../contract/contract-methods/contract-method-flat-param';\nimport { EstimationProvider, ContractProvider } from '../contract/interface';\nimport {\n createOriginationOperation,\n createRegisterGlobalConstantOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n} from '../contract/prepare';\nimport { BatchOperation } from '../operations/batch-operation';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport {\n ActivationParams,\n DelegateParams,\n OriginateParams,\n RPCOperation,\n TransferParams,\n ParamsWithKind,\n isOpWithFee,\n withKind,\n RevealParams,\n RegisterGlobalConstantParams,\n} from '../operations/types';\nimport { OpKind } from '@taquito/rpc';\nimport { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param';\nimport { \n validateAddress, \n validateKeyHash, \n InvalidAddressError, \n InvalidKeyHashError, \n ValidationResult \n} from '@taquito/utils'\n\nexport const BATCH_KINDS = [\n OpKind.ACTIVATION,\n OpKind.ORIGINATION,\n OpKind.TRANSACTION,\n OpKind.DELEGATION,\n];\nexport type BatchKinds =\n | OpKind.ACTIVATION\n | OpKind.ORIGINATION\n | OpKind.TRANSACTION\n | OpKind.DELEGATION;\n\nexport class OperationBatch extends OperationEmitter {\n private operations: ParamsWithKind[] = [];\n\n constructor(context: Context, private estimator: EstimationProvider) {\n super(context);\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withTransfer(params: TransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`)\n }\n this.operations.push({ kind: OpKind.TRANSACTION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withContractCall(params: ContractMethod<ContractProvider> | ContractMethodObject<ContractProvider>) {\n return this.withTransfer(params.toTransferParams());\n }\n\n /**\n *\n * @description Add a delegation operation to the batch\n *\n * @param params Delegation operation parameter\n */\n withDelegation(params: DelegateParams) {\n if (params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source address: ${params.source}`);\n }\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${params.delegate}`);\n }\n this.operations.push({ kind: OpKind.DELEGATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an activation operation to the batch\n *\n * @param params Activation operation parameter\n */\n withActivation({ pkh, secret }: ActivationParams) {\n if (validateKeyHash(pkh) !== ValidationResult.VALID) {\n throw new InvalidKeyHashError(`Invalid Key Hash: ${pkh}`);\n }\n this.operations.push({ kind: OpKind.ACTIVATION, pkh, secret });\n return this;\n }\n\n /**\n *\n * @description Add an origination operation to the batch\n *\n * @param params Origination operation parameter\n */\n withOrigination<TContract extends DefaultContractType = DefaultContractType>(params: OriginateParams<ContractStorageType<TContract>>) {\n this.operations.push({ kind: OpKind.ORIGINATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an operation to register a global constant to the batch\n *\n * @param params RegisterGlobalConstant operation parameter\n */\n withRegisterGlobalConstant(params: RegisterGlobalConstantParams) {\n this.operations.push({ kind: OpKind.REGISTER_GLOBAL_CONSTANT, ...params });\n return this;\n }\n\n private async getRPCOp(param: ParamsWithKind) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n return createTransferOperation({\n ...param,\n });\n case OpKind.ORIGINATION:\n return createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...param,\n }));\n case OpKind.DELEGATION:\n return createSetDelegateOperation({\n ...param,\n });\n case OpKind.ACTIVATION:\n return {\n ...param,\n };\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n return createRegisterGlobalConstantOperation({\n ...param,\n });\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n /**\n *\n * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array\n *\n * @param params Operations parameter\n */\n with(params: ParamsWithKind[]) {\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n this.withTransfer(param);\n break;\n case OpKind.ORIGINATION:\n this.withOrigination(param);\n break;\n case OpKind.DELEGATION:\n this.withDelegation(param);\n break;\n case OpKind.ACTIVATION:\n this.withActivation(param);\n break;\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n this.withRegisterGlobalConstant(param);\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n return this;\n }\n\n /**\n *\n * @description Forge and Inject the operation batch\n *\n * @param params Optionally specify the source of the operation\n */\n async send(params?: { source?: string }) {\n const publicKeyHash = await this.signer.publicKeyHash();\n const publicKey = await this.signer.publicKey();\n const estimates = await this.estimator.batch(this.operations);\n\n const revealNeeded = await this.isRevealOpNeeded(this.operations, publicKeyHash);\n let i = revealNeeded ? 1 : 0;\n\n const ops: RPCOperation[] = [];\n for (const op of this.operations) {\n if (isOpWithFee(op)) {\n const estimated = await this.estimate(op, async () => estimates[i]);\n ops.push(await this.getRPCOp({ ...op, ...estimated }));\n } else {\n ops.push({ ...op });\n }\n i++;\n }\n if (revealNeeded) {\n const reveal: withKind<RevealParams, OpKind.REVEAL> = { kind: OpKind.REVEAL }\n const estimatedReveal = await this.estimate(reveal, async () => estimates[0]);\n ops.unshift(await createRevealOperation({ ...estimatedReveal }, publicKeyHash, publicKey))\n }\n\n const source = (params && params.source) || publicKeyHash;\n const prepared = await this.prepareOperation({\n operation: ops,\n source,\n });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new BatchOperation(hash, ops, source, forgedBytes, opResponse, context);\n }\n}\n\nexport class RPCBatchProvider {\n constructor(private context: Context, private estimator: EstimationProvider) { }\n\n /***\n *\n * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch\n *\n * @param params List of operation to batch together\n */\n batch(params?: ParamsWithKind[]) {\n const batch = new OperationBatch(this.context, this.estimator);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n}\n","import { OperationContentsAndResult } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { flattenOperationResult } from '../operations/operation-errors';\n\nexport interface Receipt {\n totalFee: BigNumber;\n totalGas: BigNumber;\n totalStorage: BigNumber;\n totalAllocationBurn: BigNumber;\n totalOriginationBurn: BigNumber;\n totalPaidStorageDiff: BigNumber;\n totalStorageBurn: BigNumber;\n}\n\nexport const receiptFromOperation = (\n op: OperationContentsAndResult[],\n { ALLOCATION_BURN, ORIGINATION_BURN } = {\n ALLOCATION_BURN: 257,\n ORIGINATION_BURN: 257,\n }\n): Receipt => {\n const operationResults = flattenOperationResult({ contents: op });\n let totalGas = new BigNumber(0);\n let totalStorage = new BigNumber(0);\n let totalFee = new BigNumber(0);\n let totalOriginationBurn = new BigNumber(0);\n let totalAllocationBurn = new BigNumber(0);\n let totalPaidStorageDiff = new BigNumber(0);\n operationResults.forEach(result => {\n totalFee = totalFee.plus(result.fee || 0);\n totalOriginationBurn = totalOriginationBurn.plus(\n Array.isArray(result.originated_contracts)\n ? result.originated_contracts.length * ORIGINATION_BURN\n : 0\n );\n totalAllocationBurn = totalAllocationBurn.plus(\n 'allocated_destination_contract' in result ? ALLOCATION_BURN : 0\n );\n totalGas = totalGas.plus(result.consumed_gas || 0);\n totalPaidStorageDiff = totalPaidStorageDiff.plus(\n 'paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0\n );\n });\n\n totalStorage = totalStorage\n .plus(totalAllocationBurn)\n .plus(totalOriginationBurn)\n .plus(totalPaidStorageDiff);\n\n return {\n totalFee,\n totalGas,\n totalStorage,\n totalAllocationBurn,\n totalOriginationBurn,\n totalPaidStorageDiff,\n totalStorageBurn: new BigNumber(totalStorage.multipliedBy(1000)),\n };\n};\n","import { BlockResponse, OperationContentsAndResult, OperationResultStatusEnum } from '@taquito/rpc';\nimport { combineLatest, from, Observable, of, ReplaySubject } from 'rxjs';\nimport {\n catchError,\n distinctUntilChanged,\n filter,\n first,\n map,\n shareReplay,\n takeWhile,\n tap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { Receipt, receiptFromOperation } from './receipt';\nimport { validateOperation, ValidationResult, InvalidOperationHashError } from '@taquito/utils';\n\nexport type OperationStatus = 'pending' | 'unknown' | OperationResultStatusEnum;\n\nexport class MissedBlockDuringConfirmationError extends Error {\n name = 'MissedBlockDuringConfirmationError';\n\n constructor() {\n super(\n 'Taquito missed a block while waiting for operation confirmation and was not able to find the operation'\n );\n }\n}\n\nconst MAX_BRANCH_ANCESTORS = 60;\n\n/**\n * @description WalletOperation allows to monitor operation inclusion on chains and surface information related to the operation\n */\nexport class WalletOperation {\n protected _operationResult = new ReplaySubject<OperationContentsAndResult[]>(1);\n protected _includedInBlock = new ReplaySubject<BlockResponse>(1);\n protected _included = false;\n\n private lastHead: BlockResponse | undefined;\n protected newHead$: Observable<BlockResponse> = this._newHead$.pipe(\n tap((newHead) => {\n if (\n !this._included &&\n this.lastHead &&\n newHead.header.level - this.lastHead.header.level > 1\n ) {\n throw new MissedBlockDuringConfirmationError();\n }\n\n this.lastHead = newHead;\n }),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n // Observable that emit once operation is seen in a block\n private confirmed$ = this.newHead$.pipe(\n map((head) => {\n for (const opGroup of head.operations) {\n for (const op of opGroup) {\n if (op.hash === this.opHash) {\n this._included = true;\n this._includedInBlock.next(head);\n this._operationResult.next(op.contents as OperationContentsAndResult[]);\n\n // Return the block where the operation was found\n return head;\n }\n }\n }\n }),\n filter<BlockResponse | undefined, BlockResponse>((x): x is BlockResponse => {\n return typeof x !== 'undefined';\n }),\n first(),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n async operationResults() {\n return this._operationResult.pipe(first()).toPromise();\n }\n\n /**\n * @description Receipt expose the total amount of tezos token burn and spent on fees\n * The promise returned by receipt will resolve only once the transaction is included\n */\n async receipt(): Promise<Receipt> {\n return receiptFromOperation(await this.operationResults());\n }\n\n /**\n *\n * @param opHash Operation hash\n * @param raw Raw operation that was injected\n * @param context Taquito context allowing access to rpc and signer\n */\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n private _newHead$: Observable<BlockResponse>\n ) {\n if (validateOperation(this.opHash) !== ValidationResult.VALID) {\n throw new InvalidOperationHashError(`Invalid operation hash: ${this.opHash}`);\n }\n this.confirmed$\n .pipe(\n first(),\n catchError(() => of(undefined))\n )\n .subscribe();\n }\n\n async getCurrentConfirmation() {\n if (!this._included) {\n return 0;\n }\n\n return combineLatest([this._includedInBlock, from(this.context.rpc.getBlock())])\n .pipe(\n map(([foundAtBlock, head]) => {\n return head.header.level - foundAtBlock.header.level + 1;\n }),\n first()\n )\n .toPromise();\n }\n\n async isInCurrentBranch(tipBlockIdentifier = 'head') {\n // By default it is assumed that the operation is in the current branch\n if (!this._included) {\n return true;\n }\n\n const tipBlockHeader = await this.context.rpc.getBlockHeader({ block: tipBlockIdentifier });\n const inclusionBlock = await this._includedInBlock.pipe(first()).toPromise();\n\n const levelDiff = tipBlockHeader.level - inclusionBlock.header.level;\n\n // Block produced before the operation is included are assumed to be part of the current branch\n if (levelDiff <= 0) {\n return true;\n }\n\n const tipBlockLevel = Math.min(\n inclusionBlock.header.level + levelDiff,\n inclusionBlock.header.level + MAX_BRANCH_ANCESTORS\n );\n\n const blocks = new Set(await this.context.rpc.getLiveBlocks({ block: String(tipBlockLevel) }));\n return blocks.has(inclusionBlock.hash);\n }\n\n confirmationObservable(confirmations?: number) {\n if (typeof confirmations !== 'undefined' && confirmations < 1) {\n throw new Error('Confirmation count must be at least 1');\n }\n\n const { defaultConfirmationCount } = this.context.config;\n\n const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;\n\n if (conf === undefined) {\n throw new Error('Default confirmation count can not be undefined!');\n }\n\n return combineLatest([this._includedInBlock, this.newHead$]).pipe(\n distinctUntilChanged(([, previousHead], [, newHead]) => {\n return previousHead.hash === newHead.hash;\n }),\n map(([foundAtBlock, head]) => {\n return {\n block: head,\n expectedConfirmation: conf,\n currentConfirmation: head.header.level - foundAtBlock.header.level + 1,\n completed: head.header.level - foundAtBlock.header.level >= conf - 1,\n isInCurrentBranch: () => this.isInCurrentBranch(head.hash),\n };\n }),\n takeWhile(({ completed }) => !completed, true)\n );\n }\n\n /**\n *\n * @param confirmations [0] Number of confirmation to wait for\n */\n confirmation(confirmations?: number) {\n return this.confirmationObservable(confirmations).toPromise();\n }\n}\n","import { BlockResponse, OperationContentsAndResultReveal, OpKind } from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { BATCH_KINDS } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { hasMetadataWithResult } from '../operations/types';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class BatchWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.operationResults();\n\n return (\n op\n .filter((result) => BATCH_KINDS.indexOf(result.kind) !== -1)\n .map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n}\n","import { BlockResponse, OperationContentsAndResultReveal, OpKind } from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { Context } from '../context';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class DelegationWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async delegationOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.DELEGATION) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.delegationOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n}\n","import {\n BlockResponse,\n OperationContentsAndResultOrigination,\n OperationContentsAndResultReveal,\n OpKind,\n} from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { Context } from '../context';\nimport { DefaultWalletType } from '../contract/contract';\nimport { findWithKind } from '../operations/types';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class OriginationWalletOperation<TWallet extends DefaultWalletType = DefaultWalletType> extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async originationOperation() {\n const operationResult = await this.operationResults();\n return findWithKind(operationResult, OpKind.ORIGINATION) as\n | OperationContentsAndResultOrigination\n | undefined;\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return findWithKind(operationResult, OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.originationOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n\n public async contract() {\n const op = await this.originationOperation();\n const address = (op?.metadata.operation_result.originated_contracts || [])[0];\n return this.context.wallet.at<TWallet>(address);\n }\n}\n","import { WalletOperation, OperationStatus } from './operation';\nimport { Context } from '../context';\nimport { Observable } from 'rxjs';\nimport {\n BlockResponse,\n OpKind,\n OperationContentsAndResultReveal,\n OperationContentsAndResultTransaction,\n} from '@taquito/rpc';\n\nexport class TransactionWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async transactionOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.TRANSACTION) as\n | OperationContentsAndResultTransaction\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.transactionOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n}\n","import { BlockResponse } from '@taquito/rpc';\nimport {\n concat,\n defer,\n from,\n MonoTypeOperatorFunction,\n Observable,\n of,\n range,\n ReplaySubject,\n SchedulerLike,\n throwError,\n timer,\n} from 'rxjs';\nimport {\n concatMap,\n distinctUntilKeyChanged,\n first,\n shareReplay,\n startWith,\n switchMap,\n timeoutWith,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { BatchWalletOperation } from './batch-operation';\nimport { DelegationWalletOperation } from './delegation-operation';\nimport { WalletOperation } from './operation';\nimport { OriginationWalletOperation } from './origination-operation';\nimport { TransactionWalletOperation } from './transaction-operation';\n\nexport const cacheUntil =\n <T>(cacheUntilObs: Observable<any>): MonoTypeOperatorFunction<T> =>\n (source) => {\n let subject: ReplaySubject<T> | null = null;\n\n return defer(() => {\n if (!subject) {\n subject = new ReplaySubject<T>();\n source.pipe(first()).subscribe(subject);\n cacheUntilObs.pipe(first()).subscribe(() => {\n subject = null;\n });\n }\n\n return subject;\n });\n };\n\nexport const createNewPollingBasedHeadObservable = (\n pollingTimer: Observable<number>,\n sharedHeadOb: Observable<BlockResponse>,\n context: Context,\n scheduler?: SchedulerLike\n): Observable<BlockResponse> => {\n return pollingTimer.pipe(\n switchMap(() => sharedHeadOb),\n distinctUntilKeyChanged('hash'),\n timeoutWith(\n context.config.confirmationPollingTimeoutSecond * 1000,\n throwError(new Error('Confirmation polling timed out')),\n scheduler\n ),\n shareReplay({\n refCount: true,\n scheduler,\n })\n );\n};\n\nexport interface OperationFactoryConfig {\n blockIdentifier?: string;\n}\n\nexport class OperationFactory {\n constructor(private context: Context) {}\n\n // Cache the last block for one second across all operations\n private sharedHeadObs = defer(() => from(this.context.rpc.getBlock())).pipe(\n cacheUntil(timer(0, 1000))\n );\n\n private async createNewHeadObservable() {\n const confirmationPollingIntervalSecond =\n this.context.config.confirmationPollingIntervalSecond !== undefined\n ? this.context.config.confirmationPollingIntervalSecond\n : await this.context.getConfirmationPollingInterval();\n return createNewPollingBasedHeadObservable(\n timer(0, confirmationPollingIntervalSecond * 1000),\n this.sharedHeadObs,\n this.context\n );\n }\n\n private createPastBlockWalker(startBlock: string, count = 1) {\n return from(this.context.rpc.getBlock({ block: startBlock })).pipe(\n switchMap((block) => {\n if (count === 1) {\n return of(block);\n }\n\n return range(block.header.level, count - 1).pipe(\n startWith(block),\n concatMap(async (level) => {\n return this.context.rpc.getBlock({ block: String(level) });\n })\n );\n })\n );\n }\n\n private async createHeadObservableFromConfig({ blockIdentifier }: OperationFactoryConfig) {\n const observableSequence: Observable<BlockResponse>[] = [];\n\n if (blockIdentifier) {\n observableSequence.push(this.createPastBlockWalker(blockIdentifier));\n }\n\n observableSequence.push(await this.createNewHeadObservable());\n\n return concat(...observableSequence);\n }\n\n async createOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<WalletOperation> {\n return new WalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createBatchOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<BatchWalletOperation> {\n return new BatchWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createTransactionOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<TransactionWalletOperation> {\n return new TransactionWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createDelegationOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<DelegationWalletOperation> {\n return new DelegationWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createOriginationOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<OriginationWalletOperation> {\n return new OriginationWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n}\n","import BigNumber from 'bignumber.js';\nimport { Context } from '../context';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport { Operation } from '../operations/operations';\nimport { RPCActivateOperation } from '../operations/types';\nimport { TzProvider } from './interface';\nimport { OpKind } from '@taquito/rpc';\nimport { validateAddress, ValidationResult, validateKeyHash, InvalidAddressError, InvalidKeyHashError } from '@taquito/utils';\n\nexport class RpcTzProvider extends OperationEmitter implements TzProvider {\n constructor(context: Context) {\n super(context);\n }\n\n async getBalance(address: string): Promise<BigNumber> {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address: ${address}`);\n }\n return this.rpc.getBalance(address);\n }\n\n async getDelegate(address: string): Promise<string | null> {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address: ${address}`);\n }\n return this.rpc.getDelegate(address);\n }\n\n async activate(pkh: string, secret: string) {\n if (validateKeyHash(pkh) !== ValidationResult.VALID) {\n throw new InvalidKeyHashError(`Invalid Public Key Hash: ${pkh}`);\n }\n const operation: RPCActivateOperation = {\n kind: OpKind.ACTIVATION,\n pkh,\n secret,\n };\n\n const prepared = await this.prepareOperation({ operation: [operation], source: pkh });\n const forgedBytes = await this.forge(prepared);\n const bytes = `${forgedBytes.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;\n return new Operation(\n await this.rpc.injectOperation(bytes),\n { ...forgedBytes, opbytes: bytes },\n [],\n this.context.clone()\n );\n }\n}\n","const MINIMAL_FEE_MUTEZ = 100;\nconst MINIMAL_FEE_PER_BYTE_MUTEZ = 1;\nconst MINIMAL_FEE_PER_GAS_MUTEZ = 0.1;\n\nconst GAS_BUFFER = 100;\n\nexport interface EstimateProperties {\n milligasLimit: number,\n storageLimit: number,\n opSize: number,\n minimalFeePerStorageByteMutez: number,\n baseFeeMutez?: number\n}\n\n/**\n * Examples of use :\n *\n * Estimate a transfer operation :\n * ```\n * // Assuming that provider and signer are already configured...\n *\n * const amount = 2;\n * const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY';\n *\n * // Estimate gasLimit, storageLimit and fees for a transfer operation\n * const est = await Tezos.estimate.transfer({ to: address, amount: amount })\n * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit,\n * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez)\n *\n * ```\n *\n * Estimate a contract origination :\n * ```\n * // generic.json is referring to a Michelson Smart Contract\n *\n * const genericMultisigJSON = require('./generic.json')\n * const est = await Tezos.estimate.originate({\n * code: genericMultisigJSON,\n * storage: {\n * stored_counter: 0,\n * threshold: 1,\n * keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t']\n * }\n * })\n * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit,\n * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez)\n *\n * ```\n */\n\nexport class Estimate {\n constructor(\n private readonly _milligasLimit: number | string,\n private readonly _storageLimit: number | string,\n public readonly opSize: number | string,\n private readonly minimalFeePerStorageByteMutez: number | string,\n /**\n * @description Base fee in mutez (1 mutez = 1e10−6 tez)\n */\n private readonly baseFeeMutez: number | string = MINIMAL_FEE_MUTEZ\n ) {}\n\n /**\n * @description The number of Mutez that will be burned for the storage of the [operation](https://tezos.gitlab.io/user/glossary.html#operations). (Storage + Allocation fees)\n */\n get burnFeeMutez() {\n return this.roundUp(Number(this.storageLimit) * Number(this.minimalFeePerStorageByteMutez));\n }\n\n /**\n * @description The limit on the amount of storage an [operation](https://tezos.gitlab.io/user/glossary.html#operations) can use.\n */\n get storageLimit() {\n const limit = Math.max(Number(this._storageLimit), 0);\n return limit > 0 ? limit : 0;\n }\n\n /**\n * @description The limit on the amount of [gas](https://tezos.gitlab.io/user/glossary.html#gas) a given operation can consume.\n */\n get gasLimit() {\n return this.roundUp(Number(this._milligasLimit)/1000 + GAS_BUFFER);\n }\n\n private get operationFeeMutez() {\n return (\n (Number(this._milligasLimit)/1000 + GAS_BUFFER) * MINIMAL_FEE_PER_GAS_MUTEZ + Number(this.opSize) * MINIMAL_FEE_PER_BYTE_MUTEZ\n );\n }\n\n private roundUp(nanotez: number) {\n return Math.ceil(Number(nanotez));\n }\n\n /**\n * @description Minimum fees for the [operation](https://tezos.gitlab.io/user/glossary.html#operations) according to [baker](https://tezos.gitlab.io/user/glossary.html#baker) defaults.\n */\n get minimalFeeMutez() {\n return this.roundUp(MINIMAL_FEE_MUTEZ + this.operationFeeMutez);\n }\n\n /**\n * @description The suggested fee for the operation which includes minimal fees and a small buffer.\n */\n get suggestedFeeMutez() {\n return this.roundUp(this.operationFeeMutez + MINIMAL_FEE_MUTEZ * 2);\n }\n\n /**\n * @description Fees according to your specified base fee will ensure that at least minimum fees are used.\n */\n get usingBaseFeeMutez() {\n return (\n Math.max(Number(this.baseFeeMutez), MINIMAL_FEE_MUTEZ) + this.roundUp(this.operationFeeMutez)\n );\n }\n\n /**\n * @description The sum of `minimalFeeMutez` + `burnFeeMutez`.\n */\n get totalCost() {\n return this.minimalFeeMutez + this.burnFeeMutez;\n }\n\n /**\n * @description Since Delphinet, consumed gas is provided in milligas for more precision. \n * This function returns an estimation of the gas that operation will consume in milligas. \n */\n get consumedMilligas() {\n return Number(this._milligasLimit);\n }\n\n static createEstimateInstanceFromProperties(estimateProperties: EstimateProperties[]) {\n let milligasLimit = 0;\n let storageLimit = 0;\n let opSize = 0;\n let minimalFeePerStorageByteMutez = 0;\n let baseFeeMutez: number | undefined;\n\n estimateProperties.forEach(estimate => {\n milligasLimit += estimate.milligasLimit;\n storageLimit += estimate.storageLimit;\n opSize += estimate.opSize;\n minimalFeePerStorageByteMutez = Math.max(estimate.minimalFeePerStorageByteMutez, minimalFeePerStorageByteMutez);\n if (estimate.baseFeeMutez) {\n baseFeeMutez = baseFeeMutez ? baseFeeMutez + estimate.baseFeeMutez : estimate.baseFeeMutez;\n }\n })\n return new Estimate(milligasLimit, storageLimit, opSize, minimalFeePerStorageByteMutez, baseFeeMutez);\n }\n\n static createArrayEstimateInstancesFromProperties(estimateProperties: EstimateProperties[]) {\n return estimateProperties.map(x => new Estimate(x.milligasLimit, x.storageLimit, x.opSize, x.minimalFeePerStorageByteMutez, x.baseFeeMutez))\n }\n}\n","import { PreapplyResponse, RPCRunOperationParam, OpKind, ConstantsResponse } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_STORAGE_LIMIT } from '../constants';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport {\n flattenErrors,\n flattenOperationResult,\n TezosOperationError,\n} from '../operations/operation-errors';\nimport {\n DelegateParams,\n isOpWithFee,\n OriginateParams,\n ParamsWithKind,\n PrepareOperationParams,\n RegisterDelegateParams,\n RPCOperation,\n TransferParams,\n RevealParams,\n RegisterGlobalConstantParams,\n} from '../operations/types';\nimport { Estimate, EstimateProperties } from './estimate';\nimport { EstimationProvider } from './interface';\nimport {\n createOriginationOperation,\n createRegisterDelegateOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n createRegisterGlobalConstantOperation,\n} from './prepare';\nimport { validateAddress, InvalidAddressError, ValidationResult } from '@taquito/utils';\n\ninterface Limits {\n fee?: number;\n storageLimit?: number;\n gasLimit?: number;\n}\n\nconst mergeLimits = (\n userDefinedLimit: Limits,\n defaultLimits: Required<Limits>\n): Required<Limits> => {\n return {\n fee: typeof userDefinedLimit.fee === 'undefined' ? defaultLimits.fee : userDefinedLimit.fee,\n gasLimit:\n typeof userDefinedLimit.gasLimit === 'undefined'\n ? defaultLimits.gasLimit\n : userDefinedLimit.gasLimit,\n storageLimit:\n typeof userDefinedLimit.storageLimit === 'undefined'\n ? defaultLimits.storageLimit\n : userDefinedLimit.storageLimit,\n };\n};\n\n// RPC requires a signature but does not verify it\nconst SIGNATURE_STUB =\n 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg';\n\nexport class RPCEstimateProvider extends OperationEmitter implements EstimationProvider {\n private readonly ALLOCATION_STORAGE = 257;\n private readonly ORIGINATION_STORAGE = 257;\n private readonly OP_SIZE_REVEAL = 128;\n\n // Maximum values defined by the protocol\n private async getAccountLimits(pkh: string, constants: ConstantsResponse, numberOfOps?: number) {\n const balance = await this.rpc.getBalance(pkh);\n const {\n hard_gas_limit_per_operation,\n hard_gas_limit_per_block,\n hard_storage_limit_per_operation,\n cost_per_byte,\n } = constants;\n return {\n fee: 0,\n gasLimit: numberOfOps\n ? Math.floor(\n this.ajustGasForBatchOperation(\n hard_gas_limit_per_block,\n hard_gas_limit_per_operation,\n numberOfOps\n ).toNumber()\n )\n : hard_gas_limit_per_operation.toNumber(),\n storageLimit: Math.floor(\n BigNumber.min(balance.dividedBy(cost_per_byte), hard_storage_limit_per_operation).toNumber()\n ),\n };\n }\n\n // Fix for Granada where the total gasLimit of a batch can not exceed the hard_gas_limit_per_block.\n // If the total gasLimit of the batch is higher than the hard_gas_limit_per_block,\n // the gasLimit is calculated by dividing the hard_gas_limit_per_block by the number of operation in the batch (numberOfOps).\n // numberOfOps is incremented by 1 for safety in case a reveal operation is needed\n private ajustGasForBatchOperation(\n gasLimitBlock: BigNumber,\n gaslimitOp: BigNumber,\n numberOfOps: number\n ) {\n return BigNumber.min(gaslimitOp, gasLimitBlock.div(numberOfOps + 1));\n }\n\n private getEstimationPropertiesFromOperationContent(\n content: PreapplyResponse['contents'][0],\n size: number,\n costPerByte: BigNumber\n ): EstimateProperties {\n const operationResults = flattenOperationResult({ contents: [content] });\n let totalGas = 0;\n let totalMilligas = 0;\n let totalStorage = 0;\n operationResults.forEach((result) => {\n totalStorage +=\n 'originated_contracts' in result && typeof result.originated_contracts !== 'undefined'\n ? result.originated_contracts.length * this.ORIGINATION_STORAGE\n : 0;\n totalStorage += 'allocated_destination_contract' in result ? this.ALLOCATION_STORAGE : 0;\n totalGas += Number(result.consumed_gas) || 0;\n totalMilligas += Number(result.consumed_milligas) || 0;\n totalStorage +=\n 'paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0;\n totalStorage +=\n 'storage_size' in result && 'global_address' in result\n ? Number(result.storage_size) || 0\n : 0;\n });\n\n if (totalGas !== 0 && totalMilligas === 0) {\n // This will convert gas to milligas for Carthagenet where result does not contain consumed gas in milligas.\n totalMilligas = totalGas * 1000;\n }\n\n if (isOpWithFee(content)) {\n return {\n milligasLimit: totalMilligas || 0,\n storageLimit: Number(totalStorage || 0),\n opSize: size,\n minimalFeePerStorageByteMutez: costPerByte.toNumber(),\n };\n } else {\n return {\n milligasLimit: 0,\n storageLimit: 0,\n opSize: size,\n minimalFeePerStorageByteMutez: costPerByte.toNumber(),\n baseFeeMutez: 0,\n };\n }\n }\n\n private async prepareEstimate(params: PrepareOperationParams, constants: ConstantsResponse) {\n const prepared = await this.prepareOperation(params);\n const {\n opbytes,\n opOb: { branch, contents },\n } = await this.forge(prepared);\n const operation: RPCRunOperationParam = {\n operation: { branch, contents, signature: SIGNATURE_STUB },\n chain_id: await this.rpc.getChainId(),\n };\n\n const { opResponse } = await this.simulate(operation);\n const { cost_per_byte } = constants;\n const errors = [...flattenErrors(opResponse, 'backtracked'), ...flattenErrors(opResponse)];\n\n // Fail early in case of errors\n if (errors.length) {\n throw new TezosOperationError(errors);\n }\n\n let numberOfOps = 1;\n if (Array.isArray(params.operation) && params.operation.length > 1) {\n numberOfOps =\n opResponse.contents[0].kind === 'reveal'\n ? params.operation.length - 1\n : params.operation.length;\n }\n\n return opResponse.contents.map((x) => {\n return this.getEstimationPropertiesFromOperationContent(\n x,\n // TODO: Calculate a specific opSize for each operation.\n x.kind === 'reveal' ? this.OP_SIZE_REVEAL / 2 : opbytes.length / 2 / numberOfOps,\n cost_per_byte\n );\n });\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an origination operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param OriginationOperation Originate operation parameter\n */\n async originate({ fee, storageLimit, gasLimit, ...rest }: OriginateParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n })\n );\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an transfer operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param TransferOperation Originate operation parameter\n */\n async transfer({ fee, storageLimit, gasLimit, ...rest }: TransferParams) {\n if (validateAddress(rest.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${rest.to}`);\n }\n if (rest.source && validateAddress(rest.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'source' address: ${rest.source}`);\n }\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createTransferOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a delegate operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param Estimate\n */\n async setDelegate({ fee, gasLimit, storageLimit, ...rest }: DelegateParams) {\n if (rest.source && validateAddress(rest.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source address: ${rest.source}`);\n }\n if (rest.delegate && validateAddress(rest.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${rest.delegate}`);\n }\n\n const pkh = await this.signer.publicKeyHash();\n const sourceOrDefault = rest.source || pkh;\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(sourceOrDefault, protocolConstants);\n const op = await createSetDelegateOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a each operation in the batch\n *\n * @returns An array of Estimate objects. If a reveal operation is needed, the first element of the array is the Estimate for the reveal operation.\n */\n async batch(params: ParamsWithKind[]) {\n const pkh = await this.signer.publicKeyHash();\n let operations: RPCOperation[] = [];\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants, params.length);\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n operations.push(\n await createTransferOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n case OpKind.ORIGINATION:\n operations.push(\n await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n )\n );\n break;\n case OpKind.DELEGATION:\n operations.push(\n await createSetDelegateOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n case OpKind.ACTIVATION:\n operations.push({\n ...param,\n ...DEFAULT_PARAMS,\n });\n break;\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n operations.push(\n await createRegisterGlobalConstantOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n const isRevealNeeded = await this.isRevealOpNeeded(operations, pkh);\n operations = isRevealNeeded ? await this.addRevealOp(operations, pkh) : operations;\n const estimateProperties = await this.prepareEstimate(\n { operation: operations, source: pkh },\n protocolConstants\n );\n\n return Estimate.createArrayEstimateInstancesFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a delegate operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param Estimate\n */\n async registerDelegate(params: RegisterDelegateParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRegisterDelegateOperation({ ...params, ...DEFAULT_PARAMS }, pkh);\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees to reveal the current account\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation or undefined if the account is already revealed\n *\n * @param Estimate\n */\n async reveal(params?: RevealParams) {\n const pkh = await this.signer.publicKeyHash();\n if (await this.isAccountRevealRequired(pkh)) {\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRevealOperation(\n {\n ...params,\n ...DEFAULT_PARAMS,\n },\n pkh,\n await this.signer.publicKey()\n );\n const estimateProperties = await this.prepareEstimate(\n { operation: op, source: pkh },\n protocolConstants\n );\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an registerGlobalConstant operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param params registerGlobalConstant operation parameter\n */\n async registerGlobalConstant({\n fee,\n storageLimit,\n gasLimit,\n ...rest\n }: RegisterGlobalConstantParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRegisterGlobalConstantOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n private async addRevealOp(op: RPCOperation[], pkh: string) {\n op.unshift(\n await createRevealOperation(\n {\n ...{\n fee: DEFAULT_FEE.REVEAL,\n gasLimit: DEFAULT_GAS_LIMIT.REVEAL,\n storageLimit: DEFAULT_STORAGE_LIMIT.REVEAL,\n },\n },\n pkh,\n await this.signer.publicKey()\n )\n );\n return op;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultDelegation } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCDelegateOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Delegation operation provide utility function to fetch newly issued delegation\n *\n * @warn Currently support only one delegation per operation\n */\nexport class DelegateOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCDelegateOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const delegationOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'delegation') as OperationContentsAndResultDelegation);\n const result = delegationOp && delegationOp.metadata && delegationOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get delegate(): string {\n return this.delegate;\n }\n\n get isRegisterOperation(): boolean {\n return this.delegate === this.source;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get consumedGas() {\n const consumedGas = this.operationResults && this.operationResults.consumed_gas;\n return consumedGas ? consumedGas : undefined;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { DefaultContractType } from '../contract/contract';\nimport { RpcContractProvider } from '../contract/rpc-contract-provider';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n hasMetadataWithResult,\n RPCOriginationOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Origination operation provide utility function to fetch newly originated contract\n *\n * @warn Currently support only one origination per operation\n */\nexport class OriginationOperation<TContract extends DefaultContractType = DefaultContractType> \n extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n /**\n * @description Contract address of the newly originated contract\n */\n public readonly contractAddress?: string;\n\n constructor(\n hash: string,\n private readonly params: RPCOriginationOperation,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context,\n private contractProvider: RpcContractProvider\n ) {\n super(hash, raw, results, context);\n\n const originatedContracts = this.operationResults && this.operationResults.originated_contracts;\n if (Array.isArray(originatedContracts)) {\n this.contractAddress = originatedContracts[0];\n }\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get operationResults() {\n const originationOp =\n Array.isArray(this.results) &&\n (this.results.find((op) => op.kind === 'origination') as\n | OperationContentsAndResultOrigination\n | undefined);\n\n const result =\n originationOp &&\n hasMetadataWithResult(originationOp) &&\n originationOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get consumedGas() {\n const consumedGas = this.operationResults && this.operationResults.consumed_gas;\n return consumedGas ? consumedGas : undefined;\n }\n\n get storageDiff() {\n const storageDiff = this.operationResults && this.operationResults.paid_storage_size_diff;\n return storageDiff ? storageDiff : undefined;\n }\n\n get storageSize() {\n const storageSize = this.operationResults && this.operationResults.storage_size;\n return storageSize ? storageSize : undefined;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n\n /**\n * @description Provide the contract abstract of the newly originated contract\n */\n async contract(confirmations?: number, interval?: number, timeout?: number) {\n if (!this.contractAddress) {\n throw new Error('No contract was originated in this operation');\n }\n\n await this.confirmation(confirmations, interval, timeout);\n return this.contractProvider.at<TContract>(this.contractAddress);\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultRegisterGlobalConstant } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCRegisterGlobalConstantOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant\n */\nexport class RegisterGlobalConstantOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n\n /**\n * @description Hash (index) of the newly registered constant\n */\n public readonly globalConstantHash?: string;\n constructor(\n hash: string,\n private readonly params: RPCRegisterGlobalConstantOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n\n this.globalConstantHash = this.operationResults && this.operationResults.global_address;\n }\n\n get operationResults() {\n const registerGlobalConstantOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'register_global_constant') as OperationContentsAndResultRegisterGlobalConstant);\n const result = registerGlobalConstantOp && registerGlobalConstantOp.metadata && registerGlobalConstantOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get registeredExpression() {\n return this.params.value;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultReveal } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCRevealOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Reveal operation provides utility functions to fetch a newly issued revelation\n */\nexport class RevealOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCRevealOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const revealOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'reveal') as OperationContentsAndResultReveal);\n return revealOp ? [revealOp] : [];\n }\n\n get status() {\n const operationResults = this.operationResults;\n const txResult = operationResults[0];\n if (txResult) {\n return txResult.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get publicKey() {\n return this.params.public_key;\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n get consumedGas() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')\n );\n }\n\n get storageDiff() {\n return String(\n this.sumProp(\n flattenOperationResult({ contents: this.operationResults }),\n 'paid_storage_size_diff'\n )\n );\n }\n\n get storageSize() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.operationResults });\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultTransaction } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCTransferOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Transaction operation provides utility functions to fetch a newly issued transaction\n *\n * @warn Currently supports one transaction per operation\n */\nexport class TransactionOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCTransferOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const transactionOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'transaction') as OperationContentsAndResultTransaction);\n return transactionOp ? [transactionOp] : [];\n }\n\n get status() {\n const operationResults = this.operationResults;\n const txResult = operationResults[0];\n if (txResult) {\n return txResult.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n get amount() {\n return new BigNumber(this.params.amount);\n }\n\n get destination() {\n return this.params.destination;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n get consumedGas() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')\n );\n }\n\n get storageDiff() {\n return String(\n this.sumProp(\n flattenOperationResult({ contents: this.operationResults }),\n 'paid_storage_size_diff'\n )\n );\n }\n\n get storageSize() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.operationResults });\n }\n}\n","const setDelegate = (key: string) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'key_hash' }, { string: key }],\n },\n { prim: 'SOME' },\n { prim: 'SET_DELEGATE' },\n { prim: 'CONS' },\n ];\n};\n\nconst transferImplicit = (key: string, mutez: number) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'key_hash' }, { string: key }],\n },\n { prim: 'IMPLICIT_ACCOUNT' },\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: `${mutez}` }],\n },\n { prim: 'UNIT' },\n { prim: 'TRANSFER_TOKENS' },\n { prim: 'CONS' },\n ];\n};\n\nconst removeDelegate = () => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n { prim: 'NONE', args: [{ prim: 'key_hash' }] },\n { prim: 'SET_DELEGATE' },\n { prim: 'CONS' },\n ];\n};\n\nconst transferToContract = (key: string, amount: number) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'address' }, { string: key }],\n },\n { prim: 'CONTRACT', args: [{ prim: 'unit' }] },\n [\n {\n prim: 'IF_NONE',\n args: [[[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]], []],\n },\n ],\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: `${amount}` }],\n },\n { prim: 'UNIT' },\n { prim: 'TRANSFER_TOKENS' },\n { prim: 'CONS' },\n ];\n};\n\nexport const MANAGER_LAMBDA = {\n setDelegate,\n removeDelegate,\n transferImplicit,\n transferToContract,\n};\n","const code = [\n {\n prim: 'parameter',\n args: [\n {\n prim: 'lambda',\n args: [\n { prim: 'unit' },\n {\n prim: 'pair',\n args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }],\n },\n ],\n },\n ],\n },\n { prim: 'storage', args: [{ prim: 'unit' }] },\n { prim: 'code', args: [[{ prim: 'CAR' }, { prim: 'UNIT' }, { prim: 'EXEC' }]] },\n];\n\nconst storage = 'Unit';\n\nexport const VIEW_LAMBDA = {\n code,\n storage\n}\n","import { Wallet } from '../wallet/wallet';\nimport { Context } from '../context';\nimport { ContractAbstraction } from './contract';\nimport { ContractProvider } from './interface';\n\nexport function compose<\n ContractAbsComposer1 extends ContractAbstraction<ContractProvider | Wallet>,\n ContractAbsComposer2 extends ContractAbstraction<ContractProvider | Wallet>,\n ContractAbstractionComposed\n>(\n functioncomposer1: (abs: ContractAbsComposer1, context: Context) => ContractAbsComposer2,\n functioncomposer2: (abs: ContractAbsComposer2, context: Context) => ContractAbstractionComposed\n): (abs: ContractAbsComposer1, context: Context) => ContractAbstractionComposed {\n return (contractAbstraction, context) =>\n functioncomposer2(functioncomposer1(contractAbstraction, context), context);\n}\n","import { TransactionOperation } from '../../operations/transaction-operation';\nimport { TransferParams } from '../../operations/types';\nimport { ContractProvider } from '../interface';\nimport { TransactionWalletOperation, Wallet } from '../../wallet';\nimport { ParameterSchema } from '@taquito/michelson-encoder';\nimport {\n ContractMethodInterface,\n ExplicitTransferParams,\n SendParams,\n} from './contract-method-interface';\nimport { DEFAULT_SMART_CONTRACT_METHOD_NAME } from '../contract';\nimport { InvalidParameterError } from '../errors';\n\n/**\n * @description Utility class to send smart contract operation\n * The format for the arguments is the flattened representation\n */\nexport class ContractMethod<T extends ContractProvider | Wallet>\n implements ContractMethodInterface\n{\n constructor(\n private provider: T,\n private address: string,\n private parameterSchema: ParameterSchema,\n private name: string,\n private args: any[],\n private isMultipleEntrypoint = true,\n private isAnonymous = false\n ) {}\n\n private validateArgs(args: any[], schema: ParameterSchema, name: string) {\n const sigs = schema.ExtractSignatures();\n\n if (!sigs.find((x: any[]) => x.length === args.length)) {\n throw new InvalidParameterError(name, sigs, args);\n }\n }\n\n /**\n * @description Get the schema of the smart contract method\n */\n get schema() {\n return this.isAnonymous\n ? this.parameterSchema.ExtractSchema()[this.name]\n : this.parameterSchema.ExtractSchema();\n }\n\n /**\n * @description Get the signature of the smart contract method\n */\n getSignature() {\n if (this.isAnonymous) {\n const sig = this.parameterSchema.ExtractSignatures().find((x: any[]) => x[0] === this.name);\n if (sig) {\n sig.shift();\n return sig;\n }\n } else {\n const sig = this.parameterSchema.ExtractSignatures();\n return sig.length == 1 ? sig[0] : sig;\n }\n }\n\n /**\n *\n * @description Send the smart contract operation\n *\n * @param Options generic operation parameter\n */\n send(\n params: Partial<SendParams> = {}\n ): Promise<T extends Wallet ? TransactionWalletOperation : TransactionOperation> {\n if (this.provider instanceof Wallet) {\n return (this.provider as unknown as Wallet)\n .transfer(this.toTransferParams(params))\n .send() as any;\n } else {\n return this.provider.transfer(this.toTransferParams(params)) as any;\n }\n }\n\n /**\n *\n * @description Create transfer params to be used with TezosToolkit.contract.transfer methods\n *\n * @param Options generic transfer operation parameters\n */\n toTransferParams({\n fee,\n gasLimit,\n storageLimit,\n source,\n amount = 0,\n mutez = false,\n }: Partial<SendParams> = {}): TransferParams {\n const fullTransferParams: ExplicitTransferParams = {\n to: this.address,\n amount,\n fee,\n mutez,\n source,\n gasLimit,\n storageLimit,\n parameter: {\n entrypoint: this.isMultipleEntrypoint ? this.name : DEFAULT_SMART_CONTRACT_METHOD_NAME,\n value: this.isAnonymous\n ? this.parameterSchema.Encode(this.name, ...this.args)\n : this.parameterSchema.Encode(...this.args),\n },\n };\n return fullTransferParams;\n }\n}\n","import { Protocols } from '../constants';\nimport { Context } from '../context';\nimport { ContractAbstraction, ContractStorageType, DefaultWalletType } from '../contract';\nimport { ContractMethod } from '../contract/contract-methods/contract-method-flat-param';\nimport { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param';\nimport { OpKind, withKind } from '../operations/types';\nimport { OriginationWalletOperation } from './origination-operation';\nimport {\n WalletDelegateParams,\n WalletOriginateParams,\n WalletProvider,\n WalletTransferParams,\n} from './interface';\n\nimport { \n validateAddress,\n validateContractAddress,\n InvalidContractAddressError,\n InvalidAddressError, \n ValidationResult \n} from '@taquito/utils'\n\nexport interface PKHOption {\n forceRefetch?: boolean;\n}\n\nexport type WalletParamsWithKind =\n | withKind<WalletTransferParams, OpKind.TRANSACTION>\n | withKind<WalletOriginateParams, OpKind.ORIGINATION>\n | withKind<WalletDelegateParams, OpKind.DELEGATION>;\n\nexport class WalletOperationBatch {\n private operations: WalletParamsWithKind[] = [];\n\n constructor(private walletProvider: WalletProvider, private context: Context) {}\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withTransfer(params: WalletTransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`)\n }\n this.operations.push({ kind: OpKind.TRANSACTION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withContractCall(params: ContractMethod<Wallet> | ContractMethodObject<Wallet>) {\n return this.withTransfer(params.toTransferParams());\n }\n\n /**\n *\n * @description Add a delegation operation to the batch\n *\n * @param params Delegation operation parameter\n */\n withDelegation(params: WalletDelegateParams) {\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${params.delegate}`);\n }\n this.operations.push({ kind: OpKind.DELEGATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an origination operation to the batch\n *\n * @param params Origination operation parameter\n */\n withOrigination<TWallet extends DefaultWalletType = DefaultWalletType>(params: WalletOriginateParams<ContractStorageType<TWallet>>) {\n this.operations.push({ kind: OpKind.ORIGINATION, ...params });\n return this;\n }\n\n private async mapOperation(param: WalletParamsWithKind) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n return this.walletProvider.mapTransferParamsToWalletParams(async () => param);\n case OpKind.ORIGINATION:\n return this.walletProvider.mapOriginateParamsToWalletParams(async () =>\n this.context.parser.prepareCodeOrigination({\n ...param,\n })\n );\n case OpKind.DELEGATION:\n return this.walletProvider.mapDelegateParamsToWalletParams(async () => param);\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n /**\n *\n * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array\n *\n * @param params Operations parameter\n */\n with(params: WalletParamsWithKind[]) {\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n this.withTransfer(param);\n break;\n case OpKind.ORIGINATION:\n this.withOrigination(param);\n break;\n case OpKind.DELEGATION:\n this.withDelegation(param);\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n return this;\n }\n\n /**\n *\n * @description Submit batch operation to wallet\n *\n */\n async send() {\n const ops: WalletParamsWithKind[] = [];\n\n for (const op of this.operations) {\n ops.push(await this.mapOperation(op));\n }\n\n const opHash = await this.walletProvider.sendOperations(ops);\n\n return this.context.operationFactory.createBatchOperation(opHash);\n }\n}\n\nexport class Wallet {\n constructor(private context: Context) {}\n\n private get walletProvider() {\n return this.context.walletProvider;\n }\n\n private _pkh?: string;\n\n /**\n * @description Retrieve the PKH of the account that is currently in use by the wallet\n *\n * @param option Option to use while fetching the PKH.\n * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet\n */\n async pkh({ forceRefetch }: PKHOption = {}) {\n if (!this._pkh || forceRefetch) {\n this._pkh = await this.walletProvider.getPKH();\n }\n\n return this._pkh;\n }\n\n private walletCommand = <T>(send: () => Promise<T>) => {\n return {\n send,\n };\n };\n\n /**\n *\n * @description Originate a new contract according to the script in parameters.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param originateParams Originate operation parameter\n */\n originate<TWallet extends DefaultWalletType = DefaultWalletType>(\n params: WalletOriginateParams<ContractStorageType<TWallet>>\n ): { send: () => Promise<OriginationWalletOperation<TWallet>> } {\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapOriginateParamsToWalletParams(() =>\n this.context.parser.prepareCodeOrigination({\n ...params as WalletOriginateParams,\n })\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n if (!this.context.proto) {\n this.context.proto = (await this.context.rpc.getBlock()).protocol as Protocols;\n }\n return this.context.operationFactory.createOriginationOperation(opHash) as Promise<OriginationWalletOperation<TWallet>>;\n });\n }\n\n /**\n *\n * @description Set the delegate for a contract.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param delegateParams operation parameter\n */\n setDelegate(params: WalletDelegateParams) {\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address error: ${params.delegate}`);\n }\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapDelegateParamsToWalletParams(\n async () => params\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createDelegationOperation(opHash);\n });\n }\n\n /**\n *\n * @description Register the current address as delegate.\n *\n * @returns An operation handle with the result from the rpc node\n *\n */\n registerDelegate() {\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapDelegateParamsToWalletParams(async () => {\n const delegate = await this.pkh();\n return { delegate };\n });\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createDelegationOperation(opHash);\n });\n }\n\n /**\n *\n * @description Transfer tezos tokens from current address to a specific address or call a smart contract.\n *\n * @returns A wallet command from which we can send the operation to the wallet\n *\n * @param params operation parameter\n */\n transfer(params: WalletTransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`);\n }\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapTransferParamsToWalletParams(\n async () => params\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createTransactionOperation(opHash);\n });\n }\n\n /**\n *\n * @description Create a batch of operation\n *\n * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch\n *\n * @param params List of operation to initialize the batch with\n */\n batch(params?: Parameters<WalletOperationBatch['with']>[0]) {\n const batch = new WalletOperationBatch(this.walletProvider, this.context);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n\n /**\n *\n * @description Create an smart contract abstraction for the address specified. Calling entrypoints with the returned\n * smart contract abstraction will leverage the wallet provider to make smart contract calls\n *\n * @param address Smart contract address\n */\n async at<T extends ContractAbstraction<Wallet>>(\n address: string,\n contractAbstractionComposer: (abs: ContractAbstraction<Wallet>, context: Context) => T = (x) =>\n x as any\n ): Promise<T> {\n if (validateContractAddress(address) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${address}`);\n }\n const rpc = this.context.withExtensions().rpc;\n const script = await rpc.getNormalizedScript(address);\n const entrypoints = await rpc.getEntrypoints(address);\n const blockHeader = await this.context.rpc.getBlockHeader();\n const chainId = blockHeader.chain_id;\n const abs = new ContractAbstraction(\n address,\n script,\n this,\n this.context.contract,\n entrypoints,\n chainId,\n rpc\n );\n return contractAbstractionComposer(abs, this.context);\n }\n}\n","import { Context } from '../context';\nimport { attachKind, OpKind } from '../operations/types';\nimport {\n WalletDelegateParams,\n WalletOriginateParams,\n WalletProvider,\n WalletTransferParams,\n} from './interface';\nimport { WalletParamsWithKind } from './wallet';\n\nexport class LegacyWalletProvider implements WalletProvider {\n constructor(private context: Context) {}\n\n async getPKH(): Promise<string> {\n return this.context.signer.publicKeyHash();\n }\n\n async mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>) {\n return attachKind(await params(), OpKind.TRANSACTION);\n }\n\n async mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>) {\n return attachKind(await params(), OpKind.ORIGINATION);\n }\n\n async mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>) {\n return attachKind(await params(), OpKind.DELEGATION);\n }\n\n async sendOperations(params: WalletParamsWithKind[]) {\n const op = await this.context.batch.batch(params as any).send();\n return op.hash;\n }\n}\n","import { TransactionOperation } from '../../operations/transaction-operation';\nimport { TransferParams } from '../../operations/types';\nimport { ContractProvider } from '../interface';\nimport { TransactionWalletOperation, Wallet } from '../../wallet';\nimport { ParameterSchema } from \"@taquito/michelson-encoder\";\nimport { ContractMethodInterface, ExplicitTransferParams, SendParams } from './contract-method-interface';\nimport { DEFAULT_SMART_CONTRACT_METHOD_NAME } from '../contract';\n\n/**\n * @description Utility class to send smart contract operation\n * The format for the arguments is the object representation\n */\nexport class ContractMethodObject<T extends ContractProvider | Wallet> implements ContractMethodInterface {\n constructor(\n private provider: T,\n private address: string,\n private parameterSchema: ParameterSchema,\n private name: string,\n private args: any = 'unit',\n private isMultipleEntrypoint = true,\n private isAnonymous = false\n ) { }\n\n /**\n * @description Get the signature of the smart contract method\n */\n getSignature() {\n return this.isAnonymous\n ? this.parameterSchema.ExtractSchema()[this.name]\n : this.parameterSchema.ExtractSchema();\n }\n\n /**\n *\n * @description Send the smart contract operation\n *\n * @param Options generic operation parameter\n */\n send(\n params: Partial<SendParams> = {}\n ): Promise<T extends Wallet ? TransactionWalletOperation : TransactionOperation> {\n if (this.provider instanceof Wallet) {\n return (this.provider as unknown as Wallet).transfer(this.toTransferParams(params)).send() as any;\n } else {\n return this.provider.transfer(this.toTransferParams(params)) as any;\n }\n }\n\n /**\n *\n * @description Create transfer params to be used with TezosToolkit.contract.transfer methods\n *\n * @param Options generic transfer operation parameters\n */\n toTransferParams({\n fee,\n gasLimit,\n storageLimit,\n source,\n amount = 0,\n mutez = false,\n }: Partial<SendParams> = {}): TransferParams {\n const fullTransferParams: ExplicitTransferParams = {\n to: this.address,\n amount,\n fee,\n mutez,\n source,\n gasLimit,\n storageLimit,\n parameter: {\n entrypoint: this.isMultipleEntrypoint ? this.name : DEFAULT_SMART_CONTRACT_METHOD_NAME,\n value: this.isAnonymous\n ? this.parameterSchema.EncodeObject({ [this.name]: this.args })\n : this.parameterSchema.EncodeObject(this.args),\n },\n };\n return fullTransferParams;\n }\n}","import { ViewSchema } from '@taquito/michelson-encoder';\nimport {\n MichelsonV1Expression,\n MichelsonV1ExpressionExtended,\n RpcClientInterface,\n RPCRunCodeParam,\n} from '@taquito/rpc';\nimport { validateAddress, ValidationResult } from '@taquito/utils';\nimport {\n InvalidViewSimulationContext,\n InvalidViewParameterError,\n ViewSimulationError,\n validateAndExtractFailwith,\n} from '../errors';\n\nconst runCodeHelper = (\n viewArgsType: MichelsonV1ExpressionExtended,\n viewReturnType: MichelsonV1ExpressionExtended,\n contractStorageType: MichelsonV1Expression,\n viewInstructions: MichelsonV1ExpressionExtended[],\n viewArgs: MichelsonV1Expression,\n contractStorageValue: MichelsonV1Expression,\n balance: string,\n chain_id: string,\n source?: string,\n amount = '0'\n): RPCRunCodeParam => {\n return {\n script: [\n { prim: 'parameter', args: [{ prim: 'pair', args: [viewArgsType, contractStorageType] }] },\n { prim: 'storage', args: [{ prim: 'option', args: [viewReturnType] }] },\n {\n prim: 'code',\n args: [\n [\n { prim: 'CAR' },\n viewInstructions,\n { prim: 'SOME' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n { prim: 'PAIR' },\n ],\n ],\n },\n ],\n storage: { prim: 'None' },\n input: { prim: 'Pair', args: [viewArgs, contractStorageValue] },\n amount,\n balance,\n chain_id,\n source,\n };\n};\n\nexport interface ExecutionContextParams {\n source?: string;\n viewCaller: string;\n}\n\nexport class OnChainView {\n constructor(\n private _rpc: RpcClientInterface,\n private _contractAddress: string,\n private _smartContractViewSchema: ViewSchema,\n private _contractStorageType: MichelsonV1Expression,\n private _contractStorageValue: MichelsonV1Expression,\n private _args: any = 'Unit'\n ) {}\n\n /**\n * @description Get the signature of the smart contract view\n */\n getSignature() {\n return {\n parameter: this._smartContractViewSchema.extractArgsSchema(),\n result: this._smartContractViewSchema.extractResultSchema(),\n };\n }\n\n /**\n * @description Get the result of the view simulation\n * @param executionContext.source the public key hash of the account who initialized this view execution.\n * @param executionContext.viewCaller the contract address which is the caller of view.\n */\n async executeView(executionContext: ExecutionContextParams) {\n this.verifyContextExecution(executionContext);\n const balance = (await this._rpc.getBalance(this._contractAddress)).toString();\n const chainId = await this._rpc.getChainId();\n return this.executeViewAndDecodeResult(\n runCodeHelper(\n this._smartContractViewSchema.viewArgsType,\n this._smartContractViewSchema.viewReturnType,\n this._contractStorageType,\n this.adaptViewCodeToContext(\n this._smartContractViewSchema.instructions,\n executionContext.viewCaller,\n balance\n ),\n this.transformArgsToMichelson(),\n this._contractStorageValue,\n balance,\n chainId,\n executionContext.source\n )\n );\n }\n\n private verifyContextExecution(executionContext: ExecutionContextParams) {\n if (\n executionContext.source &&\n validateAddress(executionContext.source) !== ValidationResult.VALID\n ) {\n throw new InvalidViewSimulationContext(\n `The source account who initialized the view execution is invalid: ${executionContext.source}.`\n );\n }\n if (\n !executionContext.viewCaller ||\n validateAddress(executionContext.viewCaller) !== ValidationResult.VALID\n ) {\n throw new InvalidViewSimulationContext(\n `The contract which is the caller of view is invalid: ${executionContext.viewCaller}.`\n );\n }\n }\n\n private transformArgsToMichelson() {\n try {\n return this._smartContractViewSchema.encodeViewArgs(this._args);\n } catch (error) {\n throw new InvalidViewParameterError(\n this._smartContractViewSchema.viewName,\n this.getSignature(),\n this._args,\n error\n );\n }\n }\n /**\n * @description Loops through the view's instructions and replace BALANCE, SENDER, SELF_ADDRESS and AMOUNT with Michelson expressions that match the current context, if applicable.\n *\n * Certain specific instructions have different semantics in view:\n * BALANCE represents the current amount of mutez held by the contract where view is;\n * SENDER represents the contract which is the caller of view;\n * SELF_ADDRESS represents the contract where view is;\n * AMOUNT is always 0 mutez.\n *\n */\n private adaptViewCodeToContext(\n instructions: MichelsonV1ExpressionExtended[],\n viewCaller: string,\n contractBalance: string\n ) {\n const instructionsToReplace = {\n BALANCE: [{ prim: 'PUSH', args: [{ prim: 'mutez' }, { int: contractBalance }] }],\n SENDER: [{ prim: 'PUSH', args: [{ prim: 'address' }, { string: viewCaller }] }],\n SELF_ADDRESS: [\n { prim: 'PUSH', args: [{ prim: 'address' }, { string: this._contractAddress }] },\n ],\n AMOUNT: [{ prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] }],\n };\n\n instructions.forEach((inst: any, i: number) => {\n if (inst.prim in instructionsToReplace) {\n instructions[i] = Object(instructionsToReplace)[inst.prim];\n }\n if (inst.args && inst.args.length !== 0) {\n this.adaptViewCodeToContext(inst.args, viewCaller, contractBalance);\n } else if (Array.isArray(inst)) {\n this.adaptViewCodeToContext(inst, viewCaller, contractBalance);\n }\n });\n return instructions;\n }\n\n private async executeViewAndDecodeResult(viewScript: RPCRunCodeParam) {\n let storage: MichelsonV1ExpressionExtended;\n try {\n storage = (await this._rpc.runCode(viewScript)).storage as MichelsonV1ExpressionExtended;\n } catch (error: any) {\n const failWith = validateAndExtractFailwith(error);\n throw failWith\n ? new ViewSimulationError(\n `The simulation of the on-chain view named ${\n this._smartContractViewSchema.viewName\n } failed with: ${JSON.stringify(failWith)}`,\n error\n )\n : error;\n }\n if (!storage.args) {\n throw new ViewSimulationError(`View simulation failed with an invalid result: ${storage}`);\n }\n return this._smartContractViewSchema.decodeViewResult(storage.args[0]);\n }\n}\n","import { Wallet } from '../../wallet';\nimport { ContractProvider } from '../../contract';\nimport { ContractMethodObject } from './contract-method-object-param';\nimport { ContractMethod } from './contract-method-flat-param';\nimport { ParameterSchema, ViewSchema } from '@taquito/michelson-encoder';\nimport { RpcClientInterface, MichelsonV1Expression } from '@taquito/rpc';\nimport { OnChainView } from './contract-on-chain-view';\n\nexport class ContractMethodFactory<T extends ContractProvider | Wallet> {\n constructor(private provider: T, private contractAddress: string) {}\n\n createContractMethodFlatParams(\n smartContractMethodSchema: ParameterSchema,\n smartContractMethodName: string,\n args: any[],\n isMultipleEntrypoint = true,\n isAnonymous = false\n ) {\n return new ContractMethod<T>(\n this.provider,\n this.contractAddress,\n smartContractMethodSchema,\n smartContractMethodName,\n args,\n isMultipleEntrypoint,\n isAnonymous\n );\n }\n\n createContractMethodObjectParam(\n smartContractMethodSchema: ParameterSchema,\n smartContractMethodName: string,\n args: any[],\n isMultipleEntrypoint = true,\n isAnonymous = false\n ) {\n return new ContractMethodObject<T>(\n this.provider,\n this.contractAddress,\n smartContractMethodSchema,\n smartContractMethodName,\n args,\n isMultipleEntrypoint,\n isAnonymous\n );\n }\n\n createContractViewObjectParam(\n rpc: RpcClientInterface,\n smartContractViewSchema: ViewSchema,\n contractStorageType: MichelsonV1Expression,\n contractStorageValue: MichelsonV1Expression,\n viewArgs: any\n ) {\n return new OnChainView(\n rpc,\n this.contractAddress,\n smartContractViewSchema,\n contractStorageType,\n contractStorageValue,\n viewArgs\n );\n }\n}\n","import { MichelsonV1Expression } from '@taquito/rpc';\nimport { Contract, ContractAbstraction, WalletContract } from './contract';\nimport { TezosOperationError } from '../operations/operation-errors';\nimport { ContractProvider } from './interface';\nimport { Wallet } from '../wallet';\n\nexport default class LambdaView {\n public readonly voidLambda: object;\n\n constructor(\n private lambdaContract: Contract | WalletContract,\n private viewContract: ContractAbstraction<ContractProvider | Wallet>,\n public readonly viewMethod: string = 'default',\n private contractParameter: MichelsonV1Expression = { prim: 'Unit' }\n ) {\n this.voidLambda = this.createVoidLambda();\n }\n\n async execute(): Promise<any> {\n try {\n await this.lambdaContract.methods.default(this.voidLambda).send();\n } catch (ex) {\n if (ex instanceof TezosOperationError) {\n const lastError: any = ex.errors[ex.errors.length - 1];\n\n const failedWith = lastError.with;\n return failedWith;\n } else {\n throw ex;\n }\n }\n }\n\n private createVoidLambda(): object {\n const [parameter, callback] = this.getView();\n\n let contractArgs: MichelsonV1Expression[] = [\n {\n prim: 'pair',\n args: [parameter, { prim: 'contract', args: [callback] }],\n },\n ];\n\n if (this.viewMethod === 'default') {\n contractArgs = ([{ string: '%default' }] as MichelsonV1Expression[]).concat(contractArgs);\n }\n\n return [\n { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] },\n { prim: 'NONE', args: [{ prim: 'key_hash' }] },\n {\n prim: 'CREATE_CONTRACT',\n args: [\n [\n { prim: 'parameter', args: [callback] },\n { prim: 'storage', args: [{ prim: 'unit' }] },\n {\n prim: 'code',\n args: [[{ prim: 'CAR' }, { prim: 'FAILWITH' }]],\n },\n ],\n ],\n },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'LAMBDA',\n args: [\n {\n prim: 'pair',\n args: [{ prim: 'address' }, { prim: 'unit' }],\n },\n {\n prim: 'pair',\n args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }],\n },\n [\n { prim: 'CAR' },\n { prim: 'CONTRACT', args: [callback] },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'string' }, { string: `Callback type unmatched` }],\n },\n { prim: 'FAILWITH' },\n ],\n [],\n ],\n },\n {\n prim: 'PUSH',\n args: [parameter, this.contractParameter],\n },\n { prim: 'PAIR' },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'PUSH',\n args: [\n { prim: 'address' },\n { string: `${this.viewContract.address}%${this.viewMethod}` },\n ],\n },\n { prim: 'DUP' },\n { prim: 'CONTRACT', args: contractArgs },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [\n { prim: 'string' },\n { string: `Contract does not exist` },\n ],\n },\n { prim: 'FAILWITH' },\n ],\n [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }],\n ],\n },\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: '0' }],\n },\n ],\n ],\n },\n { prim: 'TRANSFER_TOKENS' },\n {\n prim: 'DIP',\n args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]],\n },\n { prim: 'CONS' },\n { prim: 'DIP', args: [[{ prim: 'UNIT' }]] },\n { prim: 'PAIR' },\n ],\n ],\n },\n ],\n ],\n },\n { prim: 'APPLY' },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'address' }, { string: this.lambdaContract.address }],\n },\n { prim: 'DUP' },\n {\n prim: 'CONTRACT',\n args: [\n {\n prim: 'lambda',\n args: [\n { prim: 'unit' },\n {\n prim: 'pair',\n args: [\n { prim: 'list', args: [{ prim: 'operation' }] },\n { prim: 'unit' },\n ],\n },\n ],\n },\n ],\n },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'string' }, { string: `Contract does not exists` }],\n },\n { prim: 'FAILWITH' },\n ],\n [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }],\n ],\n },\n { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] },\n ],\n ],\n },\n { prim: 'TRANSFER_TOKENS' },\n {\n prim: 'DIP',\n args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]],\n },\n { prim: 'CONS' },\n ],\n ],\n },\n { prim: 'CONS' },\n { prim: 'DIP', args: [[{ prim: 'UNIT' }]] },\n { prim: 'PAIR' },\n ];\n }\n\n private getView(): [MichelsonV1Expression, MichelsonV1Expression] {\n const entrypoints = this.viewContract.entrypoints.entrypoints;\n const entrypoint = entrypoints[this.viewMethod] as MichelsonV1Expression;\n\n if (!entrypoint) {\n throw Error(\n `Contract at ${this.viewContract.address} does not have entrypoint: ${this.viewMethod}`\n );\n }\n\n if (!('prim' in entrypoint) || !entrypoint.args) {\n // TODO: Enhance this error message to be more descriptive\n throw Error('Entrypoint args undefined');\n }\n\n const args = Array.from(entrypoint.args) as [MichelsonV1Expression, MichelsonV1Expression];\n const [parameter, callbackContract] = args;\n if ('annots' in parameter) {\n delete parameter['annots'];\n }\n\n if (!('prim' in callbackContract) || !callbackContract.args) {\n // TODO: Enhance this error message to be more descriptive\n throw Error('Callback contract args undefined');\n }\n\n let message;\n if (entrypoint.prim !== 'pair') {\n message = `Expected {'prim': 'pair', ..} but found {'prim': ${entrypoint.prim}, ..}`;\n } else if (args.length !== 2) {\n message = `Expected an Array of length 2, but found: ${args}`;\n } else if (callbackContract.prim !== 'contract') {\n message = `Expected a {prim: 'contract', ...}, but found: ${callbackContract.prim}`;\n } else if (callbackContract.args && callbackContract.args.length !== 1) {\n message = `Expected a single argument to 'contract', but found: ${callbackContract.args}`;\n }\n\n if (message) throw Error(message);\n\n return [parameter, callbackContract.args[0]] as [MichelsonV1Expression, MichelsonV1Expression];\n }\n}\n","import { ParameterSchema, Schema, ViewSchema } from '@taquito/michelson-encoder';\nimport {\n EntrypointsResponse,\n MichelsonV1Expression,\n RpcClientInterface,\n ScriptResponse,\n} from '@taquito/rpc';\nimport { ChainIds, DefaultLambdaAddresses } from '../constants';\nimport { Wallet } from '../wallet';\nimport { ContractMethodFactory } from './contract-methods/contract-method-factory';\nimport { ContractMethod } from './contract-methods/contract-method-flat-param';\nimport { ContractMethodObject } from './contract-methods/contract-method-object-param';\nimport { OnChainView } from './contract-methods/contract-on-chain-view';\nimport { InvalidParameterError, UndefinedLambdaContractError } from './errors';\nimport { ContractProvider, StorageProvider } from './interface';\nimport LambdaView from './lambda-view';\n\nexport const DEFAULT_SMART_CONTRACT_METHOD_NAME = 'default';\n\n/**\n * @description Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method\n */\nexport class ContractView {\n constructor(\n private currentContract: ContractAbstraction<ContractProvider | Wallet>,\n private provider: ContractProvider,\n private name: string,\n private chainId: string,\n private callbackParametersSchema: ParameterSchema,\n private parameterSchema: ParameterSchema,\n private args: any[]\n ) {}\n\n /**\n *\n * @description Find which lambda contract to use based on the current network,\n * encode parameters to Michelson,\n * create an instance of Lambdaview to retrieve data, and\n * Decode Michelson response\n *\n * @param Options Address of a lambda contract (sandbox users)\n */\n async read(customLambdaAddress?: string) {\n let lambdaAddress;\n\n // TODO Verify if the 'customLambdaAdress' is a valid originated contract and if not, return an appropriate error message. \n if (customLambdaAddress) {\n lambdaAddress = customLambdaAddress;\n } else if (this.chainId === ChainIds.GRANADANET) {\n lambdaAddress = DefaultLambdaAddresses.GRANADANET;\n } else if (this.chainId === ChainIds.HANGZHOUNET) {\n lambdaAddress = DefaultLambdaAddresses.HANGZHOUNET;\n } else if (this.chainId === ChainIds.ITHACANET) {\n lambdaAddress = DefaultLambdaAddresses.ITHACANET;\n } else if (this.chainId === ChainIds.ITHACANET2) {\n lambdaAddress = DefaultLambdaAddresses.ITHACANET2;\n } else if (this.chainId === ChainIds.MAINNET) {\n lambdaAddress = DefaultLambdaAddresses.MAINNET;\n } else {\n throw new UndefinedLambdaContractError();\n }\n\n const lambdaContract = await this.provider.at(lambdaAddress);\n const arg = this.parameterSchema.Encode(...this.args);\n const lambdaView = new LambdaView(lambdaContract, this.currentContract, this.name, arg);\n const failedWith = await lambdaView.execute();\n const response = this.callbackParametersSchema.Execute(failedWith);\n return response;\n }\n}\n\nconst validateArgs = (args: any[], schema: ParameterSchema, name: string) => {\n const sigs = schema.ExtractSignatures();\n\n if (!sigs.find((x: any[]) => x.length === args.length)) {\n throw new InvalidParameterError(name, sigs, args);\n }\n};\n\n// lambda view tzip4\nconst isView = (entrypoint: MichelsonV1Expression): boolean => {\n let isView = false;\n if ('prim' in entrypoint && entrypoint.prim === 'pair' && entrypoint.args) {\n const lastElement = entrypoint.args[entrypoint.args.length - 1];\n if ('prim' in lastElement && lastElement.prim === 'contract') {\n isView = true;\n }\n }\n return isView;\n};\n\nexport type Contract = ContractAbstraction<ContractProvider>;\nexport type WalletContract = ContractAbstraction<Wallet>;\n\nconst isContractProvider = (variableToCheck: any): variableToCheck is ContractProvider =>\n variableToCheck.contractProviderTypeSymbol !== undefined;\n\n\ntype DefaultMethods<T extends ContractProvider | Wallet> = Record<string, (...args: any[]) => ContractMethod<T>>;\ntype DefaultMethodsObject<T extends ContractProvider | Wallet> = Record<string, (args?: any) => ContractMethodObject<T>>;\ntype DefaultViews = Record<string, (...args: any[]) => ContractView>;\ntype DefaultContractViews = Record<string, (args?: any) => OnChainView>;\ntype DefaultStorage = unknown; // Record<string, unknown>;\n\ntype PromiseReturnType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : any;\nexport type ContractStorageType<T extends ContractAbstraction<ContractProvider|Wallet>> = PromiseReturnType<T['storage']>;\nexport type DefaultContractType = ContractAbstraction<ContractProvider>;\nexport type DefaultWalletType = ContractAbstraction<Wallet>;\n\n/**\n * @description Smart contract abstraction\n */\nexport class ContractAbstraction<T extends ContractProvider | Wallet,\n TMethods extends DefaultMethods<T> = DefaultMethods<T>,\n TMethodsObject extends DefaultMethodsObject<T> = DefaultMethodsObject<T>,\n TViews extends DefaultViews = DefaultViews,\n TContractViews extends DefaultContractViews = DefaultContractViews,\n TStorage extends DefaultStorage = DefaultStorage\n> {\n private contractMethodFactory: ContractMethodFactory<T>;\n /**\n * @description Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods.\n * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number.\n *\n */\n public methods: TMethods = {} as TMethods;\n /**\n * @description Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods.\n * `methodsObject` serves the exact same purpose as the `methods` member. The difference is that it allows passing the parameter in an object format when calling the smart contract method (instead of the flattened representation)\n * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number.\n *\n */\n public methodsObject: TMethodsObject = {} as TMethodsObject;\n /**\n * @description Contains lamda views (tzip4) that are implemented by the target Tezos Smart Contract, and offers the user to call the lambda views as if they were native TS/JS methods.\n * NB: These are the view defined in the tzip4 standard, not the views introduced by the Hangzhou protocol.\n */\n public views: TViews = {} as TViews;\n /**\n * @description Contains on-chain views that are defined by the target Tezos Smart Contract, and offers the user to simulate the views execution as if they were native TS/JS methods.\n * NB: the expected format for the parameter when calling a smart contract view is the object format (same format as for the storage) and not the flattened representation.\n *\n */\n public contractViews: TContractViews = {} as TContractViews;\n\n public readonly schema: Schema;\n\n public readonly parameterSchema: ParameterSchema;\n public readonly viewSchema: ViewSchema[];\n\n constructor(\n public readonly address: string,\n public readonly script: ScriptResponse,\n provider: T,\n private storageProvider: StorageProvider,\n public readonly entrypoints: EntrypointsResponse,\n private chainId: string,\n rpc: RpcClientInterface\n ) {\n this.contractMethodFactory = new ContractMethodFactory(provider, address);\n this.schema = Schema.fromRPCResponse({ script: this.script });\n this.parameterSchema = ParameterSchema.fromRPCResponse({ script: this.script });\n\n this.viewSchema = ViewSchema.fromRPCResponse({ script: this.script });\n if (this.viewSchema.length !== 0) {\n this._initializeOnChainViews(this, rpc, this.viewSchema);\n }\n this._initializeMethods(this, provider, this.entrypoints.entrypoints, this.chainId);\n }\n\n private _initializeMethods(\n currentContract: ContractAbstraction<T>,\n provider: T,\n entrypoints: {\n [key: string]: object;\n },\n chainId: string\n ) {\n const parameterSchema = this.parameterSchema;\n const keys = Object.keys(entrypoints);\n if (parameterSchema.isMultipleEntryPoint) {\n keys.forEach((smartContractMethodName) => {\n const smartContractMethodSchema = new ParameterSchema(entrypoints[smartContractMethodName]);\n\n (this.methods as DefaultMethods<T>)[smartContractMethodName] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n smartContractMethodSchema,\n smartContractMethodName,\n args\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[smartContractMethodName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n smartContractMethodSchema,\n smartContractMethodName,\n args\n );\n };\n\n if (isContractProvider(provider)) {\n if (isView(entrypoints[smartContractMethodName])) {\n const view = function (...args: any[]) {\n const entrypointParamWithoutCallback = (entrypoints[smartContractMethodName] as any)\n .args[0];\n const smartContractMethodSchemaWithoutCallback = new ParameterSchema(\n entrypointParamWithoutCallback\n );\n const parametersCallback = (entrypoints[smartContractMethodName] as any).args[1]\n .args[0];\n const smartContractMethodCallbackSchema = new ParameterSchema(parametersCallback);\n\n validateArgs(args, smartContractMethodSchemaWithoutCallback, smartContractMethodName);\n return new ContractView(\n currentContract,\n provider,\n smartContractMethodName,\n chainId,\n smartContractMethodCallbackSchema,\n smartContractMethodSchemaWithoutCallback,\n args\n );\n };\n (this.views as DefaultViews)[smartContractMethodName] = view;\n }\n }\n });\n\n // Deal with methods with no annotations which were not discovered by the RPC endpoint\n // Methods with no annotations are discovered using parameter schema\n const anonymousMethods = Object.keys(parameterSchema.ExtractSchema()).filter(\n (key) => Object.keys(entrypoints).indexOf(key) === -1\n );\n\n anonymousMethods.forEach((smartContractMethodName) => {\n (this.methods as DefaultMethods<T>)[smartContractMethodName] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n parameterSchema,\n smartContractMethodName,\n args,\n false,\n true\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[smartContractMethodName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n parameterSchema,\n smartContractMethodName,\n args,\n false,\n true\n );\n };\n });\n } else {\n const smartContractMethodSchema = this.parameterSchema;\n (this.methods as DefaultMethods<T>)[DEFAULT_SMART_CONTRACT_METHOD_NAME] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n smartContractMethodSchema,\n DEFAULT_SMART_CONTRACT_METHOD_NAME,\n args,\n false\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[DEFAULT_SMART_CONTRACT_METHOD_NAME] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n smartContractMethodSchema,\n DEFAULT_SMART_CONTRACT_METHOD_NAME,\n args,\n false\n );\n };\n }\n }\n\n private _initializeOnChainViews(\n currentContract: ContractAbstraction<T>,\n rpc: RpcClientInterface,\n allContractViews: ViewSchema[]\n ) {\n const storageType = this.schema.val;\n const storageValue = this.script.storage;\n\n allContractViews.forEach((viewSchema) => {\n (this.contractViews as DefaultContractViews)[viewSchema.viewName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractViewObjectParam(\n rpc,\n viewSchema,\n storageType,\n storageValue,\n args\n );\n };\n });\n }\n\n /**\n * @description Return a friendly representation of the smart contract storage\n */\n public storage<T extends TStorage = TStorage>() {\n return this.storageProvider.getStorage<T>(this.address, this.schema);\n }\n\n /**\n *\n * @description Return a friendly representation of the smart contract big map value\n *\n * @param key BigMap key to fetch\n *\n * @deprecated getBigMapKey has been deprecated in favor of getBigMapKeyByID\n *\n * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get\n */\n public bigMap(key: string) {\n return this.storageProvider.getBigMapKey(this.address, key, this.schema);\n }\n}\n","import { Schema, BigMapKeyType } from '@taquito/michelson-encoder';\nimport BigNumber from 'bignumber.js';\nimport { ContractProvider } from './interface';\nimport { HttpResponseError, STATUS_CODE } from '@taquito/http-utils';\n\nexport class BigMapAbstraction {\n constructor(private id: BigNumber, private schema: Schema, private provider: ContractProvider) {}\n\n /**\n *\n * @description Fetch one value in a big map\n *\n * @param keysToEncode Key to query (will be encoded properly according to the schema)\n * @param block optional block level to fetch the values from (head will be use by default)\n * @returns Return a well formatted json object of a big map value or undefined if the key is not found in the big map\n *\n */\n async get<T>(keyToEncode: BigMapKeyType, block?: number) {\n try {\n const id = await this.provider.getBigMapKeyByID<T>(\n this.id.toString(),\n keyToEncode,\n this.schema,\n block\n );\n return id;\n } catch (e) {\n if (e instanceof HttpResponseError && e.status === STATUS_CODE.NOT_FOUND) {\n return undefined;\n } else {\n throw e;\n }\n }\n }\n\n /**\n *\n * @description Fetch multiple values in a big map\n * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.\n * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.\n * If one of the keys does not exist in the big map, its value will be set to undefined.\n *\n * @param keysToEncode Array of keys to query (will be encoded properly according to the schema)\n * @param block optional block level to fetch the values from\n * @param batchSize optional batch size representing the number of requests to execute in parallel\n * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format\n *\n */\n async getMultipleValues<T>(keysToEncode: Array<BigMapKeyType>, block?: number, batchSize = 5) {\n return this.provider.getBigMapKeysByID<T>(\n this.id.toString(),\n keysToEncode,\n this.schema,\n block,\n batchSize\n );\n }\n\n toJSON() {\n return this.id.toString();\n }\n\n toString() {\n return this.id.toString();\n }\n}\n","import BigNumber from 'bignumber.js';\nimport { ContractProvider } from './interface';\n\nexport class SaplingStateAbstraction {\n constructor(private id: BigNumber, private provider: ContractProvider) { }\n\n /**\n *\n * @description Fetch the sapling state\n * \n * @param block optional block level to fetch the values from (head will be use by default)\n * @returns Return a json object of the sapling_state\n *\n */\n async getSaplingDiff(block?: number) {\n return this.provider.getSaplingDiffByID(this.id.toString(), block);\n }\n\n getId() {\n return this.id.toString();\n }\n}\n","import { Schema, Semantic } from '@taquito/michelson-encoder';\nimport { BigMapAbstraction } from './big-map';\nimport { ContractProvider } from './interface';\nimport BigNumber from 'bignumber.js';\nimport { MichelsonV1Expression } from '@taquito/rpc';\nimport { SaplingStateAbstraction } from './sapling-state-abstraction';\n\n// Override the default michelson encoder semantic to provide richer abstraction over storage properties\nexport const smartContractAbstractionSemantic: (p: ContractProvider) => Semantic = (\n provider: ContractProvider\n) => ({\n // Provide a specific abstraction for BigMaps\n big_map: (val: MichelsonV1Expression, code: MichelsonV1Expression) => {\n if (!val || !('int' in val) || val.int === undefined) {\n // Return an empty object in case of missing big map ID\n return {};\n } else {\n const schema = new Schema(code);\n return new BigMapAbstraction(new BigNumber(val.int), schema, provider);\n }\n },\n sapling_state: (val: MichelsonV1Expression) => {\n if (!val || !('int' in val) || val.int === undefined) {\n // Return an empty object in case of missing sapling state ID\n return {};\n } else {\n return new SaplingStateAbstraction(new BigNumber(val.int), provider);\n }\n }\n /*\n // TODO: embed useful other abstractions\n 'contract': () => {},\n 'address': () => {}\n */\n});\n","import { HttpResponseError, STATUS_CODE } from '@taquito/http-utils';\nimport { BigMapKeyType, MichelsonMap, MichelsonMapKey, Schema } from '@taquito/michelson-encoder';\nimport { OpKind, ScriptResponse } from '@taquito/rpc';\nimport { encodeExpr } from '@taquito/utils';\nimport { OperationBatch } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { DelegateOperation } from '../operations/delegate-operation';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport { OriginationOperation } from '../operations/origination-operation';\nimport { RegisterGlobalConstantOperation } from '../operations/register-global-constant-operation';\nimport { RevealOperation } from '../operations/reveal-operation';\nimport { TransactionOperation } from '../operations/transaction-operation';\nimport {\n DelegateParams,\n isOpRequireReveal,\n OriginateParams,\n ParamsWithKind,\n RegisterDelegateParams,\n RegisterGlobalConstantParams,\n RevealParams,\n RPCOperation,\n TransferParams,\n withKind,\n} from '../operations/types';\nimport { DefaultContractType, ContractStorageType, ContractAbstraction } from './contract';\nimport { InvalidDelegationSource } from './errors';\nimport { ContractProvider, ContractSchema, EstimationProvider, StorageProvider } from './interface';\nimport {\n createOriginationOperation,\n createRegisterDelegateOperation,\n createRegisterGlobalConstantOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n} from './prepare';\nimport { smartContractAbstractionSemantic } from './semantic';\nimport { \n validateAddress,\n validateContractAddress,\n InvalidContractAddressError,\n InvalidAddressError, \n ValidationResult \n} from '@taquito/utils';\nexport class RpcContractProvider\n extends OperationEmitter\n implements ContractProvider, StorageProvider\n{\n constructor(context: Context, private estimator: EstimationProvider) {\n super(context);\n }\n contractProviderTypeSymbol = Symbol.for('taquito--provider-type-symbol');\n\n /**\n *\n * @description Return a well formatted json object of the contract storage\n *\n * @param contract contract address you want to get the storage from\n * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema\n *\n * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script\n */\n async getStorage<T>(contract: string, schema?: ContractSchema): Promise<T> {\n if (validateContractAddress(contract) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${contract}`);\n }\n if (!schema) {\n schema = await this.rpc.getNormalizedScript(contract);\n }\n\n let contractSchema: Schema;\n if (Schema.isSchema(schema)) {\n contractSchema = schema;\n } else {\n contractSchema = Schema.fromRPCResponse({ script: schema as ScriptResponse });\n }\n\n const storage = await this.rpc.getStorage(contract);\n\n return contractSchema.Execute(storage, smartContractAbstractionSemantic(this)) as T; // Cast into T because only the caller can know the true type of the storage\n }\n\n /**\n *\n * @description Return a well formatted json object of the contract big map storage\n *\n * @param contract contract address you want to get the storage from\n * @param key contract big map key to fetch value from\n * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema\n *\n * @deprecated Deprecated in favor of getBigMapKeyByID\n *\n * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get\n */\n async getBigMapKey<T>(contract: string, key: string, schema?: ContractSchema): Promise<T> {\n if (validateContractAddress(contract) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${contract}`);\n }\n if (!schema) {\n schema = await this.rpc.getNormalizedScript(contract);\n }\n\n let contractSchema: Schema;\n if (Schema.isSchema(schema)) {\n contractSchema = schema;\n } else {\n contractSchema = Schema.fromRPCResponse({ script: schema as ScriptResponse });\n }\n\n const encodedKey = contractSchema.EncodeBigMapKey(key);\n\n const val = await this.rpc.getBigMapKey(contract, encodedKey);\n\n return contractSchema.ExecuteOnBigMapValue(val) as T; // Cast into T because only the caller can know the true type of the storage\n }\n\n /**\n *\n * @description Return a well formatted json object of a big map value\n *\n * @param id Big Map ID\n * @param keyToEncode key to query (will be encoded properly according to the schema)\n * @param schema Big Map schema (can be determined using your contract type)\n * @param block optional block level to fetch the values from\n *\n * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr\n */\n async getBigMapKeyByID<T>(\n id: string,\n keyToEncode: BigMapKeyType,\n schema: Schema,\n block?: number\n ): Promise<T> {\n const { key, type } = schema.EncodeBigMapKey(keyToEncode);\n const { packed } = await this.context.packer.packData({ data: key, type });\n\n const encodedExpr = encodeExpr(packed);\n\n const bigMapValue = block\n ? await this.context.rpc.getBigMapExpr(id.toString(), encodedExpr, { block: String(block) })\n : await this.context.rpc.getBigMapExpr(id.toString(), encodedExpr);\n\n return schema.ExecuteOnBigMapValue(bigMapValue, smartContractAbstractionSemantic(this)) as T;\n }\n\n /**\n *\n * @description Fetch multiple values in a big map\n * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.\n * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.\n * If one of the keys does not exist in the big map, its value will be set to undefined.\n *\n * @param id Big Map ID\n * @param keys Array of keys to query (will be encoded properly according to the schema)\n * @param schema Big Map schema (can be determined using your contract type)\n * @param block optional block level to fetch the values from\n * @param batchSize optional batch size representing the number of requests to execute in parallel\n * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format\n *\n */\n async getBigMapKeysByID<T>(\n id: string,\n keys: Array<BigMapKeyType>,\n schema: Schema,\n block?: number,\n batchSize = 5\n ): Promise<MichelsonMap<MichelsonMapKey, T | undefined>> {\n const level = await this.getBlockForRequest(keys, block);\n const bigMapValues = new MichelsonMap<MichelsonMapKey, T | undefined>();\n\n // Execute batch of promises in series\n let position = 0;\n let results: Array<T | undefined> = [];\n\n while (position < keys.length) {\n const keysBatch = keys.slice(position, position + batchSize);\n const batch = keysBatch.map((keyToEncode) =>\n this.getBigMapValueOrUndefined<T>(keyToEncode, id, schema, level)\n );\n results = [...results, ...(await Promise.all(batch))];\n position += batchSize;\n }\n\n for (let i = 0; i < results.length; i++) {\n bigMapValues.set(keys[i], results[i]);\n }\n\n return bigMapValues;\n }\n\n private async getBlockForRequest(keys: Array<BigMapKeyType>, block?: number) {\n return keys.length === 1 || typeof block !== 'undefined'\n ? block\n : (await this.rpc.getBlock())?.header.level;\n }\n\n private async getBigMapValueOrUndefined<T>(\n keyToEncode: BigMapKeyType,\n id: string,\n schema: Schema,\n level?: number\n ) {\n try {\n return await this.getBigMapKeyByID<T>(id, keyToEncode, schema, level);\n } catch (ex) {\n if (ex instanceof HttpResponseError && ex.status === STATUS_CODE.NOT_FOUND) {\n return;\n } else {\n throw ex;\n }\n }\n }\n\n /**\n *\n * @description Return a well formatted json object of a sapling state\n *\n * @param id Sapling state ID\n * @param block optional block level to fetch the value from\n *\n */\n async getSaplingDiffByID(id: string, block?: number) {\n const saplingState = block\n ? await this.context.rpc.getSaplingDiffById(id.toString(), { block: String(block) })\n : await this.context.rpc.getSaplingDiffById(id.toString());\n return saplingState;\n }\n\n private async addRevealOperationIfNeeded(operation: RPCOperation, publicKeyHash: string) {\n if (isOpRequireReveal(operation)) {\n const ops: RPCOperation[] = [operation];\n const publicKey = await this.signer.publicKey();\n const estimateReveal = await this.estimator.reveal();\n if (estimateReveal) {\n const reveal: withKind<RevealParams, OpKind.REVEAL> = { kind: OpKind.REVEAL };\n const estimatedReveal = await this.estimate(reveal, async () => estimateReveal);\n ops.unshift(await createRevealOperation({ ...estimatedReveal }, publicKeyHash, publicKey));\n return ops;\n }\n }\n return operation;\n }\n\n /**\n *\n * @description Originate a new contract according to the script in parameters. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @warn You cannot specify storage and init at the same time (use init to pass the raw michelson representation of storage)\n *\n * @param OriginationOperation Originate operation parameter\n */\n async originate<TContract extends DefaultContractType = DefaultContractType>(params: OriginateParams<ContractStorageType<TContract>>) {\n const estimate = await this.estimate(params, this.estimator.originate.bind(this.estimator));\n\n const publicKeyHash = await this.signer.publicKeyHash();\n const operation = await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...params,\n ...estimate,\n })\n );\n const ops = await this.addRevealOperationIfNeeded(operation, publicKeyHash);\n const preparedOrigination = await this.prepareOperation({\n operation: ops,\n source: publicKeyHash,\n });\n const forgedOrigination = await this.forge(preparedOrigination);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(forgedOrigination);\n return new OriginationOperation<TContract>(hash, operation, forgedBytes, opResponse, context, this);\n }\n\n /**\n *\n * @description Set the delegate for a contract. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param SetDelegate operation parameter\n */\n async setDelegate(params: DelegateParams) {\n if ( params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source Address: ${params.source}`);\n }\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate Address: ${params.delegate}`);\n }\n\n // Since babylon delegation source cannot smart contract\n if (/kt1/i.test(params.source)) {\n throw new InvalidDelegationSource(params.source);\n }\n\n const estimate = await this.estimate(params, this.estimator.setDelegate.bind(this.estimator));\n const publicKeyHash = await this.signer.publicKeyHash();\n const operation = await createSetDelegateOperation({ ...params, ...estimate });\n const sourceOrDefault = params.source || publicKeyHash;\n const ops = await this.addRevealOperationIfNeeded(operation, publicKeyHash);\n const prepared = await this.prepareOperation({\n operation: ops,\n source: sourceOrDefault,\n });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new DelegateOperation(\n hash,\n operation,\n sourceOrDefault,\n forgedBytes,\n opResponse,\n context\n );\n }\n\n /**\n *\n * @description Register the current address as delegate. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param RegisterDelegate operation parameter\n */\n async registerDelegate(params: RegisterDelegateParams) {\n const estimate = await this.estimate(\n params,\n this.estimator.registerDelegate.bind(this.estimator)\n );\n const source = await this.signer.publicKeyHash();\n const operation = await createRegisterDelegateOperation({ ...params, ...estimate }, source);\n const ops = await this.addRevealOperationIfNeeded(operation, source);\n const prepared = await this.prepareOperation({ operation: ops });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new DelegateOperation(hash, operation, source, forgedBytes, opResponse, context);\n }\n\n /**\n *\n * @description Transfer tz from current address to a specific address. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param Transfer operation parameter\n */\n async transfer(params: TransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address passed in 'to' parameter: ${params.to}`);\n }\n if (params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address passed in 'source' parameter: ${params.source}`);\n }\n\n const publickKeyHash = await this.signer.publicKeyHash();\n const estimate = await this.estimate(params, this.estimator.transfer.bind(this.estimator));\n const operation = await createTransferOperation({\n ...params,\n ...estimate,\n });\n const source = params.source || publickKeyHash;\n const ops = await this.addRevealOperationIfNeeded(operation, publickKeyHash);\n const prepared = await this.prepareOperation({ operation: ops, source: params.source });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new TransactionOperation(hash, operation, source, forgedBytes, opResponse, context);\n }\n\n /**\n *\n * @description Reveal the current address. Will throw an error if the address is already revealed.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param RevealParams operation parameter\n */\n async reveal(params: RevealParams) {\n const publicKeyHash = await this.signer.publicKeyHash();\n const estimateReveal = await this.estimator.reveal(params);\n if (estimateReveal) {\n const estimated = await this.estimate(params, async () => estimateReveal);\n const operation = await createRevealOperation(\n {\n ...estimated,\n },\n publicKeyHash,\n await this.signer.publicKey()\n );\n const prepared = await this.prepareOperation({ operation, source: publicKeyHash });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new RevealOperation(hash, operation, publicKeyHash, forgedBytes, opResponse, context);\n } else {\n throw new Error('The current address is already revealed.');\n }\n }\n\n /**\n *\n * @description Register a Micheline expression in a global table of constants. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param params registerGlobalConstant operation parameter\n */\n async registerGlobalConstant(params: RegisterGlobalConstantParams) {\n const publickKeyHash = await this.signer.publicKeyHash();\n const estimate = await this.estimate(\n params,\n this.estimator.registerGlobalConstant.bind(this.estimator)\n );\n const operation = await createRegisterGlobalConstantOperation({\n ...params,\n ...estimate,\n });\n const ops = await this.addRevealOperationIfNeeded(operation, publickKeyHash);\n const prepared = await this.prepareOperation({ operation: ops, source: publickKeyHash });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new RegisterGlobalConstantOperation(\n hash,\n operation,\n publickKeyHash,\n forgedBytes,\n opResponse,\n context\n );\n }\n\n async at<T extends DefaultContractType = DefaultContractType>(\n address: string,\n contractAbstractionComposer: ContractAbstractionComposer<T> = (x) => x as any\n ): Promise<T> {\n if (validateContractAddress(address) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${address}`);\n }\n const rpc = this.context.withExtensions().rpc;\n const script = await rpc.getNormalizedScript(address);\n const entrypoints = await rpc.getEntrypoints(address);\n const blockHeader = await this.rpc.getBlockHeader();\n const chainId = blockHeader.chain_id;\n const abs = new ContractAbstraction(address, script, this, this, entrypoints, chainId, rpc);\n return contractAbstractionComposer(abs, this.context);\n }\n\n /**\n *\n * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch\n *\n * @returns A batch object from which we can add more operation or send a command to execute the batch\n *\n * @param params List of operation to batch together\n */\n batch(params?: ParamsWithKind[]) {\n const batch = new OperationBatch(this.context, this.estimator);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n}\n\ntype ContractAbstractionComposer<T> = (\n abs: ContractAbstraction<ContractProvider>,\n context: Context\n) => T;\n","import { Context } from '../context';\nimport { ParserProvider } from './interface';\nimport { Expr, GlobalConstantHashAndValue, Parser, Prim, ProtocolID } from '@taquito/michel-codec';\nimport { OriginateParams } from '../operations/types';\nimport { InvalidInitParameter, InvalidCodeParameter } from '../contract/errors';\nimport { Schema } from '@taquito/michelson-encoder';\nimport { MichelsonV1Expression } from '@taquito/rpc';\n\nexport class MichelCodecParser implements ParserProvider {\n constructor(private context: Context) {}\n\n private async getNextProto(): Promise<ProtocolID> {\n const { next_protocol } = await this.context.rpc.getBlockMetadata();\n return next_protocol as ProtocolID;\n }\n\n async parseScript(src: string): Promise<Expr[] | null> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseScript(src);\n }\n\n async parseMichelineExpression(src: string): Promise<Expr | null> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseMichelineExpression(src);\n }\n\n async parseJSON(src: object): Promise<Expr> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseJSON(src);\n }\n\n async prepareCodeOrigination(params: OriginateParams): Promise<OriginateParams> {\n const parsedParams = params;\n parsedParams.code = await this.formatCodeParam(params.code);\n if (params.init) {\n parsedParams.init = await this.formatInitParam(params.init);\n } else if (params.storage) {\n const storageType = (parsedParams.code as Expr[]).find(\n (p): p is Prim => 'prim' in p && p.prim === 'storage'\n );\n if (!storageType?.args) {\n throw new InvalidCodeParameter(\n 'The storage section is missing from the script',\n params.code\n );\n }\n const schema = new Schema(storageType.args[0] as MichelsonV1Expression);\n const globalconstantsHashAndValue = await this.findGlobalConstantsHashAndValue(schema);\n\n if (Object.keys(globalconstantsHashAndValue).length !== 0) {\n // If there are global constants in the storage part of the contract code,\n // they need to be locally expanded in order to encode the storage arguments\n const p = new Parser({ expandGlobalConstant: globalconstantsHashAndValue });\n const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);\n const schemaNoGlobalConst = new Schema(storageTypeNoGlobalConst);\n parsedParams.init = schemaNoGlobalConst.Encode(params.storage);\n } else {\n parsedParams.init = schema.Encode(params.storage);\n }\n delete parsedParams.storage;\n }\n return parsedParams;\n }\n\n private async formatCodeParam(code: string | object[]) {\n let parsedCode: Expr[];\n if (typeof code === 'string') {\n const c = await this.parseScript(code);\n if (c === null) {\n throw new InvalidCodeParameter('Invalid code parameter', code);\n }\n parsedCode = c;\n } else {\n const c = await this.parseJSON(code);\n const order = ['parameter', 'storage', 'code'];\n // Ensure correct ordering for RPC\n parsedCode = (c as Prim[]).sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));\n }\n return parsedCode;\n }\n\n private async formatInitParam(init: string | object) {\n let parsedInit: Expr;\n if (typeof init === 'string') {\n const c = await this.parseMichelineExpression(init);\n if (c === null) {\n throw new InvalidInitParameter('Invalid init parameter', init);\n }\n parsedInit = c;\n } else {\n parsedInit = await this.parseJSON(init);\n }\n return parsedInit;\n }\n\n private async findGlobalConstantsHashAndValue(schema: Schema) {\n const globalConstantTokens = schema.findToken('constant');\n const globalConstantsHashAndValue: GlobalConstantHashAndValue = {};\n\n if (globalConstantTokens.length !== 0) {\n for (const token of globalConstantTokens) {\n const tokenArgs = token.tokenVal.args;\n if (tokenArgs) {\n const hash: string = tokenArgs[0]['string'];\n const michelineValue = await this.context.globalConstantsProvider.getGlobalConstantByHash(\n hash\n );\n Object.assign(globalConstantsHashAndValue, {\n [hash]: michelineValue,\n });\n }\n }\n }\n return globalConstantsHashAndValue;\n }\n}\n","import { Packer } from './interface';\nimport { Context } from '../context';\nimport { PackDataParams, PackDataResponse } from '@taquito/rpc';\n\nexport class RpcPacker implements Packer {\n constructor(private context: Context) {}\n \n async packData(data: PackDataParams): Promise<PackDataResponse> {\n return this.context.rpc.packData(data);\n }\n}\n","export class GlobalConstantNotFound extends Error {\n name = 'GlobalConstantNotFound';\n\n constructor(public hash: string) {\n super(\n `Please load the value associated with the constant ${hash} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`\n );\n }\n}\n\nexport class UnconfiguredGlobalConstantsProviderError extends Error {\n name = 'UnconfiguredGlobalConstantsProviderError';\n\n constructor() {\n super(\n 'No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance.'\n );\n }\n}\n","import { Expr } from \"@taquito/michel-codec\";\nimport { UnconfiguredGlobalConstantsProviderError } from \"./error\";\nimport { GlobalConstantHash, GlobalConstantsProvider } from \"./interface-global-constants-provider\";\n\nexport class NoopGlobalConstantsProvider implements GlobalConstantsProvider {\n async getGlobalConstantByHash(_hash: GlobalConstantHash): Promise<Expr> {\n throw new UnconfiguredGlobalConstantsProviderError();\n }\n}","import { RpcClient, RpcClientInterface } from '@taquito/rpc';\nimport { Protocols } from './constants';\nimport { Forger } from './forger/interface';\nimport { RpcForger } from './forger/rpc-forger';\nimport { Injector } from './injector/interface';\nimport { RpcInjector } from './injector/rpc-injector';\nimport { Signer } from './signer/interface';\nimport { NoopSigner } from './signer/noop';\nimport { OperationFactory } from './wallet/operation-factory';\nimport { RpcTzProvider } from './tz/rpc-tz-provider';\nimport { RPCEstimateProvider } from './contract/rpc-estimate-provider';\nimport { RpcContractProvider } from './contract/rpc-contract-provider';\nimport { RPCBatchProvider } from './batch/rpc-batch-provider';\n\nimport { Wallet, LegacyWalletProvider, WalletProvider } from './wallet';\nimport { ParserProvider } from './parser/interface';\nimport { MichelCodecParser } from './parser/michel-codec-parser';\nimport { Packer } from './packer/interface';\nimport { RpcPacker } from './packer/rpc-packer';\nimport BigNumber from 'bignumber.js';\nimport { retry } from 'rxjs/operators';\nimport { BehaviorSubject, OperatorFunction } from 'rxjs';\nimport { GlobalConstantsProvider } from './global-constants/interface-global-constants-provider';\nimport { NoopGlobalConstantsProvider } from './global-constants/noop-global-constants-provider';\n\nexport interface TaquitoProvider<T, K extends Array<any>> {\n new (context: Context, ...rest: K): T;\n}\n\nexport interface ConfigConfirmation {\n confirmationPollingIntervalSecond?: number;\n confirmationPollingTimeoutSecond: number;\n defaultConfirmationCount: number;\n}\n\nexport const defaultConfigConfirmation: ConfigConfirmation = {\n defaultConfirmationCount: 1,\n confirmationPollingTimeoutSecond: 180,\n};\n\n// The shouldObservableSubscriptionRetry parameter is related to the observable in ObservableSubsription class.\n// When set to true, the observable won't die when getBlock rpc call fails; the error will be reported via the error callback,\n// and it will continue to poll for new blocks.\nexport interface ConfigStreamer {\n streamerPollingIntervalMilliseconds: number;\n shouldObservableSubscriptionRetry: boolean;\n observableSubscriptionRetryFunction: OperatorFunction<any, any>;\n}\n\nexport const defaultConfigStreamer: ConfigStreamer = {\n streamerPollingIntervalMilliseconds: 20000,\n shouldObservableSubscriptionRetry: false,\n observableSubscriptionRetryFunction: retry(),\n};\n\n/**\n * @description Encapsulate common service used throughout different part of the library\n */\nexport class Context {\n private _rpcClient: RpcClientInterface;\n private _forger: Forger;\n private _parser: ParserProvider;\n private _injector: Injector;\n private _walletProvider: WalletProvider;\n public readonly operationFactory: OperationFactory;\n private _packer: Packer;\n private providerDecorator: Array<(context: Context) => Context> = [];\n private _globalConstantsProvider: GlobalConstantsProvider;\n public readonly tz = new RpcTzProvider(this);\n public readonly estimate = new RPCEstimateProvider(this);\n public readonly contract = new RpcContractProvider(this, this.estimate);\n public readonly batch = new RPCBatchProvider(this, this.estimate);\n public readonly wallet = new Wallet(this);\n\n constructor(\n private _rpc: RpcClientInterface | string,\n private _signer: Signer = new NoopSigner(),\n private _proto?: Protocols,\n public readonly _config = new BehaviorSubject({\n ...defaultConfigStreamer,\n ...defaultConfigConfirmation,\n }),\n forger?: Forger,\n injector?: Injector,\n packer?: Packer,\n wallet?: WalletProvider,\n parser?: ParserProvider,\n globalConstantsProvider?: GlobalConstantsProvider\n ) {\n if (typeof this._rpc === 'string') {\n this._rpcClient = new RpcClient(this._rpc);\n } else {\n this._rpcClient = this._rpc;\n }\n this._forger = forger ? forger : new RpcForger(this);\n this._injector = injector ? injector : new RpcInjector(this);\n this.operationFactory = new OperationFactory(this);\n this._walletProvider = wallet ? wallet : new LegacyWalletProvider(this);\n this._parser = parser ? parser : new MichelCodecParser(this);\n this._packer = packer ? packer : new RpcPacker(this);\n this._globalConstantsProvider = globalConstantsProvider\n ? globalConstantsProvider\n : new NoopGlobalConstantsProvider();\n }\n\n get config(): ConfigConfirmation & ConfigStreamer {\n return this._config.getValue();\n }\n\n set config(value: ConfigConfirmation & ConfigStreamer) {\n this._config.next({\n ...value,\n });\n }\n\n setPartialConfig(value: Partial<ConfigConfirmation> & Partial<ConfigStreamer>) {\n this._config.next({\n ...this._config.getValue(),\n ...value,\n });\n }\n\n get rpc(): RpcClientInterface {\n return this._rpcClient;\n }\n\n set rpc(value: RpcClientInterface) {\n this._rpcClient = value;\n }\n\n get injector() {\n return this._injector;\n }\n\n set injector(value: Injector) {\n this._injector = value;\n }\n\n get forger() {\n return this._forger;\n }\n\n set forger(value: Forger) {\n this._forger = value;\n }\n\n get signer() {\n return this._signer;\n }\n\n set signer(value: Signer) {\n this._signer = value;\n }\n\n get walletProvider() {\n return this._walletProvider;\n }\n\n set walletProvider(value: WalletProvider) {\n this._walletProvider = value;\n }\n\n set proto(value: Protocols | undefined) {\n this._proto = value;\n }\n\n get proto() {\n return this._proto;\n }\n\n get parser() {\n return this._parser;\n }\n\n set parser(value: ParserProvider) {\n this._parser = value;\n }\n\n get packer() {\n return this._packer;\n }\n\n set packer(value: Packer) {\n this._packer = value;\n }\n\n get globalConstantsProvider() {\n return this._globalConstantsProvider;\n }\n\n set globalConstantsProvider(value: GlobalConstantsProvider) {\n this._globalConstantsProvider = value;\n }\n\n async isAnyProtocolActive(protocol: string[] = []) {\n if (this._proto) {\n return protocol.includes(this._proto);\n } else {\n const { next_protocol } = await this.rpc.getBlockMetadata();\n return protocol.includes(next_protocol);\n }\n }\n\n async getConfirmationPollingInterval() {\n // Granada will generally halve the time between blocks, from 60 seconds to 30 seconds (mainnet).\n // We reduce the default value in the same proportion, from 10 to 5.\n const defaultInterval = 5;\n try {\n const constants = await this.rpc.getConstants();\n let blockTime = constants.time_between_blocks[0];\n if (constants.minimal_block_delay !== undefined) {\n blockTime = constants.minimal_block_delay;\n }\n let confirmationPollingInterval = BigNumber.sum(\n blockTime,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n new BigNumber(constants.delay_per_missing_endorsement!).multipliedBy(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n Math.max(0, constants.initial_endorsers! - constants.endorsers_per_block)\n )\n );\n\n // Divide the polling interval by a constant 3\n // to improvise for polling time to work in prod,\n // testnet and sandbox enviornment.\n confirmationPollingInterval = confirmationPollingInterval.dividedBy(3);\n\n this.config.confirmationPollingIntervalSecond =\n confirmationPollingInterval.toNumber() === 0 ? 0.1 : confirmationPollingInterval.toNumber();\n return this.config.confirmationPollingIntervalSecond;\n } catch (exception) {\n // Return default value if there is\n // an issue returning from constants\n // file.\n return defaultInterval;\n }\n }\n\n /**\n * @description Create a copy of the current context. Useful when you have long running operation and you do not want a context change to affect the operation\n */\n clone(): Context {\n return new Context(\n this.rpc,\n this.signer,\n this.proto,\n this._config,\n this.forger,\n this._injector,\n this.packer\n );\n }\n\n /**\n * @description Allows extensions set on the TezosToolkit to inject logic into the context\n */\n registerProviderDecorator(fx: (context: Context) => Context) {\n this.providerDecorator.push(fx);\n }\n\n /**\n * @description Applies the decorators on a cloned instance of the context and returned this cloned instance.\n * The decorators are functions that inject logic into the context.\n * They are provided by the extensions set on the TezosToolkit by calling the registerProviderDecorator method.\n */\n withExtensions = (): Context => {\n let clonedContext = this.clone();\n this.providerDecorator.forEach((decorator) => {\n clonedContext = decorator(clonedContext);\n });\n\n return clonedContext;\n };\n}\n","import { OpFilter, FilterExpression, Filter, OpHashFilter, SourceFilter, KindFilter, DestinationFilter, OperationContent } from './interface';\n\nconst opHashFilter = (op: OperationContent, filter: OpHashFilter) => op.hash === filter.opHash;\n\nconst sourceFilter = (x: OperationContent, filter: SourceFilter) => {\n switch (x.kind) {\n case 'endorsement':\n return 'metadata' in x && x.metadata.delegate === filter.source\n case 'activate_account':\n return 'metadata' in x && x.pkh === filter.source\n default:\n return 'source' in x && x.source === filter.source\n }\n}\n\nconst kindFilter = (x: OperationContent, filter: KindFilter) => 'kind' in x && x.kind === filter.kind;\n\nconst destinationFilter = (x: OperationContent, filter: DestinationFilter) => {\n switch (x.kind) {\n case 'delegation':\n return x.delegate === filter.destination;\n case 'origination':\n if (\n 'metadata' in x &&\n 'operation_result' in x.metadata &&\n 'originated_contracts' in x.metadata.operation_result &&\n Array.isArray(x.metadata.operation_result.originated_contracts)\n ) {\n return x.metadata.operation_result.originated_contracts.some(\n contract => contract === filter.destination\n );\n }\n break;\n case 'transaction':\n return x.destination === filter.destination;\n default:\n return false;\n }\n};\n\nexport const evaluateOpFilter = (op: OperationContent, filter: OpFilter) => {\n if ('opHash' in filter) {\n return opHashFilter(op, filter);\n } else if ('source' in filter) {\n return sourceFilter(op, filter)\n } else if ('kind' in filter) {\n return kindFilter(op, filter);\n } else if ('destination' in filter) {\n return destinationFilter(op, filter)\n }\n\n return false;\n};\n\nexport const evaluateExpression = (op: OperationContent, exp: FilterExpression): boolean => {\n if (Array.isArray(exp.and)) {\n return exp.and.every((x: OpFilter | FilterExpression) => evaluateFilter(op, x));\n } else if (Array.isArray(exp.or)) {\n return exp.or.some((x: OpFilter | FilterExpression) => evaluateFilter(op, x));\n } else {\n throw new Error('Filter expression must contains either and/or property');\n }\n};\n\nexport const evaluateFilter = (op: OperationContent, filter: Filter): boolean => {\n const filters: OpFilter[] | FilterExpression[] = [];\n if (!Array.isArray(filter)) {\n filters.push(filter as any);\n } else {\n filters.push(...(filter as any));\n }\n\n return (filters as any[]).every((filterOrExp: OpFilter | FilterExpression) => {\n if ('and' in filterOrExp || 'or' in filterOrExp) {\n return evaluateExpression(op, filterOrExp);\n } else {\n return evaluateOpFilter(op, filterOrExp as OpFilter);\n }\n });\n};\n","/* eslint-disable no-dupe-class-members */\nimport { Observable, Subject, NEVER, OperatorFunction } from 'rxjs';\nimport { Subscription } from './interface';\nimport { takeUntil, tap, catchError, retry } from 'rxjs/operators';\n\nexport class ObservableSubscription<T> implements Subscription<T> {\n private errorListeners: Array<(error: Error) => void> = [];\n private messageListeners: Array<(data: T) => void> = [];\n private closeListeners: Array<() => void> = [];\n private completed$ = new Subject();\n\n constructor(\n obs: Observable<T>,\n private shouldRetry: boolean = false,\n private operatorFunction: OperatorFunction<T, T> = retry<T>()\n ) {\n obs\n .pipe(\n takeUntil(this.completed$),\n tap(\n (data: T) => {\n this.call(this.messageListeners, data);\n },\n (error) => {\n this.call(this.errorListeners, error);\n },\n () => {\n this.call(this.closeListeners);\n }\n ),\n this.shouldRetry ? operatorFunction : tap(),\n catchError(() => NEVER)\n )\n .subscribe();\n }\n\n private call<K>(listeners: Array<(val: K) => void>, value?: K) {\n for (const l of listeners) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n l(value!);\n } catch (ex) {\n console.error(ex);\n }\n }\n }\n\n private remove(listeners: Array<any>, value: any) {\n const idx = listeners.indexOf(value);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n }\n\n public on(type: 'error', cb: (error: Error) => void): void;\n public on(type: 'data', cb: (data: T) => void): void;\n public on(type: 'close', cb: () => void): void;\n\n public on(type: 'data' | 'error' | 'close', cb: any): void {\n switch (type) {\n case 'data':\n this.messageListeners.push(cb);\n break;\n case 'error':\n this.errorListeners.push(cb);\n break;\n case 'close':\n this.closeListeners.push(cb);\n break;\n default:\n throw new Error(`Trying to register on an unsupported event: ${type}`);\n }\n }\n\n public off(type: 'error', cb: (error: Error) => void): void;\n public off(type: 'data', cb: (data: T) => void): void;\n public off(type: 'close', cb: () => void): void;\n\n public off(type: 'data' | 'error' | 'close', cb: any): void {\n switch (type) {\n case 'data':\n this.remove(this.messageListeners, cb);\n break;\n case 'error':\n this.remove(this.errorListeners, cb);\n break;\n case 'close':\n this.remove(this.closeListeners, cb);\n break;\n default:\n throw new Error(`Trying to unregister on an unsupported event: ${type}`);\n }\n }\n\n public close() {\n this.completed$.next();\n }\n}\n","import { BlockResponse } from '@taquito/rpc';\nimport { from, Observable, ObservableInput, timer } from 'rxjs';\nimport {\n concatMap,\n distinctUntilKeyChanged,\n first,\n map,\n pluck,\n publish,\n refCount,\n switchMap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { evaluateFilter } from './filters';\nimport { Filter, SubscribeProvider, Subscription, OperationContent } from './interface';\nimport { ObservableSubscription } from './observable-subscription';\n\nconst getLastBlock = (context: Context) => {\n return from(context.rpc.getBlock()).pipe(first());\n};\n\nconst applyFilter = (filter: Filter) =>\n concatMap<BlockResponse, ObservableInput<OperationContent>>(block => {\n return new Observable<OperationContent>(sub => {\n for (const ops of block.operations) {\n for (const op of ops) {\n for (const content of op.contents) {\n if (evaluateFilter({hash: op.hash, ...content}, filter)) {\n sub.next({hash: op.hash, ...content});\n }\n }\n }\n }\n sub.complete();\n });\n });\n\nexport class PollingSubscribeProvider implements SubscribeProvider {\n // Map the changing polling interval to a timer, which will automatically terminate the previous timer when the next one starts.\n private timer$ = this.context._config.pipe(\n switchMap((val) => timer(0, val.streamerPollingIntervalMilliseconds)),\n )\n\n private newBlock$ = this.timer$.pipe(\n map(() => this.context),\n switchMap(getLastBlock),\n distinctUntilKeyChanged('hash'),\n publish(),\n refCount()\n );\n\n constructor(private context: Context) { }\n\n subscribe(_filter: 'head'): Subscription<string> {\n return new ObservableSubscription(this.newBlock$.pipe(pluck('hash')), \n this.context.config.shouldObservableSubscriptionRetry,\n this.context.config.observableSubscriptionRetryFunction);\n }\n\n subscribeOperation(filter: Filter): Subscription<OperationContent> {\n return new ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)),\n this.context.config.shouldObservableSubscriptionRetry,\n this.context.config.observableSubscriptionRetryFunction);\n }\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"e03d983c780c7f96d8291ddd1251ea82f4581858\",\n \"version\": \"11.2.0-beta-RC.0\"\n};\n","import { Forger, ForgeParams, ForgeResponse } from './interface';\n\nexport class ForgingMismatchError extends Error {\n name = 'ForgingMismatchError';\n constructor(public results: string[]) {\n super('Forging mismatch error');\n }\n}\n\nexport class CompositeForger implements Forger {\n constructor(private forgers: Forger[]) {\n if (forgers.length === 0) {\n throw new Error('At least one forger must be specified');\n }\n }\n\n async forge({ branch, contents }: ForgeParams): Promise<ForgeResponse> {\n const results = await Promise.all(\n this.forgers.map((forger) => {\n return forger.forge({ branch, contents });\n })\n );\n\n if (results.length === 0) {\n throw new Error('At least one forger must be specified');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n let lastResult: string = results.pop()!; // Assumed to be more than one since we\n while (results.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const currentResult = results.pop()!;\n\n if (currentResult !== lastResult) {\n throw new ForgingMismatchError([lastResult, currentResult]);\n }\n lastResult = currentResult;\n }\n\n return lastResult;\n }\n}\n","import { OriginateParams } from \"../operations/types\";\nimport { ParserProvider } from \"./interface\";\n\nexport class NoopParser implements ParserProvider {\n async prepareCodeOrigination(params: OriginateParams): Promise<OriginateParams> {\n return params;\n }\n}","import { Packer } from './interface';\nimport { packDataBytes, MichelsonData, MichelsonType } from '@taquito/michel-codec'\nimport { PackDataResponse, PackDataParams } from '@taquito/rpc';\n\nexport class MichelCodecPacker implements Packer {\n\n async packData(data: PackDataParams): Promise<PackDataResponse> {\n const { bytes } = packDataBytes(data.data as MichelsonData, data.type as MichelsonType);\n return { packed: bytes }\n }\n}\n","import { GlobalConstantHashAndValue } from '@taquito/michel-codec';\nimport { GlobalConstantNotFound } from './error';\nimport { GlobalConstantHash, GlobalConstantsProvider } from './interface-global-constants-provider';\n\nexport class DefaultGlobalConstantsProvider implements GlobalConstantsProvider {\n private _globalConstantsLibrary: GlobalConstantHashAndValue = {};\n\n /**\n *\n * @description Allows to load global constant hashes and their corresponding Michelson JSON values\n */\n loadGlobalConstant(globalConstant: GlobalConstantHashAndValue) {\n for (const hash in globalConstant) {\n Object.assign(this._globalConstantsLibrary, {\n [hash]: globalConstant[hash],\n });\n }\n }\n\n /**\n *\n * @description Retrieve the Michelson value of a global constant based on its hash\n *\n * @param hash a string representing the global constant hash\n * @returns Expr, the JSON Michelson value\n */\n async getGlobalConstantByHash(hash: GlobalConstantHash) {\n const value = this._globalConstantsLibrary[hash];\n if (!value) {\n throw new GlobalConstantNotFound(hash);\n }\n return value;\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/taquito\n */\n\nimport { RpcClient, RpcClientInterface } from '@taquito/rpc';\nimport { RPCBatchProvider } from './batch/rpc-batch-provider';\nimport { Protocols } from './constants';\nimport { ConfigConfirmation, ConfigStreamer, Context, TaquitoProvider } from './context';\nimport { ContractProvider, EstimationProvider } from './contract/interface';\nimport { Extension } from './extension/extension';\nimport { Forger } from './forger/interface';\nimport { RpcForger } from './forger/rpc-forger';\nimport { format } from './format';\nimport { GlobalConstantsProvider } from './global-constants/interface-global-constants-provider';\nimport { NoopGlobalConstantsProvider } from './global-constants/noop-global-constants-provider';\nimport { Packer } from './packer/interface';\nimport { RpcPacker } from './packer/rpc-packer';\nimport { Signer } from './signer/interface';\nimport { NoopSigner } from './signer/noop';\nimport { SubscribeProvider } from './subscribe/interface';\nimport { PollingSubscribeProvider } from './subscribe/polling-provider';\nimport { TzProvider } from './tz/interface';\nimport { VERSION } from './version';\nimport { LegacyWalletProvider, Wallet, WalletProvider } from './wallet';\nimport { OperationFactory } from './wallet/operation-factory';\n\nexport { MichelsonMap, UnitValue } from '@taquito/michelson-encoder';\nexport * from './constants';\nexport * from './context';\nexport { TaquitoProvider } from './context';\nexport * from './contract';\nexport * from './contract/big-map';\nexport { CompositeForger } from './forger/composite-forger';\nexport * from './forger/interface';\nexport { RpcForger } from './forger/rpc-forger';\nexport * from './operations';\nexport { OperationBatch } from './batch/rpc-batch-provider';\nexport * from './signer/interface';\nexport * from './subscribe/interface';\nexport { SubscribeProvider } from './subscribe/interface';\nexport { PollingSubscribeProvider } from './subscribe/polling-provider';\nexport { ObservableSubscription } from './subscribe/observable-subscription';\nexport * from './tz/interface';\nexport * from './wallet';\nexport { Extension } from './extension/extension';\nexport * from './parser/interface';\nexport * from './parser/michel-codec-parser';\nexport * from './parser/noop-parser';\nexport * from './packer/interface';\nexport * from './packer/michel-codec-packer';\nexport * from './packer/rpc-packer';\nexport * from './global-constants/default-global-constants-provider';\nexport * from './global-constants/error';\nexport * from './global-constants/interface-global-constants-provider';\n\nexport interface SetProviderOptions {\n forger?: Forger;\n wallet?: WalletProvider;\n rpc?: string | RpcClientInterface;\n stream?: string | SubscribeProvider;\n signer?: Signer;\n protocol?: Protocols;\n config?: Partial<ConfigConfirmation> & Partial<ConfigStreamer>;\n packer?: Packer;\n globalConstantsProvider?: GlobalConstantsProvider;\n}\n\nexport interface VersionInfo {\n commitHash: string;\n version: string;\n}\n\n/**\n * @description Facade class that surfaces all of the libraries capability and allow it's configuration\n *\n * @param _rpc The RPC server to use\n */\nexport class TezosToolkit {\n private _stream!: SubscribeProvider;\n private _options: SetProviderOptions = {};\n private _rpcClient: RpcClientInterface;\n private _wallet: Wallet;\n private _context: Context;\n /**\n * @deprecated TezosToolkit.batch has been deprecated in favor of TezosToolkit.contract.batch\n *\n */\n public batch: RPCBatchProvider['batch'];\n\n public readonly format = format;\n\n constructor(private _rpc: RpcClientInterface | string) {\n if (typeof this._rpc === 'string') {\n this._rpcClient = new RpcClient(this._rpc);\n } else {\n this._rpcClient = this._rpc;\n }\n this._context = new Context(_rpc);\n this._wallet = new Wallet(this._context);\n this.setProvider({ rpc: this._rpcClient });\n this.batch = this._context.batch.batch.bind(this._context.batch);\n }\n\n /**\n * @description Sets configuration on the Tezos Taquito instance. Allows user to choose which signer, rpc client, rpc url, forger and so forth\n *\n * @param options rpc url or rpcClient to use to interact with the Tezos network\n *\n * @example Tezos.setProvider({rpc: 'https://mainnet.api.tez.ie/', signer: new InMemorySigner.fromSecretKey(“edsk...”)})\n * @example Tezos.setProvider({ config: { confirmationPollingTimeoutSecond: 300 }})\n *\n */\n\n setProvider({\n rpc,\n stream,\n signer,\n protocol,\n config,\n forger,\n wallet,\n packer,\n globalConstantsProvider,\n }: SetProviderOptions) {\n this.setRpcProvider(rpc);\n this.setStreamProvider(stream);\n this.setSignerProvider(signer);\n this.setForgerProvider(forger);\n this.setWalletProvider(wallet);\n this.setPackerProvider(packer);\n this.setGlobalConstantsProvider(globalConstantsProvider);\n\n this._context.proto = protocol;\n if (config) {\n this._context.setPartialConfig(config);\n }\n }\n\n /**\n * @description Sets signer provider on the Tezos Taquito instance.\n *\n * @param options signer to use to interact with the Tezos network\n *\n * @example Tezos.setSignerProvider(new InMemorySigner.fromSecretKey('edsk...'))\n *\n */\n setSignerProvider(signer?: SetProviderOptions['signer']) {\n if (!this._options.signer && typeof signer === 'undefined') {\n this._context.signer = new NoopSigner();\n this._options.signer = signer;\n } else if (typeof signer !== 'undefined') {\n this._context.signer = signer;\n this._options.signer = signer;\n }\n }\n\n /**\n * @description Sets rpc provider on the Tezos Taquito instance\n *\n * @param options rpc url or rpcClient to use to interact with the Tezos network\n *\n * @example Tezos.setRpcProvider('https://mainnet.api.tez.ie/')\n *\n */\n setRpcProvider(rpc?: SetProviderOptions['rpc']) {\n if (typeof rpc === 'string') {\n this._rpcClient = new RpcClient(rpc);\n } else if (rpc === undefined) {\n // do nothing, RPC is required in the constructor, do not override it\n } else {\n this._rpcClient = rpc;\n }\n this._options.rpc = this._rpcClient;\n this._context.rpc = this._rpcClient;\n }\n\n /**\n * @description Sets forger provider on the Tezos Taquito instance\n *\n * @param options forger to use to interact with the Tezos network\n *\n * @example Tezos.setForgerProvider(localForger)\n *\n */\n setForgerProvider(forger?: SetProviderOptions['forger']) {\n const f = typeof forger === 'undefined' ? this.getFactory(RpcForger)() : forger;\n this._options.forger = f;\n this._context.forger = f;\n }\n\n /**\n * @description Sets stream provider on the Tezos Taquito instance\n *\n * @param options stream to use to interact with the Tezos network\n *\n * @example Tezos.setStreamProvider(...)\n *\n */\n setStreamProvider(stream?: SetProviderOptions['stream']) {\n if (typeof stream === 'string') {\n this._stream = new PollingSubscribeProvider(new Context(new RpcClient(stream)));\n } else if (typeof stream !== 'undefined') {\n this._stream = stream;\n } else if (this._options.stream === undefined) {\n this._stream = this.getFactory(PollingSubscribeProvider)();\n }\n this._options.stream = stream;\n }\n\n /**\n * @description Sets wallet provider on the Tezos Taquito instance\n *\n * @param options wallet to use to interact with the Tezos network\n *\n * @example Tezos.setWalletProvider(...)\n *\n */\n setWalletProvider(wallet?: SetProviderOptions['wallet']) {\n if (!this._options.wallet && typeof wallet === 'undefined') {\n const w = this.getFactory(LegacyWalletProvider)();\n this._options.wallet = w;\n this._context.walletProvider = w;\n } else if (typeof wallet !== 'undefined') {\n this._options.wallet = wallet;\n this._context.walletProvider = wallet;\n }\n }\n\n /**\n * @description Sets Packer provider on the Tezos Taquito instance\n *\n * @param options packer to use to interact with the Tezos network\n *\n * @example Tezos.setPackerProvider(new MichelCodecPacker())\n *\n */\n setPackerProvider(packer?: SetProviderOptions['packer']) {\n const p = typeof packer === 'undefined' ? this.getFactory(RpcPacker)() : packer;\n this._options.packer = p;\n this._context.packer = p;\n }\n\n /**\n * @description Sets global constants provider on the Tezos Taquito instance\n *\n * @param options globalConstantsProvider to use to interact with the Tezos network\n *\n * @example\n * ```\n * const globalConst = new DefaultGlobalConstantsProvider();\n * globalConst.loadGlobalConstant({\n * \"expruu5BTdW7ajqJ9XPTF3kgcV78pRiaBW3Gq31mgp3WSYjjUBYxre\": { prim: \"int\" },\n * // ...\n * })\n * Tezos.setGlobalConstantsProvider(globalConst);\n * ```\n *\n */\n setGlobalConstantsProvider(\n globalConstantsProvider?: SetProviderOptions['globalConstantsProvider']\n ) {\n const g =\n typeof globalConstantsProvider === 'undefined'\n ? new NoopGlobalConstantsProvider()\n : globalConstantsProvider;\n this._options.globalConstantsProvider = g;\n this._context.globalConstantsProvider = g;\n }\n\n /**\n * @description Provide access to tezos account management\n */\n get tz(): TzProvider {\n return this._context.tz;\n }\n\n /**\n * @description Provide access to smart contract utilities\n */\n get contract(): ContractProvider {\n return this._context.contract;\n }\n\n get wallet(): Wallet {\n return this._wallet;\n }\n\n get operation(): OperationFactory {\n return this._context.operationFactory;\n }\n\n /**\n * @description Provide access to operation estimation utilities\n */\n get estimate(): EstimationProvider {\n return this._context.estimate;\n }\n\n /**\n * @description Provide access to streaming utilities backed by an streamer implementation\n */\n get stream(): SubscribeProvider {\n return this._stream;\n }\n\n /**\n * @description Provide access to the currently used rpc client\n */\n get rpc(): RpcClientInterface {\n return this._context.rpc;\n }\n\n /**\n * @description Provide access to the currently used signer\n */\n get signer() {\n return this._context.signer;\n }\n\n /**\n * @description Provide access to the currently used globalConstantsProvider\n */\n get globalConstants() {\n return this._context.globalConstantsProvider;\n }\n\n /**\n * @description Allow to add a module to the TezosToolkit instance. This method adds the appropriate Providers(s) required by the module to the internal context.\n *\n * @param module extension to add to the TezosToolkit instance\n *\n * @example Tezos.addExtension(new Tzip16Module());\n */\n addExtension(module: Extension | Extension[]) {\n if (Array.isArray(module)) {\n module.forEach((extension) => extension.configureContext(this._context));\n } else {\n module.configureContext(this._context);\n }\n }\n\n getFactory<T, K extends Array<any>>(ctor: TaquitoProvider<T, K>) {\n return (...args: K) => {\n return new ctor(this._context, ...args);\n };\n }\n\n /**\n * @description Gets an object containing the version of Taquito library and git sha of the commit this library is compiled from\n */\n getVersionInfo(): VersionInfo {\n return VERSION;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGa,SAAS;IACpB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;KAAI;IAExC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAe;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;KAC/D;;;MCLU,WAAW;IACtB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;KAAI;IACxC,MAAM,CAAC,oBAA4B;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;KAC/D;;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;;IAKD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;KAC7B;;;;IAKD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KAC9C;;;;;;;;IASD,YAAY,CAAC,MAA+B;QAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC1E;aAAM;YACL,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxC;KACF;IAED,UAAU,CAA0B,IAA2B;QAC7D,OAAO,CAAC,GAAG,IAAO;YAChB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;SACzC,CAAC;KACH;;;;IAKD,cAAc;QACZ,OAAO,OAAO,CAAC;KAChB;;;;;"}
1
+ {"version":3,"file":"taquito.es6.js","sources":["../src/forger/rpc-forger.ts","../src/injector/rpc-injector.ts","../src/signer/noop.ts","../src/constants.ts","../src/format.ts","../src/contract/errors.ts","../src/contract/prepare.ts","../src/operations/types.ts","../src/operations/operation-errors.ts","../src/operations/operations.ts","../src/operations/batch-operation.ts","../src/operations/operation-emitter.ts","../src/batch/rpc-batch-provider.ts","../src/wallet/receipt.ts","../src/wallet/operation.ts","../src/wallet/batch-operation.ts","../src/wallet/delegation-operation.ts","../src/wallet/origination-operation.ts","../src/wallet/transaction-operation.ts","../src/wallet/operation-factory.ts","../src/tz/rpc-tz-provider.ts","../src/contract/estimate.ts","../src/contract/rpc-estimate-provider.ts","../src/operations/delegate-operation.ts","../src/operations/origination-operation.ts","../src/operations/register-global-constant-operation.ts","../src/operations/reveal-operation.ts","../src/operations/transaction-operation.ts","../src/contract/manager-lambda.ts","../src/contract/view_lambda.ts","../src/contract/compose.ts","../src/contract/contract-methods/contract-method-flat-param.ts","../src/wallet/wallet.ts","../src/wallet/legacy.ts","../src/contract/contract-methods/contract-method-object-param.ts","../src/contract/contract-methods/contract-on-chain-view.ts","../src/contract/contract-methods/contract-method-factory.ts","../src/contract/lambda-view.ts","../src/contract/contract.ts","../src/contract/big-map.ts","../src/contract/sapling-state-abstraction.ts","../src/contract/semantic.ts","../src/contract/rpc-contract-provider.ts","../src/parser/michel-codec-parser.ts","../src/packer/rpc-packer.ts","../src/global-constants/error.ts","../src/global-constants/noop-global-constants-provider.ts","../src/context.ts","../src/subscribe/filters.ts","../src/subscribe/observable-subscription.ts","../src/subscribe/polling-provider.ts","../src/version.ts","../src/forger/composite-forger.ts","../src/parser/noop-parser.ts","../src/packer/michel-codec-packer.ts","../src/global-constants/default-global-constants-provider.ts","../src/taquito.ts"],"sourcesContent":["import { Forger, ForgeParams, ForgeResponse } from './interface';\nimport { Context } from '../context';\n\nexport class RpcForger implements Forger {\n constructor(private context: Context) {}\n\n forge({ branch, contents }: ForgeParams): Promise<ForgeResponse> {\n return this.context.rpc.forgeOperations({ branch, contents });\n }\n}\n","import { Injector } from './interface';\nimport { Context } from '../context';\n\nexport class RpcInjector implements Injector {\n constructor(private context: Context) {}\n inject(signedOperationBytes: string): Promise<string> {\n return this.context.rpc.injectOperation(signedOperationBytes);\n }\n}\n","import { Signer } from './interface';\n\nexport class UnconfiguredSignerError extends Error {\n name = 'UnconfiguredSignerError';\n\n constructor() {\n super(\n 'No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance.'\n );\n }\n}\n\n/**\n * @description Default signer implementation which does nothing and produce invalid signature\n */\nexport class NoopSigner implements Signer {\n async publicKey(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async publicKeyHash(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async secretKey(): Promise<string> {\n throw new UnconfiguredSignerError();\n }\n async sign(_bytes: string, _watermark?: Uint8Array): Promise<any> {\n throw new UnconfiguredSignerError();\n }\n}\n","export enum DEFAULT_GAS_LIMIT {\n DELEGATION = 10600,\n ORIGINATION = 10600,\n TRANSFER = 10600,\n REVEAL = 1100,\n}\nexport enum DEFAULT_FEE {\n DELEGATION = 1257,\n ORIGINATION = 10000,\n TRANSFER = 10000,\n REVEAL = 374,\n}\nexport enum DEFAULT_STORAGE_LIMIT {\n DELEGATION = 0,\n ORIGINATION = 257,\n TRANSFER = 257,\n REVEAL = 0,\n}\n\nexport enum Protocols {\n Pt24m4xi = 'Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd',\n PsBABY5H = 'PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU',\n PsBabyM1 = 'PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS',\n PsCARTHA = 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb',\n PsDELPH1 = 'PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo',\n PtEdo2Zk = 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA',\n PsFLorena = 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i',\n PtGRANADs = 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV',\n PtHangz2 = 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx',\n PsiThaCa = 'PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP',\n Psithaca2 = 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A',\n ProtoALpha = 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK', // temporary protocol hash\n}\n\nexport const protocols = {\n '004': [Protocols.Pt24m4xi],\n '005': [Protocols.PsBABY5H, Protocols.PsBabyM1],\n '006': [Protocols.PsCARTHA],\n '007': [Protocols.PsDELPH1],\n '008': [Protocols.PtEdo2Zk], // edonet v2\n '009': [Protocols.PsFLorena],\n '010': [Protocols.PtGRANADs],\n '011': [Protocols.PtHangz2], // hangzhou v2,\n '012': [Protocols.PsiThaCa], //Ithaca\n '013': [Protocols.Psithaca2], //Ithaca2\n '014': [Protocols.ProtoALpha],\n};\n\nexport enum DefaultLambdaAddresses {\n MAINNET = 'KT1CPuTzwC7h7uLXd5WQmpMFso1HxrLBUtpE',\n CARTHAGENET = 'KT1VAy1o1FGiXYfD3YT7x7k5eF5HSHhmc1u6',\n DELPHINET = 'KT19abMFs3haqyKYwqdLjK9GbtofryZLvpiK',\n EDONET = 'KT1A64nVZDccAHGAsf1ZyVajXZcbiwjV3SnN',\n FLORENCENET = 'KT1KCe3YqGnudsiCWb5twbe2DH5T3EMdLpSE',\n GRANADANET = 'KT1BCun2vsA4GBQvsKAuGD5x873MfW2jsN9z',\n HANGZHOUNET = 'KT1PWtBAr1hjK9M9s9oZNZFbfzPdkkD6PSJR',\n ITHACANET = 'KT1CsEGfRHWeuUQFh9LfVFLVMbm7DFBuHPPU',\n ITHACANET2 = 'KT1H2a5vGkMLFGBPMs6oRRJshCvYeXSBSadn',\n}\n\nexport enum ChainIds {\n MAINNET = 'NetXdQprcVkpaWU',\n CARTHAGENET = 'NetXjD3HPJJjmcd',\n DELPHINET = 'NetXm8tYqnMWky1',\n EDONET = 'NetXSgo1ZT2DRUG',\n FLORENCENET = 'NetXxkAx4woPLyu',\n GRANADANET = 'NetXz969SFaFn8k',\n HANGZHOUNET = 'NetXZSsxBpMQeAT',\n ITHACANET = 'NetXbhmtAbMukLc',\n ITHACANET2 = 'NetXnHfVqm9iesp',\n}\n","import BigNumber from 'bignumber.js';\n\nconst TZ_DECIMALS = 6;\nconst MTZ_DECIMALS = 3;\n\ntype Format = 'tz' | 'mtz' | 'mutez';\n\nfunction getDecimal(format: Format) {\n switch (format) {\n case 'tz':\n return TZ_DECIMALS;\n case 'mtz':\n return MTZ_DECIMALS;\n case 'mutez':\n default:\n return 0;\n }\n}\n\nexport function format(\n from: Format = 'mutez',\n to: Format = 'mutez',\n amount: number | string | BigNumber\n) {\n const bigNum = new BigNumber(amount);\n if (bigNum.isNaN()) {\n return amount;\n }\n\n return bigNum\n .multipliedBy(Math.pow(10, getDecimal(from)))\n .dividedBy(Math.pow(10, getDecimal(to)));\n}\n","import { HttpResponseError } from '@taquito/http-utils';\nimport { MichelsonV1Expression } from '@taquito/rpc';\n\nexport class InvalidParameterError extends Error {\n name = 'Invalid parameters error';\n constructor(public smartContractMethodName: string, public sigs: any[], public args: any[]) {\n super(\n `${smartContractMethodName} Received ${\n args.length\n } arguments while expecting one of the following signatures (${JSON.stringify(sigs)})`\n );\n }\n}\n\nexport class UndefinedLambdaContractError extends Error {\n name = 'Undefined LambdaContract error';\n constructor() {\n super(\n 'This might happen if you are using a sandbox. Please provide the address of a lambda contract as a parameter of the read method.'\n );\n }\n}\nexport class InvalidDelegationSource extends Error {\n name = 'Invalid delegation source error';\n\n constructor(public source: string) {\n super(\n `Since Babylon delegation source can no longer be a contract address ${source}. Please use the smart contract abstraction to set your delegate.`\n );\n }\n}\n\nexport class InvalidCodeParameter extends Error {\n public name = 'InvalidCodeParameter';\n constructor(public message: string, public readonly data: any) {\n super(message);\n }\n}\n\nexport class InvalidInitParameter extends Error {\n public name = 'InvalidInitParameter';\n constructor(public message: string, public readonly data: any) {\n super(message);\n }\n}\n\nexport class InvalidViewParameterError extends Error {\n name = 'Invalid view parameters error';\n cause: any;\n constructor(\n public smartContractViewName: string,\n public sigs: any,\n public args: any,\n public originalError: any\n ) {\n super(\n `Unable to encode the parameter of the view: ${smartContractViewName}. Received ${args} as parameter while expecting one of the following signatures (${JSON.stringify(\n sigs\n )})`\n );\n this.cause = originalError;\n }\n}\n\nexport class ViewSimulationError extends Error {\n name = 'ViewSimulationError';\n constructor(\n public message: string,\n public viewName: string,\n public failWith?: MichelsonV1Expression,\n public originalError?: any\n ) {\n super(message);\n }\n}\n\nexport const validateAndExtractFailwith = (\n error: HttpResponseError\n): MichelsonV1Expression | undefined => {\n if (isJsonString(error.body)) {\n const parsedError = JSON.parse(error.body);\n if (Array.isArray(parsedError) && 'with' in parsedError[parsedError.length - 1]) {\n return parsedError[parsedError.length - 1].with;\n }\n }\n};\n\nconst isJsonString = (str: string) => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n};\n\nexport class InvalidViewSimulationContext extends Error {\n public name = 'InvalidViewSimulationContext';\n constructor(public info: string) {\n super(`${info} Please configure the context of the view execution in the executeView method.`);\n }\n}\n","import { Schema } from '@taquito/michelson-encoder';\nimport { OpKind, MichelsonV1Expression } from '@taquito/rpc';\nimport { Prim, Expr } from '@taquito/michel-codec';\nimport {\n OriginateParams,\n RPCOriginationOperation,\n TransferParams,\n RPCTransferOperation,\n DelegateParams,\n RPCDelegateOperation,\n RegisterDelegateParams,\n RPCRevealOperation,\n RevealParams,\n RegisterGlobalConstantParams,\n RPCRegisterGlobalConstantOperation,\n} from '../operations/types';\nimport { DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_STORAGE_LIMIT } from '../constants';\nimport { format } from '../format';\nimport { InvalidCodeParameter, InvalidInitParameter } from './errors';\n\nexport const createOriginationOperation = async ({\n code,\n init,\n balance = '0',\n delegate,\n storage,\n fee = DEFAULT_FEE.ORIGINATION,\n gasLimit = DEFAULT_GAS_LIMIT.ORIGINATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.ORIGINATION,\n mutez = false,\n}: OriginateParams) => {\n if (storage !== undefined && init !== undefined) {\n throw new Error(\n 'Storage and Init cannot be set a the same time. Please either use storage or init but not both.'\n );\n }\n\n if (!Array.isArray(code)) {\n throw new InvalidCodeParameter('Wrong code parameter type, expected an array', code);\n }\n\n let contractStorage: Expr | undefined;\n if (storage !== undefined) {\n const storageType = (code as Expr[]).find(\n (p): p is Prim => 'prim' in p && p.prim === 'storage'\n );\n if (storageType?.args === undefined) {\n throw new InvalidCodeParameter('The storage section is missing from the script', code);\n }\n const schema = new Schema(storageType.args[0] as MichelsonV1Expression); // TODO\n contractStorage = schema.Encode(storage);\n } else if (init !== undefined && typeof init === 'object') {\n contractStorage = init as Expr;\n } else {\n throw new InvalidInitParameter('Wrong init parameter type, expected JSON Michelson', init);\n }\n\n const script = {\n code,\n storage: contractStorage,\n };\n\n const operation: RPCOriginationOperation = {\n kind: OpKind.ORIGINATION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n balance: mutez ? balance.toString() : format('tz', 'mutez', balance).toString(),\n script,\n };\n\n if (delegate) {\n operation.delegate = delegate;\n }\n return operation;\n};\n\nexport const createTransferOperation = async ({\n to,\n amount,\n parameter,\n fee = DEFAULT_FEE.TRANSFER,\n gasLimit = DEFAULT_GAS_LIMIT.TRANSFER,\n storageLimit = DEFAULT_STORAGE_LIMIT.TRANSFER,\n mutez = false,\n}: TransferParams) => {\n const operation: RPCTransferOperation = {\n kind: OpKind.TRANSACTION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n amount: mutez ? amount.toString() : format('tz', 'mutez', amount).toString(),\n destination: to,\n parameters: parameter,\n };\n return operation;\n};\n\nexport const createSetDelegateOperation = async ({\n delegate,\n source,\n fee = DEFAULT_FEE.DELEGATION,\n gasLimit = DEFAULT_GAS_LIMIT.DELEGATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.DELEGATION,\n}: DelegateParams) => {\n const operation: RPCDelegateOperation = {\n kind: OpKind.DELEGATION,\n source,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n delegate,\n };\n return operation;\n};\n\nexport const createRegisterDelegateOperation = async (\n {\n fee = DEFAULT_FEE.DELEGATION,\n gasLimit = DEFAULT_GAS_LIMIT.DELEGATION,\n storageLimit = DEFAULT_STORAGE_LIMIT.DELEGATION,\n }: RegisterDelegateParams,\n source: string\n) => {\n return {\n kind: OpKind.DELEGATION,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n delegate: source,\n } as RPCDelegateOperation;\n};\n\nexport const createRevealOperation = async (\n {\n fee = DEFAULT_FEE.REVEAL,\n gasLimit = DEFAULT_GAS_LIMIT.REVEAL,\n storageLimit = DEFAULT_STORAGE_LIMIT.REVEAL,\n }: RevealParams,\n source: string,\n publicKey: string\n) => {\n return {\n kind: OpKind.REVEAL,\n fee,\n public_key: publicKey,\n source,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n } as RPCRevealOperation;\n};\n\nexport const createRegisterGlobalConstantOperation = async ({\n value,\n source,\n fee,\n gasLimit,\n storageLimit,\n}: RegisterGlobalConstantParams) => {\n return {\n kind: OpKind.REGISTER_GLOBAL_CONSTANT,\n value,\n fee,\n gas_limit: gasLimit,\n storage_limit: storageLimit,\n source,\n } as RPCRegisterGlobalConstantOperation;\n};\n","import {\n OperationObject,\n InternalOperationResultKindEnum,\n OpKind,\n TransactionOperationParameter,\n MichelsonV1Expression,\n} from '@taquito/rpc';\n\nexport { OpKind } from '@taquito/rpc';\n\nexport type withKind<T, K extends OpKind> = T & { kind: K };\n\nexport type ParamsWithKind =\n | withKind<OriginateParams, OpKind.ORIGINATION>\n | withKind<DelegateParams, OpKind.DELEGATION>\n | withKind<TransferParams, OpKind.TRANSACTION>\n | withKind<ActivationParams, OpKind.ACTIVATION>\n | withKind<RegisterGlobalConstantParams, OpKind.REGISTER_GLOBAL_CONSTANT>;\n\nexport type ParamsWithKindExtended =\n | ParamsWithKind\n | withKind<RevealParams, OpKind.REVEAL>\n\nexport const attachKind = <T, K extends OpKind>(op: T, kind: K) => {\n return { ...op, kind } as withKind<T, K>;\n};\n\nexport const findWithKind = <T extends { kind: OpKind }, K extends OpKind>(\n arr: T[],\n kind: K\n): (T & { kind: K }) | undefined => {\n if (Array.isArray(arr)) {\n const found = arr.find(op => op.kind === kind);\n\n if (found && isKind(found, kind)) {\n return found;\n }\n }\n};\n\nexport const isKind = <T extends { kind: OpKind }, K extends OpKind>(\n op: T,\n kind: K\n): op is withKind<T, K> => {\n return op.kind === kind;\n};\n\nexport type RPCOpWithFee =\n | RPCTransferOperation\n | RPCOriginationOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCRegisterGlobalConstantOperation;\nexport type RPCOpWithSource =\n | RPCTransferOperation\n | RPCOriginationOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCRegisterGlobalConstantOperation;\n\nexport const isOpWithFee = <T extends { kind: OpKind }>(\n op: T\n): op is withKind<T, InternalOperationResultKindEnum> => {\n return ['transaction', 'delegation', 'origination', 'reveal', 'register_global_constant'].indexOf(op.kind) !== -1;\n};\n\nexport const isOpRequireReveal = <T extends { kind: OpKind }>(\n op: T\n): op is withKind<T, Exclude<InternalOperationResultKindEnum, OpKind.REVEAL>> => {\n return ['transaction', 'delegation', 'origination', 'register_global_constant'].indexOf(op.kind) !== -1;\n};\n\nexport type SourceKinds = InternalOperationResultKindEnum;\n\nexport const isSourceOp = <T extends { kind: OpKind }>(op: T): op is withKind<T, SourceKinds> => {\n return ['transaction', 'delegation', 'origination', 'reveal', 'ballot'].indexOf(op.kind) !== -1;\n};\n\nexport const hasMetadata = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: K;\n} => {\n return 'metadata' in op;\n};\n\nexport const hasMetadataWithResult = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: {\n operation_result: K;\n };\n} => {\n return hasMetadata<T, any>(op) && 'operation_result' in op.metadata;\n};\n\nexport const hasMetadataWithInternalOperationResult = <T extends { kind: OpKind }, K>(\n op: T\n): op is T & {\n metadata: {\n internal_operation_results?: K;\n };\n} => {\n return hasMetadata<T, any>(op) && 'internal_operation_results' in op.metadata;\n};\n\nexport interface GasConsumingOperation {\n consumedGas?: string;\n gasLimit: number;\n}\n\nexport interface StorageConsumingOperation {\n storageDiff?: string;\n storageSize?: string;\n storageLimit: number;\n}\n\nexport interface FeeConsumingOperation {\n fee: number;\n}\n\nexport type OriginateParamsBase = {\n balance?: string;\n code: string | object[];\n delegate?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n mutez?: boolean;\n};\n\n/**\n * @description Parameters for originate method\n */\nexport type OriginateParams<TStorage = any> = OriginateParamsBase &\n (\n | {\n init?: never;\n /** JS representation of a storage object */\n storage: TStorage;\n }\n | {\n /** Initial storage object value. Either Micheline or JSON encoded */\n init: string | object;\n storage?: never;\n }\n );\n\nexport interface ActivationParams {\n pkh: string;\n secret: string;\n}\n\n/**\n * @description RPC origination operation\n */\nexport interface RPCOriginationOperation {\n kind: OpKind.ORIGINATION;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n balance: string;\n delegate?: string;\n source?: string;\n script: {\n code: any;\n storage: any;\n };\n}\n\n/**\n * @description RPC reveal operation\n */\nexport interface RPCRevealOperation {\n kind: OpKind.REVEAL;\n fee: number;\n public_key: string;\n source?: string;\n gas_limit: number;\n storage_limit: number;\n}\n\nexport interface RevealParams {\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n\n/**\n * @description Result of a forge operation contains the operation plus its encoded version\n */\nexport interface ForgedBytes {\n opbytes: string;\n opOb: OperationObject;\n counter: number;\n}\n\n/**\n * @description Parameters for setDelegate method\n */\nexport interface DelegateParams {\n source: string;\n delegate?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description Parameters for registerDelegate method\n */\nexport interface RegisterDelegateParams {\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description RPC delegation operation\n */\nexport interface RPCDelegateOperation {\n kind: OpKind.DELEGATION;\n source?: string;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n delegate?: string;\n}\n\n/**\n * @description Parameters for transfer method\n */\nexport interface TransferParams {\n to: string;\n source?: string;\n amount: number;\n fee?: number;\n parameter?: TransactionOperationParameter;\n gasLimit?: number;\n storageLimit?: number;\n mutez?: boolean;\n}\n\n/**\n * @description RPC register global constant operation\n */\n export interface RPCRegisterGlobalConstantOperation {\n kind: OpKind.REGISTER_GLOBAL_CONSTANT;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n source: string;\n value: MichelsonV1Expression;\n}\n\n/**\n * @description Parameters for the `registerGlobalConstant` method\n */\nexport interface RegisterGlobalConstantParams {\n value: MichelsonV1Expression;\n source?: string;\n fee?: number;\n gasLimit?: number;\n storageLimit?: number;\n}\n\n/**\n * @description RPC transfer operation\n */\nexport interface RPCTransferOperation {\n kind: OpKind.TRANSACTION;\n fee: number;\n gas_limit: number;\n storage_limit: number;\n amount: string;\n source?: string;\n destination: string;\n parameters?: TransactionOperationParameter;\n}\n\n/**\n * @description RPC activate account operation\n */\nexport interface RPCActivateOperation {\n kind: OpKind.ACTIVATION;\n pkh: string;\n secret: string;\n}\n\nexport type RPCOperation =\n | RPCOriginationOperation\n | RPCTransferOperation\n | RPCDelegateOperation\n | RPCRevealOperation\n | RPCActivateOperation\n | RPCRegisterGlobalConstantOperation;\n\nexport type PrepareOperationParams = {\n operation: RPCOperation | RPCOperation[];\n source?: string;\n};\n","import {\n MichelsonV1ExpressionBase,\n OperationResultDelegation,\n OperationResultOrigination,\n OperationResultRegisterGlobalConstant,\n OperationResultReveal,\n OperationResultTransaction,\n PreapplyResponse,\n TezosGenericOperationError,\n} from '@taquito/rpc';\nimport {\n hasMetadata,\n hasMetadataWithInternalOperationResult,\n hasMetadataWithResult,\n} from './types';\n\nexport interface TezosOperationErrorWithMessage extends TezosGenericOperationError {\n with: MichelsonV1ExpressionBase;\n}\n\nconst isErrorWithMessage = (error: any): error is TezosOperationErrorWithMessage => {\n return 'with' in error;\n};\n\nexport class TezosOperationError extends Error {\n name = 'TezosOperationError';\n id: string;\n kind: string;\n\n constructor(public errors: TezosGenericOperationError[]) {\n super();\n // Last error is 'often' the one with more detail\n const lastError = errors[errors.length - 1];\n\n this.id = lastError.id;\n this.kind = lastError.kind;\n\n this.message = `(${this.kind}) ${this.id}`;\n\n if (isErrorWithMessage(lastError) && lastError.with.string) {\n this.message = lastError.with.string;\n }\n }\n}\n\nexport class TezosPreapplyFailureError extends Error {\n name = 'TezosPreapplyFailureError';\n\n constructor(public result: any) {\n super('Preapply returned an unexpected result');\n }\n}\n\nexport type MergedOperationResult = OperationResultDelegation &\n OperationResultOrigination &\n OperationResultTransaction &\n OperationResultRegisterGlobalConstant &\n OperationResultReveal & {\n fee?: string;\n };\n\n// Flatten all operation content results and internal operation results into a single array\n// Some cases where we can have multiple operation results or internal operation results are:\n// - When an operation includes a reveal operation\n// - When an operation is made using the batch API\n// - Smart contract call can contains internal operation results when they call other smart contract internally or originate contracts\nexport const flattenOperationResult = (response: PreapplyResponse | PreapplyResponse[]) => {\n const results = Array.isArray(response) ? response : [response];\n\n const returnedResults: MergedOperationResult[] = [];\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n const content = results[i].contents[j];\n if (hasMetadataWithResult(content)) {\n returnedResults.push({\n fee: content.fee,\n ...content.metadata.operation_result,\n });\n\n if (Array.isArray(content.metadata.internal_operation_results)) {\n content.metadata.internal_operation_results.forEach((x) =>\n returnedResults.push(x.result)\n );\n }\n }\n }\n }\n\n return returnedResults;\n};\n\n/***\n * @description Flatten all error from preapply response (including internal error)\n */\nexport const flattenErrors = (\n response: PreapplyResponse | PreapplyResponse[],\n status = 'failed'\n) => {\n const results = Array.isArray(response) ? response : [response];\n\n let errors: TezosGenericOperationError[] = [];\n // Transaction that do not fail will be backtracked in case one failure occur\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n const content = results[i].contents[j];\n if (hasMetadata(content)) {\n if (hasMetadataWithResult(content) && content.metadata.operation_result.status === status) {\n errors = errors.concat(content.metadata.operation_result.errors || []);\n }\n if (\n hasMetadataWithInternalOperationResult(content) &&\n Array.isArray(content.metadata.internal_operation_results)\n ) {\n for (const internalResult of content.metadata.internal_operation_results) {\n if ('result' in internalResult && internalResult.result.status === status) {\n errors = errors.concat(internalResult.result.errors || []);\n }\n }\n }\n }\n }\n }\n\n return errors;\n};\n","import {\n BlockResponse,\n OperationContentsAndResult,\n OperationContentsAndResultReveal,\n} from '@taquito/rpc';\nimport { defer, EMPTY, from, of, ReplaySubject, timer } from 'rxjs';\nimport {\n catchError,\n filter,\n first,\n map,\n mapTo,\n shareReplay,\n switchMap,\n switchMapTo,\n tap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { ForgedBytes, hasMetadataWithResult } from './types';\nimport { validateOperation, ValidationResult, InvalidOperationHashError } from '@taquito/utils';\n\ninterface PollingConfig {\n timeout: number;\n interval: number;\n}\n\n/**\n * @description Utility class to interact with Tezos operations\n */\nexport class Operation {\n private _pollingConfig$ = new ReplaySubject<PollingConfig>(1);\n\n private _currentHeadPromise: Promise<BlockResponse> | undefined = undefined;\n\n // Caching the current head for one second\n private currentHead$ = defer(() => {\n if (!this._currentHeadPromise) {\n this._currentHeadPromise = this.context.rpc.getBlock();\n timer(1000)\n .pipe(first())\n .subscribe(() => {\n this._currentHeadPromise = undefined;\n });\n }\n return from(this._currentHeadPromise);\n });\n\n // Polling observable that emit until timeout is reached\n private polling$ = defer(() =>\n this._pollingConfig$.pipe(\n tap(({ timeout, interval }) => {\n if (timeout <= 0) {\n throw new Error('Timeout must be more than 0');\n }\n\n if (interval <= 0) {\n throw new Error('Interval must be more than 0');\n }\n }),\n map((config) => ({\n ...config,\n timeoutAt: Math.ceil(config.timeout / config.interval) + 1,\n count: 0,\n })),\n switchMap((config) => timer(0, config.interval * 1000).pipe(mapTo(config))),\n tap((config) => {\n config.count++;\n if (config.count > config.timeoutAt) {\n throw new Error(`Confirmation polling timed out`);\n }\n })\n )\n );\n\n // Observable that emit once operation is seen in a block\n private confirmed$ = this.polling$.pipe(\n switchMapTo(this.currentHead$),\n map((head) => {\n for (let i = 3; i >= 0; i--) {\n head.operations[i].forEach((op) => {\n if (op.hash === this.hash) {\n this._foundAt = head.header.level;\n }\n });\n }\n\n if (head.header.level - this._foundAt >= 0) {\n return this._foundAt;\n }\n }),\n filter((x) => x !== undefined),\n first(),\n shareReplay()\n );\n\n protected _foundAt = Number.POSITIVE_INFINITY;\n get includedInBlock() {\n return this._foundAt;\n }\n /**\n *\n * @param hash Operation hash\n * @param raw Raw operation that was injected\n * @param context Taquito context allowing access to rpc and signer\n */\n constructor(\n public readonly hash: string,\n public readonly raw: ForgedBytes,\n public readonly results: OperationContentsAndResult[],\n protected readonly context: Context\n ) {\n if (validateOperation(this.hash) !== ValidationResult.VALID) {\n throw new InvalidOperationHashError(`Invalid Operation Hash: ${this.hash}`);\n }\n\n this.confirmed$.pipe(first(),\n catchError(() => {\n return of(EMPTY)\n })\n ).subscribe();\n }\n\n get revealOperation() {\n return (\n Array.isArray(this.results) &&\n (this.results.find((op) => op.kind === 'reveal') as\n | OperationContentsAndResultReveal\n | undefined)\n );\n }\n\n public get revealStatus() {\n if (this.revealOperation) {\n return this.revealOperation.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n public get status() {\n return (\n this.results.map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n\n /**\n *\n * @param confirmations [0] Number of confirmation to wait for\n * @param interval [10] Polling interval\n * @param timeout [180] Timeout\n */\n async confirmation(confirmations?: number, interval?: number, timeout?: number) {\n if (typeof confirmations !== 'undefined' && confirmations < 1) {\n throw new Error('Confirmation count must be at least 1');\n }\n\n const confirmationPollingIntervalSecond =\n this.context.config.confirmationPollingIntervalSecond !== undefined\n ? this.context.config.confirmationPollingIntervalSecond\n : await this.context.getConfirmationPollingInterval();\n\n const { defaultConfirmationCount, confirmationPollingTimeoutSecond } = this.context.config;\n this._pollingConfig$.next({\n interval: interval || confirmationPollingIntervalSecond,\n timeout: timeout || confirmationPollingTimeoutSecond,\n } as Required<PollingConfig>);\n\n const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;\n\n return new Promise<number>((resolve, reject) => {\n this.confirmed$\n .pipe(\n switchMap(() => this.polling$),\n switchMap(() => this.currentHead$),\n filter((head) => head.header.level - this._foundAt >= conf - 1),\n first()\n )\n .subscribe((_) => {\n resolve(this._foundAt + (conf - 1));\n }, reject);\n });\n }\n}\n","import { OperationContentsAndResult } from '@taquito/rpc';\nimport { BATCH_KINDS } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCOperation,\n StorageConsumingOperation,\n hasMetadataWithResult,\n} from './types';\n\nexport class BatchOperation\n extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation\n{\n constructor(\n hash: string,\n private readonly params: RPCOperation[],\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n public get status() {\n return (\n this.results\n .filter((result) => BATCH_KINDS.indexOf(result.kind) !== -1)\n .map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n\n get fee() {\n return this.sumProp(this.params, 'fee');\n }\n\n get gasLimit() {\n return this.sumProp(this.params, 'gas_limit');\n }\n\n get storageLimit() {\n return this.sumProp(this.params, 'storage_limit');\n }\n\n get consumedGas() {\n return String(this.sumProp(flattenOperationResult({ contents: this.results }), 'consumed_gas'));\n }\n\n get storageDiff() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.results }), 'paid_storage_size_diff')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.results });\n }\n}\n","import {\n BlockHeaderResponse,\n OperationContents,\n OperationContentsAndResult,\n OpKind,\n RpcClientInterface,\n RPCRunOperationParam,\n} from '@taquito/rpc';\nimport { Protocols } from '../constants';\nimport { Context } from '../context';\nimport { Estimate } from '../contract/estimate';\nimport { flattenErrors, TezosOperationError, TezosPreapplyFailureError } from './operation-errors';\nimport {\n ForgedBytes,\n isOpRequireReveal,\n ParamsWithKind,\n PrepareOperationParams,\n RPCOperation,\n RPCOpWithFee,\n RPCOpWithSource,\n} from './types';\n\nexport interface PreparedOperation {\n opOb: {\n branch: string;\n contents: OperationContents[];\n protocol: string;\n };\n counter: number;\n}\n\nexport abstract class OperationEmitter {\n get rpc(): RpcClientInterface {\n return this.context.rpc;\n }\n\n get signer() {\n return this.context.signer;\n }\n\n constructor(protected context: Context) {}\n\n protected async isRevealOpNeeded(op: RPCOperation[] | ParamsWithKind[], pkh: string) {\n return !(await this.isAccountRevealRequired(pkh)) || !this.isRevealRequiredForOpType(op)\n ? false\n : true;\n }\n\n protected async isAccountRevealRequired(publicKeyHash: string) {\n const manager = await this.rpc.getManagerKey(publicKeyHash);\n const haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager;\n return !haveManager;\n }\n\n protected isRevealRequiredForOpType(op: RPCOperation[] | ParamsWithKind[]) {\n let opRequireReveal = false;\n for (const operation of op) {\n if (isOpRequireReveal(operation)) {\n opRequireReveal = true;\n }\n }\n return opRequireReveal;\n }\n\n // Originally from sotez (Copyright (c) 2018 Andrew Kishino)\n protected async prepareOperation({\n operation,\n source,\n }: PrepareOperationParams): Promise<PreparedOperation> {\n const counters: { [key: string]: number } = {};\n let ops: RPCOperation[] = [];\n\n const blockHeaderPromise = this.rpc.getBlockHeader({ block: 'head~2' });\n const blockMetaPromise = this.rpc.getBlockMetadata();\n\n if (Array.isArray(operation)) {\n ops = [...operation];\n } else {\n ops = [operation];\n }\n\n // Implicit account who emit the operation\n const publicKeyHash = await this.signer.publicKeyHash();\n let counterPromise: Promise<string | undefined> = Promise.resolve(undefined);\n\n for (let i = 0; i < ops.length; i++) {\n if (isOpRequireReveal(ops[i]) || ops[i].kind === 'reveal') {\n const { counter } = await this.rpc.getContract(publicKeyHash);\n counterPromise = Promise.resolve(counter);\n break;\n }\n }\n\n const [header, metadata, headCounter] = await Promise.all([\n blockHeaderPromise,\n blockMetaPromise,\n counterPromise,\n ]);\n\n if (!header) {\n throw new Error('Unable to fetch latest block header');\n }\n\n if (!metadata) {\n throw new Error('Unable to fetch latest metadata');\n }\n\n const head = header;\n\n const counter = parseInt(headCounter || '0', 10);\n if (!counters[publicKeyHash] || counters[publicKeyHash] < counter) {\n counters[publicKeyHash] = counter;\n }\n\n const getFee = (op: RPCOpWithFee) => {\n const opCounter = ++counters[publicKeyHash];\n return {\n counter: `${opCounter}`,\n fee: typeof op.fee === 'undefined' ? '0' : `${op.fee}`,\n gas_limit: typeof op.gas_limit === 'undefined' ? '0' : `${op.gas_limit}`,\n storage_limit: typeof op.storage_limit === 'undefined' ? '0' : `${op.storage_limit}`,\n };\n };\n\n const getSource = (op: RPCOpWithSource) => {\n return {\n source: typeof op.source === 'undefined' ? source || publicKeyHash : op.source,\n };\n };\n\n const constructOps = (cOps: RPCOperation[]): OperationContents[] =>\n cOps.map((op: RPCOperation) => {\n switch (op.kind) {\n case OpKind.ACTIVATION:\n return {\n ...op,\n };\n case OpKind.REVEAL:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.ORIGINATION:\n return {\n ...op,\n balance: typeof op.balance !== 'undefined' ? `${op.balance}` : '0',\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.TRANSACTION: {\n const cops = {\n ...op,\n amount: typeof op.amount !== 'undefined' ? `${op.amount}` : '0',\n ...getSource(op),\n ...getFee(op),\n };\n if (cops.source.toLowerCase().startsWith('kt1')) {\n throw new Error(\n `KT1 addresses are not supported as source since ${Protocols.PsBabyM1}`\n );\n }\n return cops;\n }\n case OpKind.DELEGATION:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n return {\n ...op,\n ...getSource(op),\n ...getFee(op),\n };\n default:\n throw new Error('Unsupported operation');\n }\n });\n\n const branch = head.hash;\n const contents = constructOps(ops);\n const protocol = metadata.next_protocol;\n\n return {\n opOb: {\n branch,\n contents,\n protocol,\n },\n counter,\n };\n }\n\n protected async forge({ opOb: { branch, contents, protocol }, counter }: PreparedOperation) {\n const forgedBytes = await this.context.forger.forge({ branch, contents });\n\n return {\n opbytes: forgedBytes,\n opOb: {\n branch,\n contents,\n protocol,\n },\n counter,\n };\n }\n\n protected async simulate(op: RPCRunOperationParam) {\n return {\n opResponse: await this.rpc.runOperation(op),\n op,\n context: this.context.clone(),\n };\n }\n\n protected async estimate<T extends { fee?: number; gasLimit?: number; storageLimit?: number }>(\n { fee, gasLimit, storageLimit, ...rest }: T,\n estimator: (param: T) => Promise<Estimate>\n ) {\n let calculatedFee = fee;\n let calculatedGas = gasLimit;\n let calculatedStorage = storageLimit;\n\n if (fee === undefined || gasLimit === undefined || storageLimit === undefined) {\n const estimation = await estimator({ fee, gasLimit, storageLimit, ...(rest as any) });\n\n if (calculatedFee === undefined) {\n calculatedFee = estimation.suggestedFeeMutez;\n }\n\n if (calculatedGas === undefined) {\n calculatedGas = estimation.gasLimit;\n }\n\n if (calculatedStorage === undefined) {\n calculatedStorage = estimation.storageLimit;\n }\n }\n\n return {\n fee: calculatedFee,\n gasLimit: calculatedGas,\n storageLimit: calculatedStorage,\n };\n }\n\n protected async signAndInject(forgedBytes: ForgedBytes) {\n const signed = await this.signer.sign(forgedBytes.opbytes, new Uint8Array([3]));\n forgedBytes.opbytes = signed.sbytes;\n forgedBytes.opOb.signature = signed.prefixSig;\n\n const opResponse: OperationContentsAndResult[] = [];\n const results = await this.rpc.preapplyOperations([forgedBytes.opOb]);\n\n if (!Array.isArray(results)) {\n throw new TezosPreapplyFailureError(results);\n }\n\n for (let i = 0; i < results.length; i++) {\n for (let j = 0; j < results[i].contents.length; j++) {\n opResponse.push(results[i].contents[j]);\n }\n }\n\n const errors = flattenErrors(results);\n\n if (errors.length) {\n throw new TezosOperationError(errors);\n }\n\n return {\n hash: await this.context.injector.inject(forgedBytes.opbytes),\n forgedBytes,\n opResponse,\n context: this.context.clone(),\n };\n }\n}\n","import { Context } from '../context';\nimport { ContractStorageType, DefaultContractType } from '../contract/contract';\nimport { ContractMethod } from '../contract/contract-methods/contract-method-flat-param';\nimport { EstimationProvider, ContractProvider } from '../contract/interface';\nimport {\n createOriginationOperation,\n createRegisterGlobalConstantOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n} from '../contract/prepare';\nimport { BatchOperation } from '../operations/batch-operation';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport {\n ActivationParams,\n DelegateParams,\n OriginateParams,\n RPCOperation,\n TransferParams,\n ParamsWithKind,\n isOpWithFee,\n withKind,\n RevealParams,\n RegisterGlobalConstantParams,\n} from '../operations/types';\nimport { OpKind } from '@taquito/rpc';\nimport { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param';\nimport { \n validateAddress, \n validateKeyHash, \n InvalidAddressError, \n InvalidKeyHashError, \n ValidationResult \n} from '@taquito/utils'\n\nexport const BATCH_KINDS = [\n OpKind.ACTIVATION,\n OpKind.ORIGINATION,\n OpKind.TRANSACTION,\n OpKind.DELEGATION,\n];\nexport type BatchKinds =\n | OpKind.ACTIVATION\n | OpKind.ORIGINATION\n | OpKind.TRANSACTION\n | OpKind.DELEGATION;\n\nexport class OperationBatch extends OperationEmitter {\n private operations: ParamsWithKind[] = [];\n\n constructor(context: Context, private estimator: EstimationProvider) {\n super(context);\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withTransfer(params: TransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`)\n }\n this.operations.push({ kind: OpKind.TRANSACTION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withContractCall(params: ContractMethod<ContractProvider> | ContractMethodObject<ContractProvider>) {\n return this.withTransfer(params.toTransferParams());\n }\n\n /**\n *\n * @description Add a delegation operation to the batch\n *\n * @param params Delegation operation parameter\n */\n withDelegation(params: DelegateParams) {\n if (params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source address: ${params.source}`);\n }\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${params.delegate}`);\n }\n this.operations.push({ kind: OpKind.DELEGATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an activation operation to the batch\n *\n * @param params Activation operation parameter\n */\n withActivation({ pkh, secret }: ActivationParams) {\n if (validateKeyHash(pkh) !== ValidationResult.VALID) {\n throw new InvalidKeyHashError(`Invalid Key Hash: ${pkh}`);\n }\n this.operations.push({ kind: OpKind.ACTIVATION, pkh, secret });\n return this;\n }\n\n /**\n *\n * @description Add an origination operation to the batch\n *\n * @param params Origination operation parameter\n */\n withOrigination<TContract extends DefaultContractType = DefaultContractType>(params: OriginateParams<ContractStorageType<TContract>>) {\n this.operations.push({ kind: OpKind.ORIGINATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an operation to register a global constant to the batch\n *\n * @param params RegisterGlobalConstant operation parameter\n */\n withRegisterGlobalConstant(params: RegisterGlobalConstantParams) {\n this.operations.push({ kind: OpKind.REGISTER_GLOBAL_CONSTANT, ...params });\n return this;\n }\n\n private async getRPCOp(param: ParamsWithKind) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n return createTransferOperation({\n ...param,\n });\n case OpKind.ORIGINATION:\n return createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...param,\n }));\n case OpKind.DELEGATION:\n return createSetDelegateOperation({\n ...param,\n });\n case OpKind.ACTIVATION:\n return {\n ...param,\n };\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n return createRegisterGlobalConstantOperation({\n ...param,\n });\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n /**\n *\n * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array\n *\n * @param params Operations parameter\n */\n with(params: ParamsWithKind[]) {\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n this.withTransfer(param);\n break;\n case OpKind.ORIGINATION:\n this.withOrigination(param);\n break;\n case OpKind.DELEGATION:\n this.withDelegation(param);\n break;\n case OpKind.ACTIVATION:\n this.withActivation(param);\n break;\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n this.withRegisterGlobalConstant(param);\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n return this;\n }\n\n /**\n *\n * @description Forge and Inject the operation batch\n *\n * @param params Optionally specify the source of the operation\n */\n async send(params?: { source?: string }) {\n const publicKeyHash = await this.signer.publicKeyHash();\n const publicKey = await this.signer.publicKey();\n const estimates = await this.estimator.batch(this.operations);\n\n const revealNeeded = await this.isRevealOpNeeded(this.operations, publicKeyHash);\n let i = revealNeeded ? 1 : 0;\n\n const ops: RPCOperation[] = [];\n for (const op of this.operations) {\n if (isOpWithFee(op)) {\n const estimated = await this.estimate(op, async () => estimates[i]);\n ops.push(await this.getRPCOp({ ...op, ...estimated }));\n } else {\n ops.push({ ...op });\n }\n i++;\n }\n if (revealNeeded) {\n const reveal: withKind<RevealParams, OpKind.REVEAL> = { kind: OpKind.REVEAL }\n const estimatedReveal = await this.estimate(reveal, async () => estimates[0]);\n ops.unshift(await createRevealOperation({ ...estimatedReveal }, publicKeyHash, publicKey))\n }\n\n const source = (params && params.source) || publicKeyHash;\n const prepared = await this.prepareOperation({\n operation: ops,\n source,\n });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new BatchOperation(hash, ops, source, forgedBytes, opResponse, context);\n }\n}\n\nexport class RPCBatchProvider {\n constructor(private context: Context, private estimator: EstimationProvider) { }\n\n /***\n *\n * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch\n *\n * @param params List of operation to batch together\n */\n batch(params?: ParamsWithKind[]) {\n const batch = new OperationBatch(this.context, this.estimator);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n}\n","import { OperationContentsAndResult } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { flattenOperationResult } from '../operations/operation-errors';\n\nexport interface Receipt {\n totalFee: BigNumber;\n totalGas: BigNumber;\n totalStorage: BigNumber;\n totalAllocationBurn: BigNumber;\n totalOriginationBurn: BigNumber;\n totalPaidStorageDiff: BigNumber;\n totalStorageBurn: BigNumber;\n}\n\nexport const receiptFromOperation = (\n op: OperationContentsAndResult[],\n { ALLOCATION_BURN, ORIGINATION_BURN } = {\n ALLOCATION_BURN: 257,\n ORIGINATION_BURN: 257,\n }\n): Receipt => {\n const operationResults = flattenOperationResult({ contents: op });\n let totalGas = new BigNumber(0);\n let totalStorage = new BigNumber(0);\n let totalFee = new BigNumber(0);\n let totalOriginationBurn = new BigNumber(0);\n let totalAllocationBurn = new BigNumber(0);\n let totalPaidStorageDiff = new BigNumber(0);\n operationResults.forEach(result => {\n totalFee = totalFee.plus(result.fee || 0);\n totalOriginationBurn = totalOriginationBurn.plus(\n Array.isArray(result.originated_contracts)\n ? result.originated_contracts.length * ORIGINATION_BURN\n : 0\n );\n totalAllocationBurn = totalAllocationBurn.plus(\n 'allocated_destination_contract' in result ? ALLOCATION_BURN : 0\n );\n totalGas = totalGas.plus(result.consumed_gas || 0);\n totalPaidStorageDiff = totalPaidStorageDiff.plus(\n 'paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0\n );\n });\n\n totalStorage = totalStorage\n .plus(totalAllocationBurn)\n .plus(totalOriginationBurn)\n .plus(totalPaidStorageDiff);\n\n return {\n totalFee,\n totalGas,\n totalStorage,\n totalAllocationBurn,\n totalOriginationBurn,\n totalPaidStorageDiff,\n totalStorageBurn: new BigNumber(totalStorage.multipliedBy(1000)),\n };\n};\n","import { BlockResponse, OperationContentsAndResult, OperationResultStatusEnum } from '@taquito/rpc';\nimport { combineLatest, from, Observable, of, ReplaySubject } from 'rxjs';\nimport {\n catchError,\n distinctUntilChanged,\n filter,\n first,\n map,\n shareReplay,\n takeWhile,\n tap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { Receipt, receiptFromOperation } from './receipt';\nimport { validateOperation, ValidationResult, InvalidOperationHashError } from '@taquito/utils';\n\nexport type OperationStatus = 'pending' | 'unknown' | OperationResultStatusEnum;\n\nexport class MissedBlockDuringConfirmationError extends Error {\n name = 'MissedBlockDuringConfirmationError';\n\n constructor() {\n super(\n 'Taquito missed a block while waiting for operation confirmation and was not able to find the operation'\n );\n }\n}\n\nconst MAX_BRANCH_ANCESTORS = 60;\n\n/**\n * @description WalletOperation allows to monitor operation inclusion on chains and surface information related to the operation\n */\nexport class WalletOperation {\n protected _operationResult = new ReplaySubject<OperationContentsAndResult[]>(1);\n protected _includedInBlock = new ReplaySubject<BlockResponse>(1);\n protected _included = false;\n\n private lastHead: BlockResponse | undefined;\n protected newHead$: Observable<BlockResponse> = this._newHead$.pipe(\n tap((newHead) => {\n if (\n !this._included &&\n this.lastHead &&\n newHead.header.level - this.lastHead.header.level > 1\n ) {\n throw new MissedBlockDuringConfirmationError();\n }\n\n this.lastHead = newHead;\n }),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n // Observable that emit once operation is seen in a block\n private confirmed$ = this.newHead$.pipe(\n map((head) => {\n for (const opGroup of head.operations) {\n for (const op of opGroup) {\n if (op.hash === this.opHash) {\n this._included = true;\n this._includedInBlock.next(head);\n this._operationResult.next(op.contents as OperationContentsAndResult[]);\n\n // Return the block where the operation was found\n return head;\n }\n }\n }\n }),\n filter<BlockResponse | undefined, BlockResponse>((x): x is BlockResponse => {\n return typeof x !== 'undefined';\n }),\n first(),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n async operationResults() {\n return this._operationResult.pipe(first()).toPromise();\n }\n\n /**\n * @description Receipt expose the total amount of tezos token burn and spent on fees\n * The promise returned by receipt will resolve only once the transaction is included\n */\n async receipt(): Promise<Receipt> {\n return receiptFromOperation(await this.operationResults());\n }\n\n /**\n *\n * @param opHash Operation hash\n * @param raw Raw operation that was injected\n * @param context Taquito context allowing access to rpc and signer\n */\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n private _newHead$: Observable<BlockResponse>\n ) {\n if (validateOperation(this.opHash) !== ValidationResult.VALID) {\n throw new InvalidOperationHashError(`Invalid operation hash: ${this.opHash}`);\n }\n this.confirmed$\n .pipe(\n first(),\n catchError(() => of(undefined))\n )\n .subscribe();\n }\n\n async getCurrentConfirmation() {\n if (!this._included) {\n return 0;\n }\n\n return combineLatest([this._includedInBlock, from(this.context.rpc.getBlock())])\n .pipe(\n map(([foundAtBlock, head]) => {\n return head.header.level - foundAtBlock.header.level + 1;\n }),\n first()\n )\n .toPromise();\n }\n\n async isInCurrentBranch(tipBlockIdentifier = 'head') {\n // By default it is assumed that the operation is in the current branch\n if (!this._included) {\n return true;\n }\n\n const tipBlockHeader = await this.context.rpc.getBlockHeader({ block: tipBlockIdentifier });\n const inclusionBlock = await this._includedInBlock.pipe(first()).toPromise();\n\n const levelDiff = tipBlockHeader.level - inclusionBlock.header.level;\n\n // Block produced before the operation is included are assumed to be part of the current branch\n if (levelDiff <= 0) {\n return true;\n }\n\n const tipBlockLevel = Math.min(\n inclusionBlock.header.level + levelDiff,\n inclusionBlock.header.level + MAX_BRANCH_ANCESTORS\n );\n\n const blocks = new Set(await this.context.rpc.getLiveBlocks({ block: String(tipBlockLevel) }));\n return blocks.has(inclusionBlock.hash);\n }\n\n confirmationObservable(confirmations?: number) {\n if (typeof confirmations !== 'undefined' && confirmations < 1) {\n throw new Error('Confirmation count must be at least 1');\n }\n\n const { defaultConfirmationCount } = this.context.config;\n\n const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;\n\n if (conf === undefined) {\n throw new Error('Default confirmation count can not be undefined!');\n }\n\n return combineLatest([this._includedInBlock, this.newHead$]).pipe(\n distinctUntilChanged(([, previousHead], [, newHead]) => {\n return previousHead.hash === newHead.hash;\n }),\n map(([foundAtBlock, head]) => {\n return {\n block: head,\n expectedConfirmation: conf,\n currentConfirmation: head.header.level - foundAtBlock.header.level + 1,\n completed: head.header.level - foundAtBlock.header.level >= conf - 1,\n isInCurrentBranch: () => this.isInCurrentBranch(head.hash),\n };\n }),\n takeWhile(({ completed }) => !completed, true)\n );\n }\n\n /**\n *\n * @param confirmations [0] Number of confirmation to wait for\n */\n confirmation(confirmations?: number) {\n return this.confirmationObservable(confirmations).toPromise();\n }\n}\n","import { BlockResponse, OperationContentsAndResultReveal, OpKind } from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { BATCH_KINDS } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { hasMetadataWithResult } from '../operations/types';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class BatchWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.operationResults();\n\n return (\n op\n .filter((result) => BATCH_KINDS.indexOf(result.kind) !== -1)\n .map((result) => {\n if (hasMetadataWithResult(result)) {\n return result.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n })[0] || 'unknown'\n );\n }\n}\n","import { BlockResponse, OperationContentsAndResultReveal, OpKind } from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { Context } from '../context';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class DelegationWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async delegationOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.DELEGATION) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.delegationOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n}\n","import {\n BlockResponse,\n OperationContentsAndResultOrigination,\n OperationContentsAndResultReveal,\n OpKind,\n} from '@taquito/rpc';\nimport { Observable } from 'rxjs';\nimport { Context } from '../context';\nimport { DefaultWalletType } from '../contract/contract';\nimport { findWithKind } from '../operations/types';\nimport { WalletOperation, OperationStatus } from './operation';\n\nexport class OriginationWalletOperation<TWallet extends DefaultWalletType = DefaultWalletType> extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async originationOperation() {\n const operationResult = await this.operationResults();\n return findWithKind(operationResult, OpKind.ORIGINATION) as\n | OperationContentsAndResultOrigination\n | undefined;\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return findWithKind(operationResult, OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.originationOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n\n public async contract() {\n const op = await this.originationOperation();\n const address = (op?.metadata.operation_result.originated_contracts || [])[0];\n return this.context.wallet.at<TWallet>(address);\n }\n}\n","import { WalletOperation, OperationStatus } from './operation';\nimport { Context } from '../context';\nimport { Observable } from 'rxjs';\nimport {\n BlockResponse,\n OpKind,\n OperationContentsAndResultReveal,\n OperationContentsAndResultTransaction,\n} from '@taquito/rpc';\n\nexport class TransactionWalletOperation extends WalletOperation {\n constructor(\n public readonly opHash: string,\n protected readonly context: Context,\n newHead$: Observable<BlockResponse>\n ) {\n super(opHash, context, newHead$);\n }\n\n public async revealOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.REVEAL) as\n | OperationContentsAndResultReveal\n | undefined;\n }\n\n public async transactionOperation() {\n const operationResult = await this.operationResults();\n return operationResult.find(x => x.kind === OpKind.TRANSACTION) as\n | OperationContentsAndResultTransaction\n | undefined;\n }\n\n public async status(): Promise<OperationStatus> {\n if (!this._included) {\n return 'pending';\n }\n\n const op = await this.transactionOperation();\n if (!op) {\n return 'unknown';\n }\n\n return op.metadata.operation_result.status;\n }\n}\n","import { BlockResponse } from '@taquito/rpc';\nimport {\n concat,\n defer,\n from,\n MonoTypeOperatorFunction,\n Observable,\n of,\n range,\n ReplaySubject,\n SchedulerLike,\n throwError,\n timer,\n} from 'rxjs';\nimport {\n concatMap,\n distinctUntilKeyChanged,\n first,\n shareReplay,\n startWith,\n switchMap,\n timeoutWith,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { BatchWalletOperation } from './batch-operation';\nimport { DelegationWalletOperation } from './delegation-operation';\nimport { WalletOperation } from './operation';\nimport { OriginationWalletOperation } from './origination-operation';\nimport { TransactionWalletOperation } from './transaction-operation';\n\nexport const cacheUntil =\n <T>(cacheUntilObs: Observable<any>): MonoTypeOperatorFunction<T> =>\n (source) => {\n let subject: ReplaySubject<T> | null = null;\n\n return defer(() => {\n if (!subject) {\n subject = new ReplaySubject<T>();\n source.pipe(first()).subscribe(subject);\n cacheUntilObs.pipe(first()).subscribe(() => {\n subject = null;\n });\n }\n\n return subject;\n });\n };\n\nexport const createNewPollingBasedHeadObservable = (\n pollingTimer: Observable<number>,\n sharedHeadOb: Observable<BlockResponse>,\n context: Context,\n scheduler?: SchedulerLike\n): Observable<BlockResponse> => {\n return pollingTimer.pipe(\n switchMap(() => sharedHeadOb),\n distinctUntilKeyChanged('hash'),\n timeoutWith(\n context.config.confirmationPollingTimeoutSecond * 1000,\n throwError(new Error('Confirmation polling timed out')),\n scheduler\n ),\n shareReplay({\n refCount: true,\n scheduler,\n })\n );\n};\n\nexport interface OperationFactoryConfig {\n blockIdentifier?: string;\n}\n\nexport class OperationFactory {\n constructor(private context: Context) {}\n\n // Cache the last block for one second across all operations\n private sharedHeadObs = defer(() => from(this.context.rpc.getBlock())).pipe(\n cacheUntil(timer(0, 1000))\n );\n\n private async createNewHeadObservable() {\n const confirmationPollingIntervalSecond =\n this.context.config.confirmationPollingIntervalSecond !== undefined\n ? this.context.config.confirmationPollingIntervalSecond\n : await this.context.getConfirmationPollingInterval();\n return createNewPollingBasedHeadObservable(\n timer(0, confirmationPollingIntervalSecond * 1000),\n this.sharedHeadObs,\n this.context\n );\n }\n\n private createPastBlockWalker(startBlock: string, count = 1) {\n return from(this.context.rpc.getBlock({ block: startBlock })).pipe(\n switchMap((block) => {\n if (count === 1) {\n return of(block);\n }\n\n return range(block.header.level, count - 1).pipe(\n startWith(block),\n concatMap(async (level) => {\n return this.context.rpc.getBlock({ block: String(level) });\n })\n );\n })\n );\n }\n\n private async createHeadObservableFromConfig({ blockIdentifier }: OperationFactoryConfig) {\n const observableSequence: Observable<BlockResponse>[] = [];\n\n if (blockIdentifier) {\n observableSequence.push(this.createPastBlockWalker(blockIdentifier));\n }\n\n observableSequence.push(await this.createNewHeadObservable());\n\n return concat(...observableSequence);\n }\n\n async createOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<WalletOperation> {\n return new WalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createBatchOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<BatchWalletOperation> {\n return new BatchWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createTransactionOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<TransactionWalletOperation> {\n return new TransactionWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createDelegationOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<DelegationWalletOperation> {\n return new DelegationWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n\n async createOriginationOperation(\n hash: string,\n config: OperationFactoryConfig = {}\n ): Promise<OriginationWalletOperation> {\n return new OriginationWalletOperation(\n hash,\n this.context.clone(),\n await this.createHeadObservableFromConfig(config)\n );\n }\n}\n","import BigNumber from 'bignumber.js';\nimport { Context } from '../context';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport { Operation } from '../operations/operations';\nimport { RPCActivateOperation } from '../operations/types';\nimport { TzProvider } from './interface';\nimport { OpKind } from '@taquito/rpc';\nimport { validateAddress, ValidationResult, validateKeyHash, InvalidAddressError, InvalidKeyHashError } from '@taquito/utils';\n\nexport class RpcTzProvider extends OperationEmitter implements TzProvider {\n constructor(context: Context) {\n super(context);\n }\n\n async getBalance(address: string): Promise<BigNumber> {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address: ${address}`);\n }\n return this.rpc.getBalance(address);\n }\n\n async getDelegate(address: string): Promise<string | null> {\n if (validateAddress(address) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address: ${address}`);\n }\n return this.rpc.getDelegate(address);\n }\n\n async activate(pkh: string, secret: string) {\n if (validateKeyHash(pkh) !== ValidationResult.VALID) {\n throw new InvalidKeyHashError(`Invalid Public Key Hash: ${pkh}`);\n }\n const operation: RPCActivateOperation = {\n kind: OpKind.ACTIVATION,\n pkh,\n secret,\n };\n\n const prepared = await this.prepareOperation({ operation: [operation], source: pkh });\n const forgedBytes = await this.forge(prepared);\n const bytes = `${forgedBytes.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;\n return new Operation(\n await this.rpc.injectOperation(bytes),\n { ...forgedBytes, opbytes: bytes },\n [],\n this.context.clone()\n );\n }\n}\n","const MINIMAL_FEE_MUTEZ = 100;\nconst MINIMAL_FEE_PER_BYTE_MUTEZ = 1;\nconst MINIMAL_FEE_PER_GAS_MUTEZ = 0.1;\n\nconst GAS_BUFFER = 100;\n\nexport interface EstimateProperties {\n milligasLimit: number,\n storageLimit: number,\n opSize: number,\n minimalFeePerStorageByteMutez: number,\n baseFeeMutez?: number\n}\n\n/**\n * Examples of use :\n *\n * Estimate a transfer operation :\n * ```\n * // Assuming that provider and signer are already configured...\n *\n * const amount = 2;\n * const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY';\n *\n * // Estimate gasLimit, storageLimit and fees for a transfer operation\n * const est = await Tezos.estimate.transfer({ to: address, amount: amount })\n * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit,\n * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez)\n *\n * ```\n *\n * Estimate a contract origination :\n * ```\n * // generic.json is referring to a Michelson Smart Contract\n *\n * const genericMultisigJSON = require('./generic.json')\n * const est = await Tezos.estimate.originate({\n * code: genericMultisigJSON,\n * storage: {\n * stored_counter: 0,\n * threshold: 1,\n * keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t']\n * }\n * })\n * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit,\n * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez)\n *\n * ```\n */\n\nexport class Estimate {\n constructor(\n private readonly _milligasLimit: number | string,\n private readonly _storageLimit: number | string,\n public readonly opSize: number | string,\n private readonly minimalFeePerStorageByteMutez: number | string,\n /**\n * @description Base fee in mutez (1 mutez = 1e10−6 tez)\n */\n private readonly baseFeeMutez: number | string = MINIMAL_FEE_MUTEZ\n ) {}\n\n /**\n * @description The number of Mutez that will be burned for the storage of the [operation](https://tezos.gitlab.io/user/glossary.html#operations). (Storage + Allocation fees)\n */\n get burnFeeMutez() {\n return this.roundUp(Number(this.storageLimit) * Number(this.minimalFeePerStorageByteMutez));\n }\n\n /**\n * @description The limit on the amount of storage an [operation](https://tezos.gitlab.io/user/glossary.html#operations) can use.\n */\n get storageLimit() {\n const limit = Math.max(Number(this._storageLimit), 0);\n return limit > 0 ? limit : 0;\n }\n\n /**\n * @description The limit on the amount of [gas](https://tezos.gitlab.io/user/glossary.html#gas) a given operation can consume.\n */\n get gasLimit() {\n return this.roundUp(Number(this._milligasLimit)/1000 + GAS_BUFFER);\n }\n\n private get operationFeeMutez() {\n return (\n (Number(this._milligasLimit)/1000 + GAS_BUFFER) * MINIMAL_FEE_PER_GAS_MUTEZ + Number(this.opSize) * MINIMAL_FEE_PER_BYTE_MUTEZ\n );\n }\n\n private roundUp(nanotez: number) {\n return Math.ceil(Number(nanotez));\n }\n\n /**\n * @description Minimum fees for the [operation](https://tezos.gitlab.io/user/glossary.html#operations) according to [baker](https://tezos.gitlab.io/user/glossary.html#baker) defaults.\n */\n get minimalFeeMutez() {\n return this.roundUp(MINIMAL_FEE_MUTEZ + this.operationFeeMutez);\n }\n\n /**\n * @description The suggested fee for the operation which includes minimal fees and a small buffer.\n */\n get suggestedFeeMutez() {\n return this.roundUp(this.operationFeeMutez + MINIMAL_FEE_MUTEZ * 2);\n }\n\n /**\n * @description Fees according to your specified base fee will ensure that at least minimum fees are used.\n */\n get usingBaseFeeMutez() {\n return (\n Math.max(Number(this.baseFeeMutez), MINIMAL_FEE_MUTEZ) + this.roundUp(this.operationFeeMutez)\n );\n }\n\n /**\n * @description The sum of `minimalFeeMutez` + `burnFeeMutez`.\n */\n get totalCost() {\n return this.minimalFeeMutez + this.burnFeeMutez;\n }\n\n /**\n * @description Since Delphinet, consumed gas is provided in milligas for more precision. \n * This function returns an estimation of the gas that operation will consume in milligas. \n */\n get consumedMilligas() {\n return Number(this._milligasLimit);\n }\n\n static createEstimateInstanceFromProperties(estimateProperties: EstimateProperties[]) {\n let milligasLimit = 0;\n let storageLimit = 0;\n let opSize = 0;\n let minimalFeePerStorageByteMutez = 0;\n let baseFeeMutez: number | undefined;\n\n estimateProperties.forEach(estimate => {\n milligasLimit += estimate.milligasLimit;\n storageLimit += estimate.storageLimit;\n opSize += estimate.opSize;\n minimalFeePerStorageByteMutez = Math.max(estimate.minimalFeePerStorageByteMutez, minimalFeePerStorageByteMutez);\n if (estimate.baseFeeMutez) {\n baseFeeMutez = baseFeeMutez ? baseFeeMutez + estimate.baseFeeMutez : estimate.baseFeeMutez;\n }\n })\n return new Estimate(milligasLimit, storageLimit, opSize, minimalFeePerStorageByteMutez, baseFeeMutez);\n }\n\n static createArrayEstimateInstancesFromProperties(estimateProperties: EstimateProperties[]) {\n return estimateProperties.map(x => new Estimate(x.milligasLimit, x.storageLimit, x.opSize, x.minimalFeePerStorageByteMutez, x.baseFeeMutez))\n }\n}\n","import { PreapplyResponse, RPCRunOperationParam, OpKind, ConstantsResponse } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_STORAGE_LIMIT } from '../constants';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport {\n flattenErrors,\n flattenOperationResult,\n TezosOperationError,\n} from '../operations/operation-errors';\nimport {\n DelegateParams,\n isOpWithFee,\n OriginateParams,\n ParamsWithKind,\n PrepareOperationParams,\n RegisterDelegateParams,\n RPCOperation,\n TransferParams,\n RevealParams,\n RegisterGlobalConstantParams,\n} from '../operations/types';\nimport { Estimate, EstimateProperties } from './estimate';\nimport { EstimationProvider } from './interface';\nimport {\n createOriginationOperation,\n createRegisterDelegateOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n createRegisterGlobalConstantOperation,\n} from './prepare';\nimport { validateAddress, InvalidAddressError, ValidationResult } from '@taquito/utils';\n\ninterface Limits {\n fee?: number;\n storageLimit?: number;\n gasLimit?: number;\n}\n\nconst mergeLimits = (\n userDefinedLimit: Limits,\n defaultLimits: Required<Limits>\n): Required<Limits> => {\n return {\n fee: typeof userDefinedLimit.fee === 'undefined' ? defaultLimits.fee : userDefinedLimit.fee,\n gasLimit:\n typeof userDefinedLimit.gasLimit === 'undefined'\n ? defaultLimits.gasLimit\n : userDefinedLimit.gasLimit,\n storageLimit:\n typeof userDefinedLimit.storageLimit === 'undefined'\n ? defaultLimits.storageLimit\n : userDefinedLimit.storageLimit,\n };\n};\n\n// RPC requires a signature but does not verify it\nconst SIGNATURE_STUB =\n 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg';\n\nexport class RPCEstimateProvider extends OperationEmitter implements EstimationProvider {\n private readonly ALLOCATION_STORAGE = 257;\n private readonly ORIGINATION_STORAGE = 257;\n private readonly OP_SIZE_REVEAL = 128;\n\n // Maximum values defined by the protocol\n private async getAccountLimits(pkh: string, constants: ConstantsResponse, numberOfOps?: number) {\n const balance = await this.rpc.getBalance(pkh);\n const {\n hard_gas_limit_per_operation,\n hard_gas_limit_per_block,\n hard_storage_limit_per_operation,\n cost_per_byte,\n } = constants;\n return {\n fee: 0,\n gasLimit: numberOfOps\n ? Math.floor(\n this.ajustGasForBatchOperation(\n hard_gas_limit_per_block,\n hard_gas_limit_per_operation,\n numberOfOps\n ).toNumber()\n )\n : hard_gas_limit_per_operation.toNumber(),\n storageLimit: Math.floor(\n BigNumber.min(balance.dividedBy(cost_per_byte), hard_storage_limit_per_operation).toNumber()\n ),\n };\n }\n\n // Fix for Granada where the total gasLimit of a batch can not exceed the hard_gas_limit_per_block.\n // If the total gasLimit of the batch is higher than the hard_gas_limit_per_block,\n // the gasLimit is calculated by dividing the hard_gas_limit_per_block by the number of operation in the batch (numberOfOps).\n // numberOfOps is incremented by 1 for safety in case a reveal operation is needed\n private ajustGasForBatchOperation(\n gasLimitBlock: BigNumber,\n gaslimitOp: BigNumber,\n numberOfOps: number\n ) {\n return BigNumber.min(gaslimitOp, gasLimitBlock.div(numberOfOps + 1));\n }\n\n private getEstimationPropertiesFromOperationContent(\n content: PreapplyResponse['contents'][0],\n size: number,\n costPerByte: BigNumber\n ): EstimateProperties {\n const operationResults = flattenOperationResult({ contents: [content] });\n let totalGas = 0;\n let totalMilligas = 0;\n let totalStorage = 0;\n operationResults.forEach((result) => {\n totalStorage +=\n 'originated_contracts' in result && typeof result.originated_contracts !== 'undefined'\n ? result.originated_contracts.length * this.ORIGINATION_STORAGE\n : 0;\n totalStorage += 'allocated_destination_contract' in result ? this.ALLOCATION_STORAGE : 0;\n totalGas += Number(result.consumed_gas) || 0;\n totalMilligas += Number(result.consumed_milligas) || 0;\n totalStorage +=\n 'paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0;\n totalStorage +=\n 'storage_size' in result && 'global_address' in result\n ? Number(result.storage_size) || 0\n : 0;\n });\n\n if (totalGas !== 0 && totalMilligas === 0) {\n // This will convert gas to milligas for Carthagenet where result does not contain consumed gas in milligas.\n totalMilligas = totalGas * 1000;\n }\n\n if (isOpWithFee(content)) {\n return {\n milligasLimit: totalMilligas || 0,\n storageLimit: Number(totalStorage || 0),\n opSize: size,\n minimalFeePerStorageByteMutez: costPerByte.toNumber(),\n };\n } else {\n return {\n milligasLimit: 0,\n storageLimit: 0,\n opSize: size,\n minimalFeePerStorageByteMutez: costPerByte.toNumber(),\n baseFeeMutez: 0,\n };\n }\n }\n\n private async prepareEstimate(params: PrepareOperationParams, constants: ConstantsResponse) {\n const prepared = await this.prepareOperation(params);\n const {\n opbytes,\n opOb: { branch, contents },\n } = await this.forge(prepared);\n const operation: RPCRunOperationParam = {\n operation: { branch, contents, signature: SIGNATURE_STUB },\n chain_id: await this.rpc.getChainId(),\n };\n\n const { opResponse } = await this.simulate(operation);\n const { cost_per_byte } = constants;\n const errors = [...flattenErrors(opResponse, 'backtracked'), ...flattenErrors(opResponse)];\n\n // Fail early in case of errors\n if (errors.length) {\n throw new TezosOperationError(errors);\n }\n\n let numberOfOps = 1;\n if (Array.isArray(params.operation) && params.operation.length > 1) {\n numberOfOps =\n opResponse.contents[0].kind === 'reveal'\n ? params.operation.length - 1\n : params.operation.length;\n }\n\n return opResponse.contents.map((x) => {\n return this.getEstimationPropertiesFromOperationContent(\n x,\n // TODO: Calculate a specific opSize for each operation.\n x.kind === 'reveal' ? this.OP_SIZE_REVEAL / 2 : opbytes.length / 2 / numberOfOps,\n cost_per_byte\n );\n });\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an origination operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param OriginationOperation Originate operation parameter\n */\n async originate({ fee, storageLimit, gasLimit, ...rest }: OriginateParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n })\n );\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an transfer operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param TransferOperation Originate operation parameter\n */\n async transfer({ fee, storageLimit, gasLimit, ...rest }: TransferParams) {\n if (validateAddress(rest.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${rest.to}`);\n }\n if (rest.source && validateAddress(rest.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'source' address: ${rest.source}`);\n }\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createTransferOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a delegate operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param Estimate\n */\n async setDelegate({ fee, gasLimit, storageLimit, ...rest }: DelegateParams) {\n if (rest.source && validateAddress(rest.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source address: ${rest.source}`);\n }\n if (rest.delegate && validateAddress(rest.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${rest.delegate}`);\n }\n\n const pkh = await this.signer.publicKeyHash();\n const sourceOrDefault = rest.source || pkh;\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(sourceOrDefault, protocolConstants);\n const op = await createSetDelegateOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a each operation in the batch\n *\n * @returns An array of Estimate objects. If a reveal operation is needed, the first element of the array is the Estimate for the reveal operation.\n */\n async batch(params: ParamsWithKind[]) {\n const pkh = await this.signer.publicKeyHash();\n let operations: RPCOperation[] = [];\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants, params.length);\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n operations.push(\n await createTransferOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n case OpKind.ORIGINATION:\n operations.push(\n await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n )\n );\n break;\n case OpKind.DELEGATION:\n operations.push(\n await createSetDelegateOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n case OpKind.ACTIVATION:\n operations.push({\n ...param,\n ...DEFAULT_PARAMS,\n });\n break;\n case OpKind.REGISTER_GLOBAL_CONSTANT:\n operations.push(\n await createRegisterGlobalConstantOperation({\n ...param,\n ...mergeLimits(param, DEFAULT_PARAMS),\n })\n );\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n const isRevealNeeded = await this.isRevealOpNeeded(operations, pkh);\n operations = isRevealNeeded ? await this.addRevealOp(operations, pkh) : operations;\n const estimateProperties = await this.prepareEstimate(\n { operation: operations, source: pkh },\n protocolConstants\n );\n\n return Estimate.createArrayEstimateInstancesFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for a delegate operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param Estimate\n */\n async registerDelegate(params: RegisterDelegateParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRegisterDelegateOperation({ ...params, ...DEFAULT_PARAMS }, pkh);\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees to reveal the current account\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation or undefined if the account is already revealed\n *\n * @param Estimate\n */\n async reveal(params?: RevealParams) {\n const pkh = await this.signer.publicKeyHash();\n if (await this.isAccountRevealRequired(pkh)) {\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRevealOperation(\n {\n ...params,\n ...DEFAULT_PARAMS,\n },\n pkh,\n await this.signer.publicKey()\n );\n const estimateProperties = await this.prepareEstimate(\n { operation: op, source: pkh },\n protocolConstants\n );\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n }\n\n /**\n *\n * @description Estimate gasLimit, storageLimit and fees for an registerGlobalConstant operation\n *\n * @returns An estimation of gasLimit, storageLimit and fees for the operation\n *\n * @param params registerGlobalConstant operation parameter\n */\n async registerGlobalConstant({\n fee,\n storageLimit,\n gasLimit,\n ...rest\n }: RegisterGlobalConstantParams) {\n const pkh = await this.signer.publicKeyHash();\n const protocolConstants = await this.rpc.getConstants();\n const DEFAULT_PARAMS = await this.getAccountLimits(pkh, protocolConstants);\n const op = await createRegisterGlobalConstantOperation({\n ...rest,\n ...mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS),\n });\n const isRevealNeeded = await this.isRevealOpNeeded([op], pkh);\n const ops = isRevealNeeded ? await this.addRevealOp([op], pkh) : op;\n const estimateProperties = await this.prepareEstimate(\n { operation: ops, source: pkh },\n protocolConstants\n );\n if (isRevealNeeded) {\n estimateProperties.shift();\n }\n return Estimate.createEstimateInstanceFromProperties(estimateProperties);\n }\n\n private async addRevealOp(op: RPCOperation[], pkh: string) {\n op.unshift(\n await createRevealOperation(\n {\n ...{\n fee: DEFAULT_FEE.REVEAL,\n gasLimit: DEFAULT_GAS_LIMIT.REVEAL,\n storageLimit: DEFAULT_STORAGE_LIMIT.REVEAL,\n },\n },\n pkh,\n await this.signer.publicKey()\n )\n );\n return op;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultDelegation } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCDelegateOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Delegation operation provide utility function to fetch newly issued delegation\n *\n * @warn Currently support only one delegation per operation\n */\nexport class DelegateOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCDelegateOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const delegationOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'delegation') as OperationContentsAndResultDelegation);\n const result = delegationOp && delegationOp.metadata && delegationOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get delegate(): string {\n return this.delegate;\n }\n\n get isRegisterOperation(): boolean {\n return this.delegate === this.source;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get consumedGas() {\n const consumedGas = this.operationResults && this.operationResults.consumed_gas;\n return consumedGas ? consumedGas : undefined;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { DefaultContractType } from '../contract/contract';\nimport { RpcContractProvider } from '../contract/rpc-contract-provider';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n hasMetadataWithResult,\n RPCOriginationOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Origination operation provide utility function to fetch newly originated contract\n *\n * @warn Currently support only one origination per operation\n */\nexport class OriginationOperation<TContract extends DefaultContractType = DefaultContractType> \n extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n /**\n * @description Contract address of the newly originated contract\n */\n public readonly contractAddress?: string;\n\n constructor(\n hash: string,\n private readonly params: RPCOriginationOperation,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context,\n private contractProvider: RpcContractProvider\n ) {\n super(hash, raw, results, context);\n\n const originatedContracts = this.operationResults && this.operationResults.originated_contracts;\n if (Array.isArray(originatedContracts)) {\n this.contractAddress = originatedContracts[0];\n }\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get operationResults() {\n const originationOp =\n Array.isArray(this.results) &&\n (this.results.find((op) => op.kind === 'origination') as\n | OperationContentsAndResultOrigination\n | undefined);\n\n const result =\n originationOp &&\n hasMetadataWithResult(originationOp) &&\n originationOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get consumedGas() {\n const consumedGas = this.operationResults && this.operationResults.consumed_gas;\n return consumedGas ? consumedGas : undefined;\n }\n\n get storageDiff() {\n const storageDiff = this.operationResults && this.operationResults.paid_storage_size_diff;\n return storageDiff ? storageDiff : undefined;\n }\n\n get storageSize() {\n const storageSize = this.operationResults && this.operationResults.storage_size;\n return storageSize ? storageSize : undefined;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n\n /**\n * @description Provide the contract abstract of the newly originated contract\n */\n async contract(confirmations?: number, interval?: number, timeout?: number) {\n if (!this.contractAddress) {\n throw new Error('No contract was originated in this operation');\n }\n\n await this.confirmation(confirmations, interval, timeout);\n return this.contractProvider.at<TContract>(this.contractAddress);\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultRegisterGlobalConstant } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCRegisterGlobalConstantOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant\n */\nexport class RegisterGlobalConstantOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n\n /**\n * @description Hash (index) of the newly registered constant\n */\n public readonly globalConstantHash?: string;\n constructor(\n hash: string,\n private readonly params: RPCRegisterGlobalConstantOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n\n this.globalConstantHash = this.operationResults && this.operationResults.global_address;\n }\n\n get operationResults() {\n const registerGlobalConstantOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'register_global_constant') as OperationContentsAndResultRegisterGlobalConstant);\n const result = registerGlobalConstantOp && registerGlobalConstantOp.metadata && registerGlobalConstantOp.metadata.operation_result;\n return result ? result : undefined;\n }\n\n get status() {\n const operationResults = this.operationResults;\n if (operationResults) {\n return operationResults.status;\n } else {\n return 'unknown';\n }\n }\n\n get registeredExpression() {\n return this.params.value;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get errors() {\n return this.operationResults && this.operationResults.errors;\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultReveal } from '@taquito/rpc';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCRevealOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Reveal operation provides utility functions to fetch a newly issued revelation\n */\nexport class RevealOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCRevealOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const revealOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'reveal') as OperationContentsAndResultReveal);\n return revealOp ? [revealOp] : [];\n }\n\n get status() {\n const operationResults = this.operationResults;\n const txResult = operationResults[0];\n if (txResult) {\n return txResult.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n get publicKey() {\n return this.params.public_key;\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n get consumedGas() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')\n );\n }\n\n get storageDiff() {\n return String(\n this.sumProp(\n flattenOperationResult({ contents: this.operationResults }),\n 'paid_storage_size_diff'\n )\n );\n }\n\n get storageSize() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.operationResults });\n }\n}\n","import { OperationContentsAndResult, OperationContentsAndResultTransaction } from '@taquito/rpc';\nimport BigNumber from 'bignumber.js';\nimport { Context } from '../context';\nimport { flattenErrors, flattenOperationResult } from './operation-errors';\nimport { Operation } from './operations';\nimport {\n FeeConsumingOperation,\n ForgedBytes,\n GasConsumingOperation,\n RPCTransferOperation,\n StorageConsumingOperation,\n} from './types';\n\n/**\n * @description Transaction operation provides utility functions to fetch a newly issued transaction\n *\n * @warn Currently supports one transaction per operation\n */\nexport class TransactionOperation extends Operation\n implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation {\n constructor(\n hash: string,\n private readonly params: RPCTransferOperation,\n public readonly source: string,\n raw: ForgedBytes,\n results: OperationContentsAndResult[],\n context: Context\n ) {\n super(hash, raw, results, context);\n }\n\n get operationResults() {\n const transactionOp =\n Array.isArray(this.results) &&\n (this.results.find(op => op.kind === 'transaction') as OperationContentsAndResultTransaction);\n return transactionOp ? [transactionOp] : [];\n }\n\n get status() {\n const operationResults = this.operationResults;\n const txResult = operationResults[0];\n if (txResult) {\n return txResult.metadata.operation_result.status;\n } else {\n return 'unknown';\n }\n }\n\n get amount() {\n return new BigNumber(this.params.amount);\n }\n\n get destination() {\n return this.params.destination;\n }\n\n get fee() {\n return this.params.fee;\n }\n\n get gasLimit() {\n return this.params.gas_limit;\n }\n\n get storageLimit() {\n return this.params.storage_limit;\n }\n\n private sumProp(arr: any[], prop: string) {\n return arr.reduce((prev, current) => {\n return prop in current ? Number(current[prop]) + prev : prev;\n }, 0);\n }\n\n get consumedGas() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')\n );\n }\n\n get storageDiff() {\n return String(\n this.sumProp(\n flattenOperationResult({ contents: this.operationResults }),\n 'paid_storage_size_diff'\n )\n );\n }\n\n get storageSize() {\n return String(\n this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')\n );\n }\n\n get errors() {\n return flattenErrors({ contents: this.operationResults });\n }\n}\n","const setDelegate = (key: string) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'key_hash' }, { string: key }],\n },\n { prim: 'SOME' },\n { prim: 'SET_DELEGATE' },\n { prim: 'CONS' },\n ];\n};\n\nconst transferImplicit = (key: string, mutez: number) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'key_hash' }, { string: key }],\n },\n { prim: 'IMPLICIT_ACCOUNT' },\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: `${mutez}` }],\n },\n { prim: 'UNIT' },\n { prim: 'TRANSFER_TOKENS' },\n { prim: 'CONS' },\n ];\n};\n\nconst removeDelegate = () => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n { prim: 'NONE', args: [{ prim: 'key_hash' }] },\n { prim: 'SET_DELEGATE' },\n { prim: 'CONS' },\n ];\n};\n\nconst transferToContract = (key: string, amount: number) => {\n return [\n { prim: 'DROP' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n {\n prim: 'PUSH',\n args: [{ prim: 'address' }, { string: key }],\n },\n { prim: 'CONTRACT', args: [{ prim: 'unit' }] },\n [\n {\n prim: 'IF_NONE',\n args: [[[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]], []],\n },\n ],\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: `${amount}` }],\n },\n { prim: 'UNIT' },\n { prim: 'TRANSFER_TOKENS' },\n { prim: 'CONS' },\n ];\n};\n\nexport const MANAGER_LAMBDA = {\n setDelegate,\n removeDelegate,\n transferImplicit,\n transferToContract,\n};\n","const code = [\n {\n prim: 'parameter',\n args: [\n {\n prim: 'lambda',\n args: [\n { prim: 'unit' },\n {\n prim: 'pair',\n args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }],\n },\n ],\n },\n ],\n },\n { prim: 'storage', args: [{ prim: 'unit' }] },\n { prim: 'code', args: [[{ prim: 'CAR' }, { prim: 'UNIT' }, { prim: 'EXEC' }]] },\n];\n\nconst storage = 'Unit';\n\nexport const VIEW_LAMBDA = {\n code,\n storage\n}\n","import { Wallet } from '../wallet/wallet';\nimport { Context } from '../context';\nimport { ContractAbstraction } from './contract';\nimport { ContractProvider } from './interface';\n\nexport function compose<\n ContractAbsComposer1 extends ContractAbstraction<ContractProvider | Wallet>,\n ContractAbsComposer2 extends ContractAbstraction<ContractProvider | Wallet>,\n ContractAbstractionComposed\n>(\n functioncomposer1: (abs: ContractAbsComposer1, context: Context) => ContractAbsComposer2,\n functioncomposer2: (abs: ContractAbsComposer2, context: Context) => ContractAbstractionComposed\n): (abs: ContractAbsComposer1, context: Context) => ContractAbstractionComposed {\n return (contractAbstraction, context) =>\n functioncomposer2(functioncomposer1(contractAbstraction, context), context);\n}\n","import { TransactionOperation } from '../../operations/transaction-operation';\nimport { TransferParams } from '../../operations/types';\nimport { ContractProvider } from '../interface';\nimport { TransactionWalletOperation, Wallet } from '../../wallet';\nimport { ParameterSchema } from '@taquito/michelson-encoder';\nimport {\n ContractMethodInterface,\n ExplicitTransferParams,\n SendParams,\n} from './contract-method-interface';\nimport { DEFAULT_SMART_CONTRACT_METHOD_NAME } from '../contract';\nimport { InvalidParameterError } from '../errors';\n\n/**\n * @description Utility class to send smart contract operation\n * The format for the arguments is the flattened representation\n */\nexport class ContractMethod<T extends ContractProvider | Wallet>\n implements ContractMethodInterface\n{\n constructor(\n private provider: T,\n private address: string,\n private parameterSchema: ParameterSchema,\n private name: string,\n private args: any[],\n private isMultipleEntrypoint = true,\n private isAnonymous = false\n ) {}\n\n private validateArgs(args: any[], schema: ParameterSchema, name: string) {\n const sigs = schema.ExtractSignatures();\n\n if (!sigs.find((x: any[]) => x.length === args.length)) {\n throw new InvalidParameterError(name, sigs, args);\n }\n }\n\n /**\n * @description Get the schema of the smart contract method\n */\n get schema() {\n return this.isAnonymous\n ? this.parameterSchema.ExtractSchema()[this.name]\n : this.parameterSchema.ExtractSchema();\n }\n\n /**\n * @description Get the signature of the smart contract method\n */\n getSignature() {\n if (this.isAnonymous) {\n const sig = this.parameterSchema.ExtractSignatures().find((x: any[]) => x[0] === this.name);\n if (sig) {\n sig.shift();\n return sig;\n }\n } else {\n const sig = this.parameterSchema.ExtractSignatures();\n return sig.length == 1 ? sig[0] : sig;\n }\n }\n\n /**\n *\n * @description Send the smart contract operation\n *\n * @param Options generic operation parameter\n */\n send(\n params: Partial<SendParams> = {}\n ): Promise<T extends Wallet ? TransactionWalletOperation : TransactionOperation> {\n if (this.provider instanceof Wallet) {\n return (this.provider as unknown as Wallet)\n .transfer(this.toTransferParams(params))\n .send() as any;\n } else {\n return this.provider.transfer(this.toTransferParams(params)) as any;\n }\n }\n\n /**\n *\n * @description Create transfer params to be used with TezosToolkit.contract.transfer methods\n *\n * @param Options generic transfer operation parameters\n */\n toTransferParams({\n fee,\n gasLimit,\n storageLimit,\n source,\n amount = 0,\n mutez = false,\n }: Partial<SendParams> = {}): TransferParams {\n const fullTransferParams: ExplicitTransferParams = {\n to: this.address,\n amount,\n fee,\n mutez,\n source,\n gasLimit,\n storageLimit,\n parameter: {\n entrypoint: this.isMultipleEntrypoint ? this.name : DEFAULT_SMART_CONTRACT_METHOD_NAME,\n value: this.isAnonymous\n ? this.parameterSchema.Encode(this.name, ...this.args)\n : this.parameterSchema.Encode(...this.args),\n },\n };\n return fullTransferParams;\n }\n}\n","import { Protocols } from '../constants';\nimport { Context } from '../context';\nimport { ContractAbstraction, ContractStorageType, DefaultWalletType } from '../contract';\nimport { ContractMethod } from '../contract/contract-methods/contract-method-flat-param';\nimport { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param';\nimport { OpKind, withKind } from '../operations/types';\nimport { OriginationWalletOperation } from './origination-operation';\nimport {\n WalletDelegateParams,\n WalletOriginateParams,\n WalletProvider,\n WalletTransferParams,\n} from './interface';\n\nimport { \n validateAddress,\n validateContractAddress,\n InvalidContractAddressError,\n InvalidAddressError, \n ValidationResult \n} from '@taquito/utils'\n\nexport interface PKHOption {\n forceRefetch?: boolean;\n}\n\nexport type WalletParamsWithKind =\n | withKind<WalletTransferParams, OpKind.TRANSACTION>\n | withKind<WalletOriginateParams, OpKind.ORIGINATION>\n | withKind<WalletDelegateParams, OpKind.DELEGATION>;\n\nexport class WalletOperationBatch {\n private operations: WalletParamsWithKind[] = [];\n\n constructor(private walletProvider: WalletProvider, private context: Context) {}\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withTransfer(params: WalletTransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`)\n }\n this.operations.push({ kind: OpKind.TRANSACTION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add a transaction operation to the batch\n *\n * @param params Transfer operation parameter\n */\n withContractCall(params: ContractMethod<Wallet> | ContractMethodObject<Wallet>) {\n return this.withTransfer(params.toTransferParams());\n }\n\n /**\n *\n * @description Add a delegation operation to the batch\n *\n * @param params Delegation operation parameter\n */\n withDelegation(params: WalletDelegateParams) {\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate address: ${params.delegate}`);\n }\n this.operations.push({ kind: OpKind.DELEGATION, ...params });\n return this;\n }\n\n /**\n *\n * @description Add an origination operation to the batch\n *\n * @param params Origination operation parameter\n */\n withOrigination<TWallet extends DefaultWalletType = DefaultWalletType>(params: WalletOriginateParams<ContractStorageType<TWallet>>) {\n this.operations.push({ kind: OpKind.ORIGINATION, ...params });\n return this;\n }\n\n private async mapOperation(param: WalletParamsWithKind) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n return this.walletProvider.mapTransferParamsToWalletParams(async () => param);\n case OpKind.ORIGINATION:\n return this.walletProvider.mapOriginateParamsToWalletParams(async () =>\n this.context.parser.prepareCodeOrigination({\n ...param,\n })\n );\n case OpKind.DELEGATION:\n return this.walletProvider.mapDelegateParamsToWalletParams(async () => param);\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n /**\n *\n * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array\n *\n * @param params Operations parameter\n */\n with(params: WalletParamsWithKind[]) {\n for (const param of params) {\n switch (param.kind) {\n case OpKind.TRANSACTION:\n this.withTransfer(param);\n break;\n case OpKind.ORIGINATION:\n this.withOrigination(param);\n break;\n case OpKind.DELEGATION:\n this.withDelegation(param);\n break;\n default:\n throw new Error(`Unsupported operation kind: ${(param as any).kind}`);\n }\n }\n\n return this;\n }\n\n /**\n *\n * @description Submit batch operation to wallet\n *\n */\n async send() {\n const ops: WalletParamsWithKind[] = [];\n\n for (const op of this.operations) {\n ops.push(await this.mapOperation(op));\n }\n\n const opHash = await this.walletProvider.sendOperations(ops);\n\n return this.context.operationFactory.createBatchOperation(opHash);\n }\n}\n\nexport class Wallet {\n constructor(private context: Context) {}\n\n private get walletProvider() {\n return this.context.walletProvider;\n }\n\n private _pkh?: string;\n\n /**\n * @description Retrieve the PKH of the account that is currently in use by the wallet\n *\n * @param option Option to use while fetching the PKH.\n * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet\n */\n async pkh({ forceRefetch }: PKHOption = {}) {\n if (!this._pkh || forceRefetch) {\n this._pkh = await this.walletProvider.getPKH();\n }\n\n return this._pkh;\n }\n\n private walletCommand = <T>(send: () => Promise<T>) => {\n return {\n send,\n };\n };\n\n /**\n *\n * @description Originate a new contract according to the script in parameters.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param originateParams Originate operation parameter\n */\n originate<TWallet extends DefaultWalletType = DefaultWalletType>(\n params: WalletOriginateParams<ContractStorageType<TWallet>>\n ): { send: () => Promise<OriginationWalletOperation<TWallet>> } {\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapOriginateParamsToWalletParams(() =>\n this.context.parser.prepareCodeOrigination({\n ...params as WalletOriginateParams,\n })\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n if (!this.context.proto) {\n this.context.proto = (await this.context.rpc.getBlock()).protocol as Protocols;\n }\n return this.context.operationFactory.createOriginationOperation(opHash) as Promise<OriginationWalletOperation<TWallet>>;\n });\n }\n\n /**\n *\n * @description Set the delegate for a contract.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param delegateParams operation parameter\n */\n setDelegate(params: WalletDelegateParams) {\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address error: ${params.delegate}`);\n }\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapDelegateParamsToWalletParams(\n async () => params\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createDelegationOperation(opHash);\n });\n }\n\n /**\n *\n * @description Register the current address as delegate.\n *\n * @returns An operation handle with the result from the rpc node\n *\n */\n registerDelegate() {\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapDelegateParamsToWalletParams(async () => {\n const delegate = await this.pkh();\n return { delegate };\n });\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createDelegationOperation(opHash);\n });\n }\n\n /**\n *\n * @description Transfer tezos tokens from current address to a specific address or call a smart contract.\n *\n * @returns A wallet command from which we can send the operation to the wallet\n *\n * @param params operation parameter\n */\n transfer(params: WalletTransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid 'to' address: ${params.to}`);\n }\n return this.walletCommand(async () => {\n const mappedParams = await this.walletProvider.mapTransferParamsToWalletParams(\n async () => params\n );\n const opHash = await this.walletProvider.sendOperations([mappedParams]);\n return this.context.operationFactory.createTransactionOperation(opHash);\n });\n }\n\n /**\n *\n * @description Create a batch of operation\n *\n * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch\n *\n * @param params List of operation to initialize the batch with\n */\n batch(params?: Parameters<WalletOperationBatch['with']>[0]) {\n const batch = new WalletOperationBatch(this.walletProvider, this.context);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n\n /**\n *\n * @description Create an smart contract abstraction for the address specified. Calling entrypoints with the returned\n * smart contract abstraction will leverage the wallet provider to make smart contract calls\n *\n * @param address Smart contract address\n */\n async at<T extends ContractAbstraction<Wallet>>(\n address: string,\n contractAbstractionComposer: (abs: ContractAbstraction<Wallet>, context: Context) => T = (x) =>\n x as any\n ): Promise<T> {\n if (validateContractAddress(address) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${address}`);\n }\n const rpc = this.context.withExtensions().rpc;\n const script = await rpc.getNormalizedScript(address);\n const entrypoints = await rpc.getEntrypoints(address);\n const blockHeader = await this.context.rpc.getBlockHeader();\n const chainId = blockHeader.chain_id;\n const abs = new ContractAbstraction(\n address,\n script,\n this,\n this.context.contract,\n entrypoints,\n chainId,\n rpc\n );\n return contractAbstractionComposer(abs, this.context);\n }\n}\n","import { Context } from '../context';\nimport { attachKind, OpKind } from '../operations/types';\nimport {\n WalletDelegateParams,\n WalletOriginateParams,\n WalletProvider,\n WalletTransferParams,\n} from './interface';\nimport { WalletParamsWithKind } from './wallet';\n\nexport class LegacyWalletProvider implements WalletProvider {\n constructor(private context: Context) {}\n\n async getPKH(): Promise<string> {\n return this.context.signer.publicKeyHash();\n }\n\n async mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>) {\n return attachKind(await params(), OpKind.TRANSACTION);\n }\n\n async mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>) {\n return attachKind(await params(), OpKind.ORIGINATION);\n }\n\n async mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>) {\n return attachKind(await params(), OpKind.DELEGATION);\n }\n\n async sendOperations(params: WalletParamsWithKind[]) {\n const op = await this.context.batch.batch(params as any).send();\n return op.hash;\n }\n}\n","import { TransactionOperation } from '../../operations/transaction-operation';\nimport { TransferParams } from '../../operations/types';\nimport { ContractProvider } from '../interface';\nimport { TransactionWalletOperation, Wallet } from '../../wallet';\nimport { ParameterSchema } from \"@taquito/michelson-encoder\";\nimport { ContractMethodInterface, ExplicitTransferParams, SendParams } from './contract-method-interface';\nimport { DEFAULT_SMART_CONTRACT_METHOD_NAME } from '../contract';\n\n/**\n * @description Utility class to send smart contract operation\n * The format for the arguments is the object representation\n */\nexport class ContractMethodObject<T extends ContractProvider | Wallet> implements ContractMethodInterface {\n constructor(\n private provider: T,\n private address: string,\n private parameterSchema: ParameterSchema,\n private name: string,\n private args: any = 'unit',\n private isMultipleEntrypoint = true,\n private isAnonymous = false\n ) { }\n\n /**\n * @description Get the signature of the smart contract method\n */\n getSignature() {\n return this.isAnonymous\n ? this.parameterSchema.ExtractSchema()[this.name]\n : this.parameterSchema.ExtractSchema();\n }\n\n /**\n *\n * @description Send the smart contract operation\n *\n * @param Options generic operation parameter\n */\n send(\n params: Partial<SendParams> = {}\n ): Promise<T extends Wallet ? TransactionWalletOperation : TransactionOperation> {\n if (this.provider instanceof Wallet) {\n return (this.provider as unknown as Wallet).transfer(this.toTransferParams(params)).send() as any;\n } else {\n return this.provider.transfer(this.toTransferParams(params)) as any;\n }\n }\n\n /**\n *\n * @description Create transfer params to be used with TezosToolkit.contract.transfer methods\n *\n * @param Options generic transfer operation parameters\n */\n toTransferParams({\n fee,\n gasLimit,\n storageLimit,\n source,\n amount = 0,\n mutez = false,\n }: Partial<SendParams> = {}): TransferParams {\n const fullTransferParams: ExplicitTransferParams = {\n to: this.address,\n amount,\n fee,\n mutez,\n source,\n gasLimit,\n storageLimit,\n parameter: {\n entrypoint: this.isMultipleEntrypoint ? this.name : DEFAULT_SMART_CONTRACT_METHOD_NAME,\n value: this.isAnonymous\n ? this.parameterSchema.EncodeObject({ [this.name]: this.args })\n : this.parameterSchema.EncodeObject(this.args),\n },\n };\n return fullTransferParams;\n }\n}","import { ViewSchema } from '@taquito/michelson-encoder';\nimport {\n MichelsonV1Expression,\n MichelsonV1ExpressionExtended,\n RpcClientInterface,\n RPCRunCodeParam,\n} from '@taquito/rpc';\nimport { validateAddress, ValidationResult } from '@taquito/utils';\nimport {\n InvalidViewSimulationContext,\n InvalidViewParameterError,\n ViewSimulationError,\n validateAndExtractFailwith,\n} from '../errors';\n\nconst runCodeHelper = (\n viewArgsType: MichelsonV1ExpressionExtended,\n viewReturnType: MichelsonV1ExpressionExtended,\n contractStorageType: MichelsonV1Expression,\n viewInstructions: MichelsonV1ExpressionExtended[],\n viewArgs: MichelsonV1Expression,\n contractStorageValue: MichelsonV1Expression,\n balance: string,\n chain_id: string,\n source?: string,\n amount = '0'\n): RPCRunCodeParam => {\n return {\n script: [\n { prim: 'parameter', args: [{ prim: 'pair', args: [viewArgsType, contractStorageType] }] },\n { prim: 'storage', args: [{ prim: 'option', args: [viewReturnType] }] },\n {\n prim: 'code',\n args: [\n [\n { prim: 'CAR' },\n viewInstructions,\n { prim: 'SOME' },\n { prim: 'NIL', args: [{ prim: 'operation' }] },\n { prim: 'PAIR' },\n ],\n ],\n },\n ],\n storage: { prim: 'None' },\n input: { prim: 'Pair', args: [viewArgs, contractStorageValue] },\n amount,\n balance,\n chain_id,\n source,\n };\n};\n\nexport interface ExecutionContextParams {\n source?: string;\n viewCaller: string;\n}\n\nexport class OnChainView {\n constructor(\n private _rpc: RpcClientInterface,\n private _contractAddress: string,\n private _smartContractViewSchema: ViewSchema,\n private _contractStorageType: MichelsonV1Expression,\n private _contractStorageValue: MichelsonV1Expression,\n private _args: any = 'Unit'\n ) {}\n\n /**\n * @description Get the signature of the smart contract view\n */\n getSignature() {\n return {\n parameter: this._smartContractViewSchema.extractArgsSchema(),\n result: this._smartContractViewSchema.extractResultSchema(),\n };\n }\n\n /**\n * @description Get the result of the view simulation\n * @param executionContext.source the public key hash of the account who initialized this view execution.\n * @param executionContext.viewCaller the contract address which is the caller of view.\n */\n async executeView(executionContext: ExecutionContextParams) {\n this.verifyContextExecution(executionContext);\n const balance = (await this._rpc.getBalance(this._contractAddress)).toString();\n const chainId = await this._rpc.getChainId();\n return this.executeViewAndDecodeResult(\n runCodeHelper(\n this._smartContractViewSchema.viewArgsType,\n this._smartContractViewSchema.viewReturnType,\n this._contractStorageType,\n this.adaptViewCodeToContext(\n this._smartContractViewSchema.instructions,\n executionContext.viewCaller,\n balance\n ),\n this.transformArgsToMichelson(),\n this._contractStorageValue,\n balance,\n chainId,\n executionContext.source\n )\n );\n }\n\n private verifyContextExecution(executionContext: ExecutionContextParams) {\n if (\n executionContext.source &&\n validateAddress(executionContext.source) !== ValidationResult.VALID\n ) {\n throw new InvalidViewSimulationContext(\n `The source account who initialized the view execution is invalid: ${executionContext.source}.`\n );\n }\n if (\n !executionContext.viewCaller ||\n validateAddress(executionContext.viewCaller) !== ValidationResult.VALID\n ) {\n throw new InvalidViewSimulationContext(\n `The contract which is the caller of view is invalid: ${executionContext.viewCaller}.`\n );\n }\n }\n\n private transformArgsToMichelson() {\n try {\n return this._smartContractViewSchema.encodeViewArgs(this._args);\n } catch (error) {\n throw new InvalidViewParameterError(\n this._smartContractViewSchema.viewName,\n this.getSignature(),\n this._args,\n error\n );\n }\n }\n /**\n * @description Loops through the view's instructions and replace BALANCE, SENDER, SELF_ADDRESS and AMOUNT with Michelson expressions that match the current context, if applicable.\n *\n * Certain specific instructions have different semantics in view:\n * BALANCE represents the current amount of mutez held by the contract where view is;\n * SENDER represents the contract which is the caller of view;\n * SELF_ADDRESS represents the contract where view is;\n * AMOUNT is always 0 mutez.\n *\n */\n private adaptViewCodeToContext(\n instructions: MichelsonV1ExpressionExtended[],\n viewCaller: string,\n contractBalance: string\n ) {\n const instructionsToReplace = {\n BALANCE: [{ prim: 'PUSH', args: [{ prim: 'mutez' }, { int: contractBalance }] }],\n SENDER: [{ prim: 'PUSH', args: [{ prim: 'address' }, { string: viewCaller }] }],\n SELF_ADDRESS: [\n { prim: 'PUSH', args: [{ prim: 'address' }, { string: this._contractAddress }] },\n ],\n AMOUNT: [{ prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] }],\n };\n\n instructions.forEach((inst: any, i: number) => {\n if (inst.prim in instructionsToReplace) {\n instructions[i] = Object(instructionsToReplace)[inst.prim];\n }\n if (inst.args && inst.args.length !== 0) {\n this.adaptViewCodeToContext(inst.args, viewCaller, contractBalance);\n } else if (Array.isArray(inst)) {\n this.adaptViewCodeToContext(inst, viewCaller, contractBalance);\n }\n });\n return instructions;\n }\n\n private async executeViewAndDecodeResult(viewScript: RPCRunCodeParam) {\n let storage: MichelsonV1ExpressionExtended;\n try {\n storage = (await this._rpc.runCode(viewScript)).storage as MichelsonV1ExpressionExtended;\n } catch (error: any) {\n const failWith = validateAndExtractFailwith(error);\n throw failWith\n ? new ViewSimulationError(\n `The simulation of the on-chain view named ${\n this._smartContractViewSchema.viewName\n } failed with: ${JSON.stringify(failWith)}`,\n this._smartContractViewSchema.viewName,\n failWith,\n error\n )\n : error;\n }\n if (!storage.args) {\n throw new ViewSimulationError(\n `View simulation failed with an invalid result: ${storage}`,\n this._smartContractViewSchema.viewName\n );\n }\n return this._smartContractViewSchema.decodeViewResult(storage.args[0]);\n }\n}\n","import { Wallet } from '../../wallet';\nimport { ContractProvider } from '../../contract';\nimport { ContractMethodObject } from './contract-method-object-param';\nimport { ContractMethod } from './contract-method-flat-param';\nimport { ParameterSchema, ViewSchema } from '@taquito/michelson-encoder';\nimport { RpcClientInterface, MichelsonV1Expression } from '@taquito/rpc';\nimport { OnChainView } from './contract-on-chain-view';\n\nexport class ContractMethodFactory<T extends ContractProvider | Wallet> {\n constructor(private provider: T, private contractAddress: string) {}\n\n createContractMethodFlatParams(\n smartContractMethodSchema: ParameterSchema,\n smartContractMethodName: string,\n args: any[],\n isMultipleEntrypoint = true,\n isAnonymous = false\n ) {\n return new ContractMethod<T>(\n this.provider,\n this.contractAddress,\n smartContractMethodSchema,\n smartContractMethodName,\n args,\n isMultipleEntrypoint,\n isAnonymous\n );\n }\n\n createContractMethodObjectParam(\n smartContractMethodSchema: ParameterSchema,\n smartContractMethodName: string,\n args: any[],\n isMultipleEntrypoint = true,\n isAnonymous = false\n ) {\n return new ContractMethodObject<T>(\n this.provider,\n this.contractAddress,\n smartContractMethodSchema,\n smartContractMethodName,\n args,\n isMultipleEntrypoint,\n isAnonymous\n );\n }\n\n createContractViewObjectParam(\n rpc: RpcClientInterface,\n smartContractViewSchema: ViewSchema,\n contractStorageType: MichelsonV1Expression,\n contractStorageValue: MichelsonV1Expression,\n viewArgs: any\n ) {\n return new OnChainView(\n rpc,\n this.contractAddress,\n smartContractViewSchema,\n contractStorageType,\n contractStorageValue,\n viewArgs\n );\n }\n}\n","import { MichelsonV1Expression } from '@taquito/rpc';\nimport { Contract, ContractAbstraction, WalletContract } from './contract';\nimport { TezosOperationError } from '../operations/operation-errors';\nimport { ContractProvider } from './interface';\nimport { Wallet } from '../wallet';\n\nexport default class LambdaView {\n public readonly voidLambda: object;\n\n constructor(\n private lambdaContract: Contract | WalletContract,\n private viewContract: ContractAbstraction<ContractProvider | Wallet>,\n public readonly viewMethod: string = 'default',\n private contractParameter: MichelsonV1Expression = { prim: 'Unit' }\n ) {\n this.voidLambda = this.createVoidLambda();\n }\n\n async execute(): Promise<any> {\n try {\n await this.lambdaContract.methods.default(this.voidLambda).send();\n } catch (ex) {\n if (ex instanceof TezosOperationError) {\n const lastError: any = ex.errors[ex.errors.length - 1];\n\n const failedWith = lastError.with;\n return failedWith;\n } else {\n throw ex;\n }\n }\n }\n\n private createVoidLambda(): object {\n const [parameter, callback] = this.getView();\n\n let contractArgs: MichelsonV1Expression[] = [\n {\n prim: 'pair',\n args: [parameter, { prim: 'contract', args: [callback] }],\n },\n ];\n\n if (this.viewMethod === 'default') {\n contractArgs = ([{ string: '%default' }] as MichelsonV1Expression[]).concat(contractArgs);\n }\n\n return [\n { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] },\n { prim: 'NONE', args: [{ prim: 'key_hash' }] },\n {\n prim: 'CREATE_CONTRACT',\n args: [\n [\n { prim: 'parameter', args: [callback] },\n { prim: 'storage', args: [{ prim: 'unit' }] },\n {\n prim: 'code',\n args: [[{ prim: 'CAR' }, { prim: 'FAILWITH' }]],\n },\n ],\n ],\n },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'LAMBDA',\n args: [\n {\n prim: 'pair',\n args: [{ prim: 'address' }, { prim: 'unit' }],\n },\n {\n prim: 'pair',\n args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }],\n },\n [\n { prim: 'CAR' },\n { prim: 'CONTRACT', args: [callback] },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'string' }, { string: `Callback type unmatched` }],\n },\n { prim: 'FAILWITH' },\n ],\n [],\n ],\n },\n {\n prim: 'PUSH',\n args: [parameter, this.contractParameter],\n },\n { prim: 'PAIR' },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'PUSH',\n args: [\n { prim: 'address' },\n { string: `${this.viewContract.address}%${this.viewMethod}` },\n ],\n },\n { prim: 'DUP' },\n { prim: 'CONTRACT', args: contractArgs },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [\n { prim: 'string' },\n { string: `Contract does not exist` },\n ],\n },\n { prim: 'FAILWITH' },\n ],\n [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }],\n ],\n },\n {\n prim: 'PUSH',\n args: [{ prim: 'mutez' }, { int: '0' }],\n },\n ],\n ],\n },\n { prim: 'TRANSFER_TOKENS' },\n {\n prim: 'DIP',\n args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]],\n },\n { prim: 'CONS' },\n { prim: 'DIP', args: [[{ prim: 'UNIT' }]] },\n { prim: 'PAIR' },\n ],\n ],\n },\n ],\n ],\n },\n { prim: 'APPLY' },\n {\n prim: 'DIP',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'address' }, { string: this.lambdaContract.address }],\n },\n { prim: 'DUP' },\n {\n prim: 'CONTRACT',\n args: [\n {\n prim: 'lambda',\n args: [\n { prim: 'unit' },\n {\n prim: 'pair',\n args: [\n { prim: 'list', args: [{ prim: 'operation' }] },\n { prim: 'unit' },\n ],\n },\n ],\n },\n ],\n },\n {\n prim: 'IF_NONE',\n args: [\n [\n {\n prim: 'PUSH',\n args: [{ prim: 'string' }, { string: `Contract does not exists` }],\n },\n { prim: 'FAILWITH' },\n ],\n [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }],\n ],\n },\n { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] },\n ],\n ],\n },\n { prim: 'TRANSFER_TOKENS' },\n {\n prim: 'DIP',\n args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]],\n },\n { prim: 'CONS' },\n ],\n ],\n },\n { prim: 'CONS' },\n { prim: 'DIP', args: [[{ prim: 'UNIT' }]] },\n { prim: 'PAIR' },\n ];\n }\n\n private getView(): [MichelsonV1Expression, MichelsonV1Expression] {\n const entrypoints = this.viewContract.entrypoints.entrypoints;\n const entrypoint = entrypoints[this.viewMethod] as MichelsonV1Expression;\n\n if (!entrypoint) {\n throw Error(\n `Contract at ${this.viewContract.address} does not have entrypoint: ${this.viewMethod}`\n );\n }\n\n if (!('prim' in entrypoint) || !entrypoint.args) {\n // TODO: Enhance this error message to be more descriptive\n throw Error('Entrypoint args undefined');\n }\n\n const args = Array.from(entrypoint.args) as [MichelsonV1Expression, MichelsonV1Expression];\n const [parameter, callbackContract] = args;\n if ('annots' in parameter) {\n delete parameter['annots'];\n }\n\n if (!('prim' in callbackContract) || !callbackContract.args) {\n // TODO: Enhance this error message to be more descriptive\n throw Error('Callback contract args undefined');\n }\n\n let message;\n if (entrypoint.prim !== 'pair') {\n message = `Expected {'prim': 'pair', ..} but found {'prim': ${entrypoint.prim}, ..}`;\n } else if (args.length !== 2) {\n message = `Expected an Array of length 2, but found: ${args}`;\n } else if (callbackContract.prim !== 'contract') {\n message = `Expected a {prim: 'contract', ...}, but found: ${callbackContract.prim}`;\n } else if (callbackContract.args && callbackContract.args.length !== 1) {\n message = `Expected a single argument to 'contract', but found: ${callbackContract.args}`;\n }\n\n if (message) throw Error(message);\n\n return [parameter, callbackContract.args[0]] as [MichelsonV1Expression, MichelsonV1Expression];\n }\n}\n","import { ParameterSchema, Schema, ViewSchema } from '@taquito/michelson-encoder';\nimport {\n EntrypointsResponse,\n MichelsonV1Expression,\n RpcClientInterface,\n ScriptResponse,\n} from '@taquito/rpc';\nimport { ChainIds, DefaultLambdaAddresses } from '../constants';\nimport { Wallet } from '../wallet';\nimport { ContractMethodFactory } from './contract-methods/contract-method-factory';\nimport { ContractMethod } from './contract-methods/contract-method-flat-param';\nimport { ContractMethodObject } from './contract-methods/contract-method-object-param';\nimport { OnChainView } from './contract-methods/contract-on-chain-view';\nimport { InvalidParameterError, UndefinedLambdaContractError } from './errors';\nimport { ContractProvider, StorageProvider } from './interface';\nimport LambdaView from './lambda-view';\n\nexport const DEFAULT_SMART_CONTRACT_METHOD_NAME = 'default';\n\n/**\n * @description Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method\n */\nexport class ContractView {\n constructor(\n private currentContract: ContractAbstraction<ContractProvider | Wallet>,\n private provider: ContractProvider,\n private name: string,\n private chainId: string,\n private callbackParametersSchema: ParameterSchema,\n private parameterSchema: ParameterSchema,\n private args: any[]\n ) {}\n\n /**\n *\n * @description Find which lambda contract to use based on the current network,\n * encode parameters to Michelson,\n * create an instance of Lambdaview to retrieve data, and\n * Decode Michelson response\n *\n * @param Options Address of a lambda contract (sandbox users)\n */\n async read(customLambdaAddress?: string) {\n let lambdaAddress;\n\n // TODO Verify if the 'customLambdaAdress' is a valid originated contract and if not, return an appropriate error message. \n if (customLambdaAddress) {\n lambdaAddress = customLambdaAddress;\n } else if (this.chainId === ChainIds.GRANADANET) {\n lambdaAddress = DefaultLambdaAddresses.GRANADANET;\n } else if (this.chainId === ChainIds.HANGZHOUNET) {\n lambdaAddress = DefaultLambdaAddresses.HANGZHOUNET;\n } else if (this.chainId === ChainIds.ITHACANET) {\n lambdaAddress = DefaultLambdaAddresses.ITHACANET;\n } else if (this.chainId === ChainIds.ITHACANET2) {\n lambdaAddress = DefaultLambdaAddresses.ITHACANET2;\n } else if (this.chainId === ChainIds.MAINNET) {\n lambdaAddress = DefaultLambdaAddresses.MAINNET;\n } else {\n throw new UndefinedLambdaContractError();\n }\n\n const lambdaContract = await this.provider.at(lambdaAddress);\n const arg = this.parameterSchema.Encode(...this.args);\n const lambdaView = new LambdaView(lambdaContract, this.currentContract, this.name, arg);\n const failedWith = await lambdaView.execute();\n const response = this.callbackParametersSchema.Execute(failedWith);\n return response;\n }\n}\n\nconst validateArgs = (args: any[], schema: ParameterSchema, name: string) => {\n const sigs = schema.ExtractSignatures();\n\n if (!sigs.find((x: any[]) => x.length === args.length)) {\n throw new InvalidParameterError(name, sigs, args);\n }\n};\n\n// lambda view tzip4\nconst isView = (entrypoint: MichelsonV1Expression): boolean => {\n let isView = false;\n if ('prim' in entrypoint && entrypoint.prim === 'pair' && entrypoint.args) {\n const lastElement = entrypoint.args[entrypoint.args.length - 1];\n if ('prim' in lastElement && lastElement.prim === 'contract') {\n isView = true;\n }\n }\n return isView;\n};\n\nexport type Contract = ContractAbstraction<ContractProvider>;\nexport type WalletContract = ContractAbstraction<Wallet>;\n\nconst isContractProvider = (variableToCheck: any): variableToCheck is ContractProvider =>\n variableToCheck.contractProviderTypeSymbol !== undefined;\n\n\ntype DefaultMethods<T extends ContractProvider | Wallet> = Record<string, (...args: any[]) => ContractMethod<T>>;\ntype DefaultMethodsObject<T extends ContractProvider | Wallet> = Record<string, (args?: any) => ContractMethodObject<T>>;\ntype DefaultViews = Record<string, (...args: any[]) => ContractView>;\ntype DefaultContractViews = Record<string, (args?: any) => OnChainView>;\ntype DefaultStorage = unknown; // Record<string, unknown>;\n\ntype PromiseReturnType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : any;\nexport type ContractStorageType<T extends ContractAbstraction<ContractProvider|Wallet>> = PromiseReturnType<T['storage']>;\nexport type DefaultContractType = ContractAbstraction<ContractProvider>;\nexport type DefaultWalletType = ContractAbstraction<Wallet>;\n\n/**\n * @description Smart contract abstraction\n */\nexport class ContractAbstraction<T extends ContractProvider | Wallet,\n TMethods extends DefaultMethods<T> = DefaultMethods<T>,\n TMethodsObject extends DefaultMethodsObject<T> = DefaultMethodsObject<T>,\n TViews extends DefaultViews = DefaultViews,\n TContractViews extends DefaultContractViews = DefaultContractViews,\n TStorage extends DefaultStorage = DefaultStorage\n> {\n private contractMethodFactory: ContractMethodFactory<T>;\n /**\n * @description Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods.\n * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number.\n *\n */\n public methods: TMethods = {} as TMethods;\n /**\n * @description Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods.\n * `methodsObject` serves the exact same purpose as the `methods` member. The difference is that it allows passing the parameter in an object format when calling the smart contract method (instead of the flattened representation)\n * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number.\n *\n */\n public methodsObject: TMethodsObject = {} as TMethodsObject;\n /**\n * @description Contains lamda views (tzip4) that are implemented by the target Tezos Smart Contract, and offers the user to call the lambda views as if they were native TS/JS methods.\n * NB: These are the view defined in the tzip4 standard, not the views introduced by the Hangzhou protocol.\n */\n public views: TViews = {} as TViews;\n /**\n * @description Contains on-chain views that are defined by the target Tezos Smart Contract, and offers the user to simulate the views execution as if they were native TS/JS methods.\n * NB: the expected format for the parameter when calling a smart contract view is the object format (same format as for the storage) and not the flattened representation.\n *\n */\n public contractViews: TContractViews = {} as TContractViews;\n\n public readonly schema: Schema;\n\n public readonly parameterSchema: ParameterSchema;\n public readonly viewSchema: ViewSchema[];\n\n constructor(\n public readonly address: string,\n public readonly script: ScriptResponse,\n provider: T,\n private storageProvider: StorageProvider,\n public readonly entrypoints: EntrypointsResponse,\n private chainId: string,\n rpc: RpcClientInterface\n ) {\n this.contractMethodFactory = new ContractMethodFactory(provider, address);\n this.schema = Schema.fromRPCResponse({ script: this.script });\n this.parameterSchema = ParameterSchema.fromRPCResponse({ script: this.script });\n\n this.viewSchema = ViewSchema.fromRPCResponse({ script: this.script });\n if (this.viewSchema.length !== 0) {\n this._initializeOnChainViews(this, rpc, this.viewSchema);\n }\n this._initializeMethods(this, provider, this.entrypoints.entrypoints, this.chainId);\n }\n\n private _initializeMethods(\n currentContract: ContractAbstraction<T>,\n provider: T,\n entrypoints: {\n [key: string]: object;\n },\n chainId: string\n ) {\n const parameterSchema = this.parameterSchema;\n const keys = Object.keys(entrypoints);\n if (parameterSchema.isMultipleEntryPoint) {\n keys.forEach((smartContractMethodName) => {\n const smartContractMethodSchema = new ParameterSchema(entrypoints[smartContractMethodName]);\n\n (this.methods as DefaultMethods<T>)[smartContractMethodName] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n smartContractMethodSchema,\n smartContractMethodName,\n args\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[smartContractMethodName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n smartContractMethodSchema,\n smartContractMethodName,\n args\n );\n };\n\n if (isContractProvider(provider)) {\n if (isView(entrypoints[smartContractMethodName])) {\n const view = function (...args: any[]) {\n const entrypointParamWithoutCallback = (entrypoints[smartContractMethodName] as any)\n .args[0];\n const smartContractMethodSchemaWithoutCallback = new ParameterSchema(\n entrypointParamWithoutCallback\n );\n const parametersCallback = (entrypoints[smartContractMethodName] as any).args[1]\n .args[0];\n const smartContractMethodCallbackSchema = new ParameterSchema(parametersCallback);\n\n validateArgs(args, smartContractMethodSchemaWithoutCallback, smartContractMethodName);\n return new ContractView(\n currentContract,\n provider,\n smartContractMethodName,\n chainId,\n smartContractMethodCallbackSchema,\n smartContractMethodSchemaWithoutCallback,\n args\n );\n };\n (this.views as DefaultViews)[smartContractMethodName] = view;\n }\n }\n });\n\n // Deal with methods with no annotations which were not discovered by the RPC endpoint\n // Methods with no annotations are discovered using parameter schema\n const anonymousMethods = Object.keys(parameterSchema.ExtractSchema()).filter(\n (key) => Object.keys(entrypoints).indexOf(key) === -1\n );\n\n anonymousMethods.forEach((smartContractMethodName) => {\n (this.methods as DefaultMethods<T>)[smartContractMethodName] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n parameterSchema,\n smartContractMethodName,\n args,\n false,\n true\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[smartContractMethodName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n parameterSchema,\n smartContractMethodName,\n args,\n false,\n true\n );\n };\n });\n } else {\n const smartContractMethodSchema = this.parameterSchema;\n (this.methods as DefaultMethods<T>)[DEFAULT_SMART_CONTRACT_METHOD_NAME] = function (...args: any[]) {\n return currentContract.contractMethodFactory.createContractMethodFlatParams(\n smartContractMethodSchema,\n DEFAULT_SMART_CONTRACT_METHOD_NAME,\n args,\n false\n );\n };\n\n (this.methodsObject as DefaultMethodsObject<T>)[DEFAULT_SMART_CONTRACT_METHOD_NAME] = function (args: any) {\n return currentContract.contractMethodFactory.createContractMethodObjectParam(\n smartContractMethodSchema,\n DEFAULT_SMART_CONTRACT_METHOD_NAME,\n args,\n false\n );\n };\n }\n }\n\n private _initializeOnChainViews(\n currentContract: ContractAbstraction<T>,\n rpc: RpcClientInterface,\n allContractViews: ViewSchema[]\n ) {\n const storageType = this.schema.val;\n const storageValue = this.script.storage;\n\n allContractViews.forEach((viewSchema) => {\n (this.contractViews as DefaultContractViews)[viewSchema.viewName] = function (args: any) {\n return currentContract.contractMethodFactory.createContractViewObjectParam(\n rpc,\n viewSchema,\n storageType,\n storageValue,\n args\n );\n };\n });\n }\n\n /**\n * @description Return a friendly representation of the smart contract storage\n */\n public storage<T extends TStorage = TStorage>() {\n return this.storageProvider.getStorage<T>(this.address, this.schema);\n }\n\n /**\n *\n * @description Return a friendly representation of the smart contract big map value\n *\n * @param key BigMap key to fetch\n *\n * @deprecated getBigMapKey has been deprecated in favor of getBigMapKeyByID\n *\n * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get\n */\n public bigMap(key: string) {\n return this.storageProvider.getBigMapKey(this.address, key, this.schema);\n }\n}\n","import { Schema, BigMapKeyType } from '@taquito/michelson-encoder';\nimport BigNumber from 'bignumber.js';\nimport { ContractProvider } from './interface';\nimport { HttpResponseError, STATUS_CODE } from '@taquito/http-utils';\n\nexport class BigMapAbstraction {\n constructor(private id: BigNumber, private schema: Schema, private provider: ContractProvider) {}\n\n /**\n *\n * @description Fetch one value in a big map\n *\n * @param keysToEncode Key to query (will be encoded properly according to the schema)\n * @param block optional block level to fetch the values from (head will be use by default)\n * @returns Return a well formatted json object of a big map value or undefined if the key is not found in the big map\n *\n */\n async get<T>(keyToEncode: BigMapKeyType, block?: number) {\n try {\n const id = await this.provider.getBigMapKeyByID<T>(\n this.id.toString(),\n keyToEncode,\n this.schema,\n block\n );\n return id;\n } catch (e) {\n if (e instanceof HttpResponseError && e.status === STATUS_CODE.NOT_FOUND) {\n return undefined;\n } else {\n throw e;\n }\n }\n }\n\n /**\n *\n * @description Fetch multiple values in a big map\n * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.\n * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.\n * If one of the keys does not exist in the big map, its value will be set to undefined.\n *\n * @param keysToEncode Array of keys to query (will be encoded properly according to the schema)\n * @param block optional block level to fetch the values from\n * @param batchSize optional batch size representing the number of requests to execute in parallel\n * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format\n *\n */\n async getMultipleValues<T>(keysToEncode: Array<BigMapKeyType>, block?: number, batchSize = 5) {\n return this.provider.getBigMapKeysByID<T>(\n this.id.toString(),\n keysToEncode,\n this.schema,\n block,\n batchSize\n );\n }\n\n toJSON() {\n return this.id.toString();\n }\n\n toString() {\n return this.id.toString();\n }\n}\n","import BigNumber from 'bignumber.js';\nimport { ContractProvider } from './interface';\n\nexport class SaplingStateAbstraction {\n constructor(private id: BigNumber, private provider: ContractProvider) { }\n\n /**\n *\n * @description Fetch the sapling state\n * \n * @param block optional block level to fetch the values from (head will be use by default)\n * @returns Return a json object of the sapling_state\n *\n */\n async getSaplingDiff(block?: number) {\n return this.provider.getSaplingDiffByID(this.id.toString(), block);\n }\n\n getId() {\n return this.id.toString();\n }\n}\n","import { Schema, Semantic } from '@taquito/michelson-encoder';\nimport { BigMapAbstraction } from './big-map';\nimport { ContractProvider } from './interface';\nimport BigNumber from 'bignumber.js';\nimport { MichelsonV1Expression } from '@taquito/rpc';\nimport { SaplingStateAbstraction } from './sapling-state-abstraction';\n\n// Override the default michelson encoder semantic to provide richer abstraction over storage properties\nexport const smartContractAbstractionSemantic: (p: ContractProvider) => Semantic = (\n provider: ContractProvider\n) => ({\n // Provide a specific abstraction for BigMaps\n big_map: (val: MichelsonV1Expression, code: MichelsonV1Expression) => {\n if (!val || !('int' in val) || val.int === undefined) {\n // Return an empty object in case of missing big map ID\n return {};\n } else {\n const schema = new Schema(code);\n return new BigMapAbstraction(new BigNumber(val.int), schema, provider);\n }\n },\n sapling_state: (val: MichelsonV1Expression) => {\n if (!val || !('int' in val) || val.int === undefined) {\n // Return an empty object in case of missing sapling state ID\n return {};\n } else {\n return new SaplingStateAbstraction(new BigNumber(val.int), provider);\n }\n }\n /*\n // TODO: embed useful other abstractions\n 'contract': () => {},\n 'address': () => {}\n */\n});\n","import { HttpResponseError, STATUS_CODE } from '@taquito/http-utils';\nimport { BigMapKeyType, MichelsonMap, MichelsonMapKey, Schema } from '@taquito/michelson-encoder';\nimport { OpKind, ScriptResponse } from '@taquito/rpc';\nimport { encodeExpr } from '@taquito/utils';\nimport { OperationBatch } from '../batch/rpc-batch-provider';\nimport { Context } from '../context';\nimport { DelegateOperation } from '../operations/delegate-operation';\nimport { OperationEmitter } from '../operations/operation-emitter';\nimport { OriginationOperation } from '../operations/origination-operation';\nimport { RegisterGlobalConstantOperation } from '../operations/register-global-constant-operation';\nimport { RevealOperation } from '../operations/reveal-operation';\nimport { TransactionOperation } from '../operations/transaction-operation';\nimport {\n DelegateParams,\n isOpRequireReveal,\n OriginateParams,\n ParamsWithKind,\n RegisterDelegateParams,\n RegisterGlobalConstantParams,\n RevealParams,\n RPCOperation,\n TransferParams,\n withKind,\n} from '../operations/types';\nimport { DefaultContractType, ContractStorageType, ContractAbstraction } from './contract';\nimport { InvalidDelegationSource } from './errors';\nimport { ContractProvider, ContractSchema, EstimationProvider, StorageProvider } from './interface';\nimport {\n createOriginationOperation,\n createRegisterDelegateOperation,\n createRegisterGlobalConstantOperation,\n createRevealOperation,\n createSetDelegateOperation,\n createTransferOperation,\n} from './prepare';\nimport { smartContractAbstractionSemantic } from './semantic';\nimport { \n validateAddress,\n validateContractAddress,\n InvalidContractAddressError,\n InvalidAddressError, \n ValidationResult \n} from '@taquito/utils';\nexport class RpcContractProvider\n extends OperationEmitter\n implements ContractProvider, StorageProvider\n{\n constructor(context: Context, private estimator: EstimationProvider) {\n super(context);\n }\n contractProviderTypeSymbol = Symbol.for('taquito--provider-type-symbol');\n\n /**\n *\n * @description Return a well formatted json object of the contract storage\n *\n * @param contract contract address you want to get the storage from\n * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema\n *\n * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script\n */\n async getStorage<T>(contract: string, schema?: ContractSchema): Promise<T> {\n if (validateContractAddress(contract) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${contract}`);\n }\n if (!schema) {\n schema = await this.rpc.getNormalizedScript(contract);\n }\n\n let contractSchema: Schema;\n if (Schema.isSchema(schema)) {\n contractSchema = schema;\n } else {\n contractSchema = Schema.fromRPCResponse({ script: schema as ScriptResponse });\n }\n\n const storage = await this.rpc.getStorage(contract);\n\n return contractSchema.Execute(storage, smartContractAbstractionSemantic(this)) as T; // Cast into T because only the caller can know the true type of the storage\n }\n\n /**\n *\n * @description Return a well formatted json object of the contract big map storage\n *\n * @param contract contract address you want to get the storage from\n * @param key contract big map key to fetch value from\n * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema\n *\n * @deprecated Deprecated in favor of getBigMapKeyByID\n *\n * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get\n */\n async getBigMapKey<T>(contract: string, key: string, schema?: ContractSchema): Promise<T> {\n if (validateContractAddress(contract) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${contract}`);\n }\n if (!schema) {\n schema = await this.rpc.getNormalizedScript(contract);\n }\n\n let contractSchema: Schema;\n if (Schema.isSchema(schema)) {\n contractSchema = schema;\n } else {\n contractSchema = Schema.fromRPCResponse({ script: schema as ScriptResponse });\n }\n\n const encodedKey = contractSchema.EncodeBigMapKey(key);\n\n const val = await this.rpc.getBigMapKey(contract, encodedKey);\n\n return contractSchema.ExecuteOnBigMapValue(val) as T; // Cast into T because only the caller can know the true type of the storage\n }\n\n /**\n *\n * @description Return a well formatted json object of a big map value\n *\n * @param id Big Map ID\n * @param keyToEncode key to query (will be encoded properly according to the schema)\n * @param schema Big Map schema (can be determined using your contract type)\n * @param block optional block level to fetch the values from\n *\n * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr\n */\n async getBigMapKeyByID<T>(\n id: string,\n keyToEncode: BigMapKeyType,\n schema: Schema,\n block?: number\n ): Promise<T> {\n const { key, type } = schema.EncodeBigMapKey(keyToEncode);\n const { packed } = await this.context.packer.packData({ data: key, type });\n\n const encodedExpr = encodeExpr(packed);\n\n const bigMapValue = block\n ? await this.context.rpc.getBigMapExpr(id.toString(), encodedExpr, { block: String(block) })\n : await this.context.rpc.getBigMapExpr(id.toString(), encodedExpr);\n\n return schema.ExecuteOnBigMapValue(bigMapValue, smartContractAbstractionSemantic(this)) as T;\n }\n\n /**\n *\n * @description Fetch multiple values in a big map\n * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.\n * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.\n * If one of the keys does not exist in the big map, its value will be set to undefined.\n *\n * @param id Big Map ID\n * @param keys Array of keys to query (will be encoded properly according to the schema)\n * @param schema Big Map schema (can be determined using your contract type)\n * @param block optional block level to fetch the values from\n * @param batchSize optional batch size representing the number of requests to execute in parallel\n * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format\n *\n */\n async getBigMapKeysByID<T>(\n id: string,\n keys: Array<BigMapKeyType>,\n schema: Schema,\n block?: number,\n batchSize = 5\n ): Promise<MichelsonMap<MichelsonMapKey, T | undefined>> {\n const level = await this.getBlockForRequest(keys, block);\n const bigMapValues = new MichelsonMap<MichelsonMapKey, T | undefined>();\n\n // Execute batch of promises in series\n let position = 0;\n let results: Array<T | undefined> = [];\n\n while (position < keys.length) {\n const keysBatch = keys.slice(position, position + batchSize);\n const batch = keysBatch.map((keyToEncode) =>\n this.getBigMapValueOrUndefined<T>(keyToEncode, id, schema, level)\n );\n results = [...results, ...(await Promise.all(batch))];\n position += batchSize;\n }\n\n for (let i = 0; i < results.length; i++) {\n bigMapValues.set(keys[i], results[i]);\n }\n\n return bigMapValues;\n }\n\n private async getBlockForRequest(keys: Array<BigMapKeyType>, block?: number) {\n return keys.length === 1 || typeof block !== 'undefined'\n ? block\n : (await this.rpc.getBlock())?.header.level;\n }\n\n private async getBigMapValueOrUndefined<T>(\n keyToEncode: BigMapKeyType,\n id: string,\n schema: Schema,\n level?: number\n ) {\n try {\n return await this.getBigMapKeyByID<T>(id, keyToEncode, schema, level);\n } catch (ex) {\n if (ex instanceof HttpResponseError && ex.status === STATUS_CODE.NOT_FOUND) {\n return;\n } else {\n throw ex;\n }\n }\n }\n\n /**\n *\n * @description Return a well formatted json object of a sapling state\n *\n * @param id Sapling state ID\n * @param block optional block level to fetch the value from\n *\n */\n async getSaplingDiffByID(id: string, block?: number) {\n const saplingState = block\n ? await this.context.rpc.getSaplingDiffById(id.toString(), { block: String(block) })\n : await this.context.rpc.getSaplingDiffById(id.toString());\n return saplingState;\n }\n\n private async addRevealOperationIfNeeded(operation: RPCOperation, publicKeyHash: string) {\n if (isOpRequireReveal(operation)) {\n const ops: RPCOperation[] = [operation];\n const publicKey = await this.signer.publicKey();\n const estimateReveal = await this.estimator.reveal();\n if (estimateReveal) {\n const reveal: withKind<RevealParams, OpKind.REVEAL> = { kind: OpKind.REVEAL };\n const estimatedReveal = await this.estimate(reveal, async () => estimateReveal);\n ops.unshift(await createRevealOperation({ ...estimatedReveal }, publicKeyHash, publicKey));\n return ops;\n }\n }\n return operation;\n }\n\n /**\n *\n * @description Originate a new contract according to the script in parameters. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @warn You cannot specify storage and init at the same time (use init to pass the raw michelson representation of storage)\n *\n * @param OriginationOperation Originate operation parameter\n */\n async originate<TContract extends DefaultContractType = DefaultContractType>(params: OriginateParams<ContractStorageType<TContract>>) {\n const estimate = await this.estimate(params, this.estimator.originate.bind(this.estimator));\n\n const publicKeyHash = await this.signer.publicKeyHash();\n const operation = await createOriginationOperation(\n await this.context.parser.prepareCodeOrigination({\n ...params,\n ...estimate,\n })\n );\n const ops = await this.addRevealOperationIfNeeded(operation, publicKeyHash);\n const preparedOrigination = await this.prepareOperation({\n operation: ops,\n source: publicKeyHash,\n });\n const forgedOrigination = await this.forge(preparedOrigination);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(forgedOrigination);\n return new OriginationOperation<TContract>(hash, operation, forgedBytes, opResponse, context, this);\n }\n\n /**\n *\n * @description Set the delegate for a contract. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param SetDelegate operation parameter\n */\n async setDelegate(params: DelegateParams) {\n if ( params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid source Address: ${params.source}`);\n }\n if (params.delegate && validateAddress(params.delegate) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid delegate Address: ${params.delegate}`);\n }\n\n // Since babylon delegation source cannot smart contract\n if (/kt1/i.test(params.source)) {\n throw new InvalidDelegationSource(params.source);\n }\n\n const estimate = await this.estimate(params, this.estimator.setDelegate.bind(this.estimator));\n const publicKeyHash = await this.signer.publicKeyHash();\n const operation = await createSetDelegateOperation({ ...params, ...estimate });\n const sourceOrDefault = params.source || publicKeyHash;\n const ops = await this.addRevealOperationIfNeeded(operation, publicKeyHash);\n const prepared = await this.prepareOperation({\n operation: ops,\n source: sourceOrDefault,\n });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new DelegateOperation(\n hash,\n operation,\n sourceOrDefault,\n forgedBytes,\n opResponse,\n context\n );\n }\n\n /**\n *\n * @description Register the current address as delegate. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param RegisterDelegate operation parameter\n */\n async registerDelegate(params: RegisterDelegateParams) {\n const estimate = await this.estimate(\n params,\n this.estimator.registerDelegate.bind(this.estimator)\n );\n const source = await this.signer.publicKeyHash();\n const operation = await createRegisterDelegateOperation({ ...params, ...estimate }, source);\n const ops = await this.addRevealOperationIfNeeded(operation, source);\n const prepared = await this.prepareOperation({ operation: ops });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new DelegateOperation(hash, operation, source, forgedBytes, opResponse, context);\n }\n\n /**\n *\n * @description Transfer tz from current address to a specific address. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param Transfer operation parameter\n */\n async transfer(params: TransferParams) {\n if (validateAddress(params.to) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address passed in 'to' parameter: ${params.to}`);\n }\n if (params.source && validateAddress(params.source) !== ValidationResult.VALID) {\n throw new InvalidAddressError(`Invalid address passed in 'source' parameter: ${params.source}`);\n }\n\n const publickKeyHash = await this.signer.publicKeyHash();\n const estimate = await this.estimate(params, this.estimator.transfer.bind(this.estimator));\n const operation = await createTransferOperation({\n ...params,\n ...estimate,\n });\n const source = params.source || publickKeyHash;\n const ops = await this.addRevealOperationIfNeeded(operation, publickKeyHash);\n const prepared = await this.prepareOperation({ operation: ops, source: params.source });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new TransactionOperation(hash, operation, source, forgedBytes, opResponse, context);\n }\n\n /**\n *\n * @description Reveal the current address. Will throw an error if the address is already revealed.\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param RevealParams operation parameter\n */\n async reveal(params: RevealParams) {\n const publicKeyHash = await this.signer.publicKeyHash();\n const estimateReveal = await this.estimator.reveal(params);\n if (estimateReveal) {\n const estimated = await this.estimate(params, async () => estimateReveal);\n const operation = await createRevealOperation(\n {\n ...estimated,\n },\n publicKeyHash,\n await this.signer.publicKey()\n );\n const prepared = await this.prepareOperation({ operation, source: publicKeyHash });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new RevealOperation(hash, operation, publicKeyHash, forgedBytes, opResponse, context);\n } else {\n throw new Error('The current address is already revealed.');\n }\n }\n\n /**\n *\n * @description Register a Micheline expression in a global table of constants. Will sign and inject an operation using the current context\n *\n * @returns An operation handle with the result from the rpc node\n *\n * @param params registerGlobalConstant operation parameter\n */\n async registerGlobalConstant(params: RegisterGlobalConstantParams) {\n const publickKeyHash = await this.signer.publicKeyHash();\n const estimate = await this.estimate(\n params,\n this.estimator.registerGlobalConstant.bind(this.estimator)\n );\n const operation = await createRegisterGlobalConstantOperation({\n ...params,\n ...estimate,\n });\n const ops = await this.addRevealOperationIfNeeded(operation, publickKeyHash);\n const prepared = await this.prepareOperation({ operation: ops, source: publickKeyHash });\n const opBytes = await this.forge(prepared);\n const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);\n return new RegisterGlobalConstantOperation(\n hash,\n operation,\n publickKeyHash,\n forgedBytes,\n opResponse,\n context\n );\n }\n\n async at<T extends DefaultContractType = DefaultContractType>(\n address: string,\n contractAbstractionComposer: ContractAbstractionComposer<T> = (x) => x as any\n ): Promise<T> {\n if (validateContractAddress(address) !== ValidationResult.VALID) {\n throw new InvalidContractAddressError(`Invalid contract address: ${address}`);\n }\n const rpc = this.context.withExtensions().rpc;\n const script = await rpc.getNormalizedScript(address);\n const entrypoints = await rpc.getEntrypoints(address);\n const blockHeader = await this.rpc.getBlockHeader();\n const chainId = blockHeader.chain_id;\n const abs = new ContractAbstraction(address, script, this, this, entrypoints, chainId, rpc);\n return contractAbstractionComposer(abs, this.context);\n }\n\n /**\n *\n * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch\n *\n * @returns A batch object from which we can add more operation or send a command to execute the batch\n *\n * @param params List of operation to batch together\n */\n batch(params?: ParamsWithKind[]) {\n const batch = new OperationBatch(this.context, this.estimator);\n\n if (Array.isArray(params)) {\n batch.with(params);\n }\n\n return batch;\n }\n}\n\ntype ContractAbstractionComposer<T> = (\n abs: ContractAbstraction<ContractProvider>,\n context: Context\n) => T;\n","import { Context } from '../context';\nimport { ParserProvider } from './interface';\nimport { Expr, GlobalConstantHashAndValue, Parser, Prim, ProtocolID } from '@taquito/michel-codec';\nimport { OriginateParams } from '../operations/types';\nimport { InvalidInitParameter, InvalidCodeParameter } from '../contract/errors';\nimport { Schema } from '@taquito/michelson-encoder';\nimport { MichelsonV1Expression } from '@taquito/rpc';\n\nexport class MichelCodecParser implements ParserProvider {\n constructor(private context: Context) {}\n\n private async getNextProto(): Promise<ProtocolID> {\n const { next_protocol } = await this.context.rpc.getBlockMetadata();\n return next_protocol as ProtocolID;\n }\n\n async parseScript(src: string): Promise<Expr[] | null> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseScript(src);\n }\n\n async parseMichelineExpression(src: string): Promise<Expr | null> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseMichelineExpression(src);\n }\n\n async parseJSON(src: object): Promise<Expr> {\n const parser = new Parser({ protocol: await this.getNextProto() });\n return parser.parseJSON(src);\n }\n\n async prepareCodeOrigination(params: OriginateParams): Promise<OriginateParams> {\n const parsedParams = params;\n parsedParams.code = await this.formatCodeParam(params.code);\n if (params.init) {\n parsedParams.init = await this.formatInitParam(params.init);\n } else if (params.storage) {\n const storageType = (parsedParams.code as Expr[]).find(\n (p): p is Prim => 'prim' in p && p.prim === 'storage'\n );\n if (!storageType?.args) {\n throw new InvalidCodeParameter(\n 'The storage section is missing from the script',\n params.code\n );\n }\n const schema = new Schema(storageType.args[0] as MichelsonV1Expression);\n const globalconstantsHashAndValue = await this.findGlobalConstantsHashAndValue(schema);\n\n if (Object.keys(globalconstantsHashAndValue).length !== 0) {\n // If there are global constants in the storage part of the contract code,\n // they need to be locally expanded in order to encode the storage arguments\n const p = new Parser({ expandGlobalConstant: globalconstantsHashAndValue });\n const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);\n const schemaNoGlobalConst = new Schema(storageTypeNoGlobalConst);\n parsedParams.init = schemaNoGlobalConst.Encode(params.storage);\n } else {\n parsedParams.init = schema.Encode(params.storage);\n }\n delete parsedParams.storage;\n }\n return parsedParams;\n }\n\n private async formatCodeParam(code: string | object[]) {\n let parsedCode: Expr[];\n if (typeof code === 'string') {\n const c = await this.parseScript(code);\n if (c === null) {\n throw new InvalidCodeParameter('Invalid code parameter', code);\n }\n parsedCode = c;\n } else {\n const c = await this.parseJSON(code);\n const order = ['parameter', 'storage', 'code'];\n // Ensure correct ordering for RPC\n parsedCode = (c as Prim[]).sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));\n }\n return parsedCode;\n }\n\n private async formatInitParam(init: string | object) {\n let parsedInit: Expr;\n if (typeof init === 'string') {\n const c = await this.parseMichelineExpression(init);\n if (c === null) {\n throw new InvalidInitParameter('Invalid init parameter', init);\n }\n parsedInit = c;\n } else {\n parsedInit = await this.parseJSON(init);\n }\n return parsedInit;\n }\n\n private async findGlobalConstantsHashAndValue(schema: Schema) {\n const globalConstantTokens = schema.findToken('constant');\n const globalConstantsHashAndValue: GlobalConstantHashAndValue = {};\n\n if (globalConstantTokens.length !== 0) {\n for (const token of globalConstantTokens) {\n const tokenArgs = token.tokenVal.args;\n if (tokenArgs) {\n const hash: string = tokenArgs[0]['string'];\n const michelineValue = await this.context.globalConstantsProvider.getGlobalConstantByHash(\n hash\n );\n Object.assign(globalConstantsHashAndValue, {\n [hash]: michelineValue,\n });\n }\n }\n }\n return globalConstantsHashAndValue;\n }\n}\n","import { Packer } from './interface';\nimport { Context } from '../context';\nimport { PackDataParams, PackDataResponse } from '@taquito/rpc';\n\nexport class RpcPacker implements Packer {\n constructor(private context: Context) {}\n \n async packData(data: PackDataParams): Promise<PackDataResponse> {\n return this.context.rpc.packData(data);\n }\n}\n","export class GlobalConstantNotFound extends Error {\n name = 'GlobalConstantNotFound';\n\n constructor(public hash: string) {\n super(\n `Please load the value associated with the constant ${hash} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`\n );\n }\n}\n\nexport class UnconfiguredGlobalConstantsProviderError extends Error {\n name = 'UnconfiguredGlobalConstantsProviderError';\n\n constructor() {\n super(\n 'No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance.'\n );\n }\n}\n","import { Expr } from \"@taquito/michel-codec\";\nimport { UnconfiguredGlobalConstantsProviderError } from \"./error\";\nimport { GlobalConstantHash, GlobalConstantsProvider } from \"./interface-global-constants-provider\";\n\nexport class NoopGlobalConstantsProvider implements GlobalConstantsProvider {\n async getGlobalConstantByHash(_hash: GlobalConstantHash): Promise<Expr> {\n throw new UnconfiguredGlobalConstantsProviderError();\n }\n}","import { RpcClient, RpcClientInterface } from '@taquito/rpc';\nimport { Protocols } from './constants';\nimport { Forger } from './forger/interface';\nimport { RpcForger } from './forger/rpc-forger';\nimport { Injector } from './injector/interface';\nimport { RpcInjector } from './injector/rpc-injector';\nimport { Signer } from './signer/interface';\nimport { NoopSigner } from './signer/noop';\nimport { OperationFactory } from './wallet/operation-factory';\nimport { RpcTzProvider } from './tz/rpc-tz-provider';\nimport { RPCEstimateProvider } from './contract/rpc-estimate-provider';\nimport { RpcContractProvider } from './contract/rpc-contract-provider';\nimport { RPCBatchProvider } from './batch/rpc-batch-provider';\n\nimport { Wallet, LegacyWalletProvider, WalletProvider } from './wallet';\nimport { ParserProvider } from './parser/interface';\nimport { MichelCodecParser } from './parser/michel-codec-parser';\nimport { Packer } from './packer/interface';\nimport { RpcPacker } from './packer/rpc-packer';\nimport BigNumber from 'bignumber.js';\nimport { retry } from 'rxjs/operators';\nimport { BehaviorSubject, OperatorFunction } from 'rxjs';\nimport { GlobalConstantsProvider } from './global-constants/interface-global-constants-provider';\nimport { NoopGlobalConstantsProvider } from './global-constants/noop-global-constants-provider';\n\nexport interface TaquitoProvider<T, K extends Array<any>> {\n new (context: Context, ...rest: K): T;\n}\n\nexport interface ConfigConfirmation {\n confirmationPollingIntervalSecond?: number;\n confirmationPollingTimeoutSecond: number;\n defaultConfirmationCount: number;\n}\n\nexport const defaultConfigConfirmation: ConfigConfirmation = {\n defaultConfirmationCount: 1,\n confirmationPollingTimeoutSecond: 180,\n};\n\n// The shouldObservableSubscriptionRetry parameter is related to the observable in ObservableSubsription class.\n// When set to true, the observable won't die when getBlock rpc call fails; the error will be reported via the error callback,\n// and it will continue to poll for new blocks.\nexport interface ConfigStreamer {\n streamerPollingIntervalMilliseconds: number;\n shouldObservableSubscriptionRetry: boolean;\n observableSubscriptionRetryFunction: OperatorFunction<any, any>;\n}\n\nexport const defaultConfigStreamer: ConfigStreamer = {\n streamerPollingIntervalMilliseconds: 20000,\n shouldObservableSubscriptionRetry: false,\n observableSubscriptionRetryFunction: retry(),\n};\n\n/**\n * @description Encapsulate common service used throughout different part of the library\n */\nexport class Context {\n private _rpcClient: RpcClientInterface;\n private _forger: Forger;\n private _parser: ParserProvider;\n private _injector: Injector;\n private _walletProvider: WalletProvider;\n public readonly operationFactory: OperationFactory;\n private _packer: Packer;\n private providerDecorator: Array<(context: Context) => Context> = [];\n private _globalConstantsProvider: GlobalConstantsProvider;\n public readonly tz = new RpcTzProvider(this);\n public readonly estimate = new RPCEstimateProvider(this);\n public readonly contract = new RpcContractProvider(this, this.estimate);\n public readonly batch = new RPCBatchProvider(this, this.estimate);\n public readonly wallet = new Wallet(this);\n\n constructor(\n private _rpc: RpcClientInterface | string,\n private _signer: Signer = new NoopSigner(),\n private _proto?: Protocols,\n public readonly _config = new BehaviorSubject({\n ...defaultConfigStreamer,\n ...defaultConfigConfirmation,\n }),\n forger?: Forger,\n injector?: Injector,\n packer?: Packer,\n wallet?: WalletProvider,\n parser?: ParserProvider,\n globalConstantsProvider?: GlobalConstantsProvider\n ) {\n if (typeof this._rpc === 'string') {\n this._rpcClient = new RpcClient(this._rpc);\n } else {\n this._rpcClient = this._rpc;\n }\n this._forger = forger ? forger : new RpcForger(this);\n this._injector = injector ? injector : new RpcInjector(this);\n this.operationFactory = new OperationFactory(this);\n this._walletProvider = wallet ? wallet : new LegacyWalletProvider(this);\n this._parser = parser ? parser : new MichelCodecParser(this);\n this._packer = packer ? packer : new RpcPacker(this);\n this._globalConstantsProvider = globalConstantsProvider\n ? globalConstantsProvider\n : new NoopGlobalConstantsProvider();\n }\n\n get config(): ConfigConfirmation & ConfigStreamer {\n return this._config.getValue();\n }\n\n set config(value: ConfigConfirmation & ConfigStreamer) {\n this._config.next({\n ...value,\n });\n }\n\n setPartialConfig(value: Partial<ConfigConfirmation> & Partial<ConfigStreamer>) {\n this._config.next({\n ...this._config.getValue(),\n ...value,\n });\n }\n\n get rpc(): RpcClientInterface {\n return this._rpcClient;\n }\n\n set rpc(value: RpcClientInterface) {\n this._rpcClient = value;\n }\n\n get injector() {\n return this._injector;\n }\n\n set injector(value: Injector) {\n this._injector = value;\n }\n\n get forger() {\n return this._forger;\n }\n\n set forger(value: Forger) {\n this._forger = value;\n }\n\n get signer() {\n return this._signer;\n }\n\n set signer(value: Signer) {\n this._signer = value;\n }\n\n get walletProvider() {\n return this._walletProvider;\n }\n\n set walletProvider(value: WalletProvider) {\n this._walletProvider = value;\n }\n\n set proto(value: Protocols | undefined) {\n this._proto = value;\n }\n\n get proto() {\n return this._proto;\n }\n\n get parser() {\n return this._parser;\n }\n\n set parser(value: ParserProvider) {\n this._parser = value;\n }\n\n get packer() {\n return this._packer;\n }\n\n set packer(value: Packer) {\n this._packer = value;\n }\n\n get globalConstantsProvider() {\n return this._globalConstantsProvider;\n }\n\n set globalConstantsProvider(value: GlobalConstantsProvider) {\n this._globalConstantsProvider = value;\n }\n\n async isAnyProtocolActive(protocol: string[] = []) {\n if (this._proto) {\n return protocol.includes(this._proto);\n } else {\n const { next_protocol } = await this.rpc.getBlockMetadata();\n return protocol.includes(next_protocol);\n }\n }\n\n async getConfirmationPollingInterval() {\n // Granada will generally halve the time between blocks, from 60 seconds to 30 seconds (mainnet).\n // We reduce the default value in the same proportion, from 10 to 5.\n const defaultInterval = 5;\n try {\n const constants = await this.rpc.getConstants();\n let blockTime = constants.time_between_blocks[0];\n if (constants.minimal_block_delay !== undefined) {\n blockTime = constants.minimal_block_delay;\n }\n let confirmationPollingInterval = BigNumber.sum(\n blockTime,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n new BigNumber(constants.delay_per_missing_endorsement!).multipliedBy(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n Math.max(0, constants.initial_endorsers! - constants.endorsers_per_block)\n )\n );\n\n // Divide the polling interval by a constant 3\n // to improvise for polling time to work in prod,\n // testnet and sandbox enviornment.\n confirmationPollingInterval = confirmationPollingInterval.dividedBy(3);\n\n this.config.confirmationPollingIntervalSecond =\n confirmationPollingInterval.toNumber() === 0 ? 0.1 : confirmationPollingInterval.toNumber();\n return this.config.confirmationPollingIntervalSecond;\n } catch (exception) {\n // Return default value if there is\n // an issue returning from constants\n // file.\n return defaultInterval;\n }\n }\n\n /**\n * @description Create a copy of the current context. Useful when you have long running operation and you do not want a context change to affect the operation\n */\n clone(): Context {\n return new Context(\n this.rpc,\n this.signer,\n this.proto,\n this._config,\n this.forger,\n this._injector,\n this.packer\n );\n }\n\n /**\n * @description Allows extensions set on the TezosToolkit to inject logic into the context\n */\n registerProviderDecorator(fx: (context: Context) => Context) {\n this.providerDecorator.push(fx);\n }\n\n /**\n * @description Applies the decorators on a cloned instance of the context and returned this cloned instance.\n * The decorators are functions that inject logic into the context.\n * They are provided by the extensions set on the TezosToolkit by calling the registerProviderDecorator method.\n */\n withExtensions = (): Context => {\n let clonedContext = this.clone();\n this.providerDecorator.forEach((decorator) => {\n clonedContext = decorator(clonedContext);\n });\n\n return clonedContext;\n };\n}\n","import { OpFilter, FilterExpression, Filter, OpHashFilter, SourceFilter, KindFilter, DestinationFilter, OperationContent } from './interface';\n\nconst opHashFilter = (op: OperationContent, filter: OpHashFilter) => op.hash === filter.opHash;\n\nconst sourceFilter = (x: OperationContent, filter: SourceFilter) => {\n switch (x.kind) {\n case 'endorsement':\n return 'metadata' in x && x.metadata.delegate === filter.source\n case 'activate_account':\n return 'metadata' in x && x.pkh === filter.source\n default:\n return 'source' in x && x.source === filter.source\n }\n}\n\nconst kindFilter = (x: OperationContent, filter: KindFilter) => 'kind' in x && x.kind === filter.kind;\n\nconst destinationFilter = (x: OperationContent, filter: DestinationFilter) => {\n switch (x.kind) {\n case 'delegation':\n return x.delegate === filter.destination;\n case 'origination':\n if (\n 'metadata' in x &&\n 'operation_result' in x.metadata &&\n 'originated_contracts' in x.metadata.operation_result &&\n Array.isArray(x.metadata.operation_result.originated_contracts)\n ) {\n return x.metadata.operation_result.originated_contracts.some(\n contract => contract === filter.destination\n );\n }\n break;\n case 'transaction':\n return x.destination === filter.destination;\n default:\n return false;\n }\n};\n\nexport const evaluateOpFilter = (op: OperationContent, filter: OpFilter) => {\n if ('opHash' in filter) {\n return opHashFilter(op, filter);\n } else if ('source' in filter) {\n return sourceFilter(op, filter)\n } else if ('kind' in filter) {\n return kindFilter(op, filter);\n } else if ('destination' in filter) {\n return destinationFilter(op, filter)\n }\n\n return false;\n};\n\nexport const evaluateExpression = (op: OperationContent, exp: FilterExpression): boolean => {\n if (Array.isArray(exp.and)) {\n return exp.and.every((x: OpFilter | FilterExpression) => evaluateFilter(op, x));\n } else if (Array.isArray(exp.or)) {\n return exp.or.some((x: OpFilter | FilterExpression) => evaluateFilter(op, x));\n } else {\n throw new Error('Filter expression must contains either and/or property');\n }\n};\n\nexport const evaluateFilter = (op: OperationContent, filter: Filter): boolean => {\n const filters: OpFilter[] | FilterExpression[] = [];\n if (!Array.isArray(filter)) {\n filters.push(filter as any);\n } else {\n filters.push(...(filter as any));\n }\n\n return (filters as any[]).every((filterOrExp: OpFilter | FilterExpression) => {\n if ('and' in filterOrExp || 'or' in filterOrExp) {\n return evaluateExpression(op, filterOrExp);\n } else {\n return evaluateOpFilter(op, filterOrExp as OpFilter);\n }\n });\n};\n","/* eslint-disable no-dupe-class-members */\nimport { Observable, Subject, NEVER, OperatorFunction } from 'rxjs';\nimport { Subscription } from './interface';\nimport { takeUntil, tap, catchError, retry } from 'rxjs/operators';\n\nexport class ObservableSubscription<T> implements Subscription<T> {\n private errorListeners: Array<(error: Error) => void> = [];\n private messageListeners: Array<(data: T) => void> = [];\n private closeListeners: Array<() => void> = [];\n private completed$ = new Subject();\n\n constructor(\n obs: Observable<T>,\n private shouldRetry: boolean = false,\n private operatorFunction: OperatorFunction<T, T> = retry<T>()\n ) {\n obs\n .pipe(\n takeUntil(this.completed$),\n tap(\n (data: T) => {\n this.call(this.messageListeners, data);\n },\n (error) => {\n this.call(this.errorListeners, error);\n },\n () => {\n this.call(this.closeListeners);\n }\n ),\n this.shouldRetry ? operatorFunction : tap(),\n catchError(() => NEVER)\n )\n .subscribe();\n }\n\n private call<K>(listeners: Array<(val: K) => void>, value?: K) {\n for (const l of listeners) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n l(value!);\n } catch (ex) {\n console.error(ex);\n }\n }\n }\n\n private remove(listeners: Array<any>, value: any) {\n const idx = listeners.indexOf(value);\n if (idx !== -1) {\n listeners.splice(idx, 1);\n }\n }\n\n public on(type: 'error', cb: (error: Error) => void): void;\n public on(type: 'data', cb: (data: T) => void): void;\n public on(type: 'close', cb: () => void): void;\n\n public on(type: 'data' | 'error' | 'close', cb: any): void {\n switch (type) {\n case 'data':\n this.messageListeners.push(cb);\n break;\n case 'error':\n this.errorListeners.push(cb);\n break;\n case 'close':\n this.closeListeners.push(cb);\n break;\n default:\n throw new Error(`Trying to register on an unsupported event: ${type}`);\n }\n }\n\n public off(type: 'error', cb: (error: Error) => void): void;\n public off(type: 'data', cb: (data: T) => void): void;\n public off(type: 'close', cb: () => void): void;\n\n public off(type: 'data' | 'error' | 'close', cb: any): void {\n switch (type) {\n case 'data':\n this.remove(this.messageListeners, cb);\n break;\n case 'error':\n this.remove(this.errorListeners, cb);\n break;\n case 'close':\n this.remove(this.closeListeners, cb);\n break;\n default:\n throw new Error(`Trying to unregister on an unsupported event: ${type}`);\n }\n }\n\n public close() {\n this.completed$.next();\n }\n}\n","import { BlockResponse } from '@taquito/rpc';\nimport { from, Observable, ObservableInput, timer } from 'rxjs';\nimport {\n concatMap,\n distinctUntilKeyChanged,\n first,\n map,\n pluck,\n publish,\n refCount,\n switchMap,\n} from 'rxjs/operators';\nimport { Context } from '../context';\nimport { evaluateFilter } from './filters';\nimport { Filter, SubscribeProvider, Subscription, OperationContent } from './interface';\nimport { ObservableSubscription } from './observable-subscription';\n\nconst getLastBlock = (context: Context) => {\n return from(context.rpc.getBlock()).pipe(first());\n};\n\nconst applyFilter = (filter: Filter) =>\n concatMap<BlockResponse, ObservableInput<OperationContent>>(block => {\n return new Observable<OperationContent>(sub => {\n for (const ops of block.operations) {\n for (const op of ops) {\n for (const content of op.contents) {\n if (evaluateFilter({hash: op.hash, ...content}, filter)) {\n sub.next({hash: op.hash, ...content});\n }\n }\n }\n }\n sub.complete();\n });\n });\n\nexport class PollingSubscribeProvider implements SubscribeProvider {\n // Map the changing polling interval to a timer, which will automatically terminate the previous timer when the next one starts.\n private timer$ = this.context._config.pipe(\n switchMap((val) => timer(0, val.streamerPollingIntervalMilliseconds)),\n )\n\n private newBlock$ = this.timer$.pipe(\n map(() => this.context),\n switchMap(getLastBlock),\n distinctUntilKeyChanged('hash'),\n publish(),\n refCount()\n );\n\n constructor(private context: Context) { }\n\n subscribe(_filter: 'head'): Subscription<string> {\n return new ObservableSubscription(this.newBlock$.pipe(pluck('hash')), \n this.context.config.shouldObservableSubscriptionRetry,\n this.context.config.observableSubscriptionRetryFunction);\n }\n\n subscribeOperation(filter: Filter): Subscription<OperationContent> {\n return new ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)),\n this.context.config.shouldObservableSubscriptionRetry,\n this.context.config.observableSubscriptionRetryFunction);\n }\n}\n","\n// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!\nexport const VERSION = {\n \"commitHash\": \"81f0a5b103f867f57fbe5d526315c375a3788346\",\n \"version\": \"11.2.0\"\n};\n","import { Forger, ForgeParams, ForgeResponse } from './interface';\n\nexport class ForgingMismatchError extends Error {\n name = 'ForgingMismatchError';\n constructor(public results: string[]) {\n super('Forging mismatch error');\n }\n}\n\nexport class CompositeForger implements Forger {\n constructor(private forgers: Forger[]) {\n if (forgers.length === 0) {\n throw new Error('At least one forger must be specified');\n }\n }\n\n async forge({ branch, contents }: ForgeParams): Promise<ForgeResponse> {\n const results = await Promise.all(\n this.forgers.map((forger) => {\n return forger.forge({ branch, contents });\n })\n );\n\n if (results.length === 0) {\n throw new Error('At least one forger must be specified');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n let lastResult: string = results.pop()!; // Assumed to be more than one since we\n while (results.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const currentResult = results.pop()!;\n\n if (currentResult !== lastResult) {\n throw new ForgingMismatchError([lastResult, currentResult]);\n }\n lastResult = currentResult;\n }\n\n return lastResult;\n }\n}\n","import { OriginateParams } from \"../operations/types\";\nimport { ParserProvider } from \"./interface\";\n\nexport class NoopParser implements ParserProvider {\n async prepareCodeOrigination(params: OriginateParams): Promise<OriginateParams> {\n return params;\n }\n}","import { Packer } from './interface';\nimport { packDataBytes, MichelsonData, MichelsonType } from '@taquito/michel-codec'\nimport { PackDataResponse, PackDataParams } from '@taquito/rpc';\n\nexport class MichelCodecPacker implements Packer {\n\n async packData(data: PackDataParams): Promise<PackDataResponse> {\n const { bytes } = packDataBytes(data.data as MichelsonData, data.type as MichelsonType);\n return { packed: bytes }\n }\n}\n","import { GlobalConstantHashAndValue } from '@taquito/michel-codec';\nimport { GlobalConstantNotFound } from './error';\nimport { GlobalConstantHash, GlobalConstantsProvider } from './interface-global-constants-provider';\n\nexport class DefaultGlobalConstantsProvider implements GlobalConstantsProvider {\n private _globalConstantsLibrary: GlobalConstantHashAndValue = {};\n\n /**\n *\n * @description Allows to load global constant hashes and their corresponding Michelson JSON values\n */\n loadGlobalConstant(globalConstant: GlobalConstantHashAndValue) {\n for (const hash in globalConstant) {\n Object.assign(this._globalConstantsLibrary, {\n [hash]: globalConstant[hash],\n });\n }\n }\n\n /**\n *\n * @description Retrieve the Michelson value of a global constant based on its hash\n *\n * @param hash a string representing the global constant hash\n * @returns Expr, the JSON Michelson value\n */\n async getGlobalConstantByHash(hash: GlobalConstantHash) {\n const value = this._globalConstantsLibrary[hash];\n if (!value) {\n throw new GlobalConstantNotFound(hash);\n }\n return value;\n }\n}\n","/**\n * @packageDocumentation\n * @module @taquito/taquito\n */\n\nimport { RpcClient, RpcClientInterface } from '@taquito/rpc';\nimport { RPCBatchProvider } from './batch/rpc-batch-provider';\nimport { Protocols } from './constants';\nimport { ConfigConfirmation, ConfigStreamer, Context, TaquitoProvider } from './context';\nimport { ContractProvider, EstimationProvider } from './contract/interface';\nimport { Extension } from './extension/extension';\nimport { Forger } from './forger/interface';\nimport { RpcForger } from './forger/rpc-forger';\nimport { format } from './format';\nimport { GlobalConstantsProvider } from './global-constants/interface-global-constants-provider';\nimport { NoopGlobalConstantsProvider } from './global-constants/noop-global-constants-provider';\nimport { Packer } from './packer/interface';\nimport { RpcPacker } from './packer/rpc-packer';\nimport { Signer } from './signer/interface';\nimport { NoopSigner } from './signer/noop';\nimport { SubscribeProvider } from './subscribe/interface';\nimport { PollingSubscribeProvider } from './subscribe/polling-provider';\nimport { TzProvider } from './tz/interface';\nimport { VERSION } from './version';\nimport { LegacyWalletProvider, Wallet, WalletProvider } from './wallet';\nimport { OperationFactory } from './wallet/operation-factory';\n\nexport { MichelsonMap, UnitValue } from '@taquito/michelson-encoder';\nexport * from './constants';\nexport * from './context';\nexport { TaquitoProvider } from './context';\nexport * from './contract';\nexport * from './contract/big-map';\nexport { CompositeForger } from './forger/composite-forger';\nexport * from './forger/interface';\nexport { RpcForger } from './forger/rpc-forger';\nexport * from './operations';\nexport { OperationBatch } from './batch/rpc-batch-provider';\nexport * from './signer/interface';\nexport * from './subscribe/interface';\nexport { SubscribeProvider } from './subscribe/interface';\nexport { PollingSubscribeProvider } from './subscribe/polling-provider';\nexport { ObservableSubscription } from './subscribe/observable-subscription';\nexport * from './tz/interface';\nexport * from './wallet';\nexport { Extension } from './extension/extension';\nexport * from './parser/interface';\nexport * from './parser/michel-codec-parser';\nexport * from './parser/noop-parser';\nexport * from './packer/interface';\nexport * from './packer/michel-codec-packer';\nexport * from './packer/rpc-packer';\nexport * from './global-constants/default-global-constants-provider';\nexport * from './global-constants/error';\nexport * from './global-constants/interface-global-constants-provider';\n\nexport interface SetProviderOptions {\n forger?: Forger;\n wallet?: WalletProvider;\n rpc?: string | RpcClientInterface;\n stream?: string | SubscribeProvider;\n signer?: Signer;\n protocol?: Protocols;\n config?: Partial<ConfigConfirmation> & Partial<ConfigStreamer>;\n packer?: Packer;\n globalConstantsProvider?: GlobalConstantsProvider;\n}\n\nexport interface VersionInfo {\n commitHash: string;\n version: string;\n}\n\n/**\n * @description Facade class that surfaces all of the libraries capability and allow it's configuration\n *\n * @param _rpc The RPC server to use\n */\nexport class TezosToolkit {\n private _stream!: SubscribeProvider;\n private _options: SetProviderOptions = {};\n private _rpcClient: RpcClientInterface;\n private _wallet: Wallet;\n private _context: Context;\n /**\n * @deprecated TezosToolkit.batch has been deprecated in favor of TezosToolkit.contract.batch\n *\n */\n public batch: RPCBatchProvider['batch'];\n\n public readonly format = format;\n\n constructor(private _rpc: RpcClientInterface | string) {\n if (typeof this._rpc === 'string') {\n this._rpcClient = new RpcClient(this._rpc);\n } else {\n this._rpcClient = this._rpc;\n }\n this._context = new Context(_rpc);\n this._wallet = new Wallet(this._context);\n this.setProvider({ rpc: this._rpcClient });\n this.batch = this._context.batch.batch.bind(this._context.batch);\n }\n\n /**\n * @description Sets configuration on the Tezos Taquito instance. Allows user to choose which signer, rpc client, rpc url, forger and so forth\n *\n * @param options rpc url or rpcClient to use to interact with the Tezos network\n *\n * @example Tezos.setProvider({rpc: 'https://mainnet.api.tez.ie/', signer: new InMemorySigner.fromSecretKey(“edsk...”)})\n * @example Tezos.setProvider({ config: { confirmationPollingTimeoutSecond: 300 }})\n *\n */\n\n setProvider({\n rpc,\n stream,\n signer,\n protocol,\n config,\n forger,\n wallet,\n packer,\n globalConstantsProvider,\n }: SetProviderOptions) {\n this.setRpcProvider(rpc);\n this.setStreamProvider(stream);\n this.setSignerProvider(signer);\n this.setForgerProvider(forger);\n this.setWalletProvider(wallet);\n this.setPackerProvider(packer);\n this.setGlobalConstantsProvider(globalConstantsProvider);\n\n this._context.proto = protocol;\n if (config) {\n this._context.setPartialConfig(config);\n }\n }\n\n /**\n * @description Sets signer provider on the Tezos Taquito instance.\n *\n * @param options signer to use to interact with the Tezos network\n *\n * @example Tezos.setSignerProvider(new InMemorySigner.fromSecretKey('edsk...'))\n *\n */\n setSignerProvider(signer?: SetProviderOptions['signer']) {\n if (!this._options.signer && typeof signer === 'undefined') {\n this._context.signer = new NoopSigner();\n this._options.signer = signer;\n } else if (typeof signer !== 'undefined') {\n this._context.signer = signer;\n this._options.signer = signer;\n }\n }\n\n /**\n * @description Sets rpc provider on the Tezos Taquito instance\n *\n * @param options rpc url or rpcClient to use to interact with the Tezos network\n *\n * @example Tezos.setRpcProvider('https://mainnet.api.tez.ie/')\n *\n */\n setRpcProvider(rpc?: SetProviderOptions['rpc']) {\n if (typeof rpc === 'string') {\n this._rpcClient = new RpcClient(rpc);\n } else if (rpc === undefined) {\n // do nothing, RPC is required in the constructor, do not override it\n } else {\n this._rpcClient = rpc;\n }\n this._options.rpc = this._rpcClient;\n this._context.rpc = this._rpcClient;\n }\n\n /**\n * @description Sets forger provider on the Tezos Taquito instance\n *\n * @param options forger to use to interact with the Tezos network\n *\n * @example Tezos.setForgerProvider(localForger)\n *\n */\n setForgerProvider(forger?: SetProviderOptions['forger']) {\n const f = typeof forger === 'undefined' ? this.getFactory(RpcForger)() : forger;\n this._options.forger = f;\n this._context.forger = f;\n }\n\n /**\n * @description Sets stream provider on the Tezos Taquito instance\n *\n * @param options stream to use to interact with the Tezos network\n *\n * @example Tezos.setStreamProvider(...)\n *\n */\n setStreamProvider(stream?: SetProviderOptions['stream']) {\n if (typeof stream === 'string') {\n this._stream = new PollingSubscribeProvider(new Context(new RpcClient(stream)));\n } else if (typeof stream !== 'undefined') {\n this._stream = stream;\n } else if (this._options.stream === undefined) {\n this._stream = this.getFactory(PollingSubscribeProvider)();\n }\n this._options.stream = stream;\n }\n\n /**\n * @description Sets wallet provider on the Tezos Taquito instance\n *\n * @param options wallet to use to interact with the Tezos network\n *\n * @example Tezos.setWalletProvider(...)\n *\n */\n setWalletProvider(wallet?: SetProviderOptions['wallet']) {\n if (!this._options.wallet && typeof wallet === 'undefined') {\n const w = this.getFactory(LegacyWalletProvider)();\n this._options.wallet = w;\n this._context.walletProvider = w;\n } else if (typeof wallet !== 'undefined') {\n this._options.wallet = wallet;\n this._context.walletProvider = wallet;\n }\n }\n\n /**\n * @description Sets Packer provider on the Tezos Taquito instance\n *\n * @param options packer to use to interact with the Tezos network\n *\n * @example Tezos.setPackerProvider(new MichelCodecPacker())\n *\n */\n setPackerProvider(packer?: SetProviderOptions['packer']) {\n const p = typeof packer === 'undefined' ? this.getFactory(RpcPacker)() : packer;\n this._options.packer = p;\n this._context.packer = p;\n }\n\n /**\n * @description Sets global constants provider on the Tezos Taquito instance\n *\n * @param options globalConstantsProvider to use to interact with the Tezos network\n *\n * @example\n * ```\n * const globalConst = new DefaultGlobalConstantsProvider();\n * globalConst.loadGlobalConstant({\n * \"expruu5BTdW7ajqJ9XPTF3kgcV78pRiaBW3Gq31mgp3WSYjjUBYxre\": { prim: \"int\" },\n * // ...\n * })\n * Tezos.setGlobalConstantsProvider(globalConst);\n * ```\n *\n */\n setGlobalConstantsProvider(\n globalConstantsProvider?: SetProviderOptions['globalConstantsProvider']\n ) {\n const g =\n typeof globalConstantsProvider === 'undefined'\n ? new NoopGlobalConstantsProvider()\n : globalConstantsProvider;\n this._options.globalConstantsProvider = g;\n this._context.globalConstantsProvider = g;\n }\n\n /**\n * @description Provide access to tezos account management\n */\n get tz(): TzProvider {\n return this._context.tz;\n }\n\n /**\n * @description Provide access to smart contract utilities\n */\n get contract(): ContractProvider {\n return this._context.contract;\n }\n\n get wallet(): Wallet {\n return this._wallet;\n }\n\n get operation(): OperationFactory {\n return this._context.operationFactory;\n }\n\n /**\n * @description Provide access to operation estimation utilities\n */\n get estimate(): EstimationProvider {\n return this._context.estimate;\n }\n\n /**\n * @description Provide access to streaming utilities backed by an streamer implementation\n */\n get stream(): SubscribeProvider {\n return this._stream;\n }\n\n /**\n * @description Provide access to the currently used rpc client\n */\n get rpc(): RpcClientInterface {\n return this._context.rpc;\n }\n\n /**\n * @description Provide access to the currently used signer\n */\n get signer() {\n return this._context.signer;\n }\n\n /**\n * @description Provide access to the currently used globalConstantsProvider\n */\n get globalConstants() {\n return this._context.globalConstantsProvider;\n }\n\n /**\n * @description Allow to add a module to the TezosToolkit instance. This method adds the appropriate Providers(s) required by the module to the internal context.\n *\n * @param module extension to add to the TezosToolkit instance\n *\n * @example Tezos.addExtension(new Tzip16Module());\n */\n addExtension(module: Extension | Extension[]) {\n if (Array.isArray(module)) {\n module.forEach((extension) => extension.configureContext(this._context));\n } else {\n module.configureContext(this._context);\n }\n }\n\n getFactory<T, K extends Array<any>>(ctor: TaquitoProvider<T, K>) {\n return (...args: K) => {\n return new ctor(this._context, ...args);\n };\n }\n\n /**\n * @description Gets an object containing the version of Taquito library and git sha of the commit this library is compiled from\n */\n getVersionInfo(): VersionInfo {\n return VERSION;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGa,SAAS;IACpB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;KAAI;IAExC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAe;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;KAC/D;;;MCLU,WAAW;IACtB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;KAAI;IACxC,MAAM,CAAC,oBAA4B;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;KAC/D;;;MCLU,uBAAwB,SAAQ,KAAK;IAGhD;QACE,KAAK,CACH,qHAAqH,CACtH,CAAC;QALJ,SAAI,GAAG,yBAAyB,CAAC;KAMhC;CACF;AAED;;;MAGa,UAAU;IACf,SAAS;;YACb,MAAM,IAAI,uBAAuB,EAAE,CAAC;SACrC;KAAA;IACK,aAAa;;YACjB,MAAM,IAAI,uBAAuB,EAAE,CAAC;SACrC;KAAA;IACK,SAAS;;YACb,MAAM,IAAI,uBAAuB,EAAE,CAAC;SACrC;KAAA;IACK,IAAI,CAAC,MAAc,EAAE,UAAuB;;YAChD,MAAM,IAAI,uBAAuB,EAAE,CAAC;SACrC;KAAA;;;IC3BS;AAAZ,WAAY,iBAAiB;IAC3B,yEAAkB,CAAA;IAClB,2EAAmB,CAAA;IACnB,qEAAgB,CAAA;IAChB,gEAAa,CAAA;AACf,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;IACW;AAAZ,WAAY,WAAW;IACrB,4DAAiB,CAAA;IACjB,+DAAmB,C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