Socket
Socket
Sign inDemoInstall

@taquito/taquito

Package Overview
Dependencies
46
Maintainers
6
Versions
190
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 19.2.1-beta.0 to 20.0.0-beta.0

2

dist/lib/constants.js

@@ -74,2 +74,3 @@ "use strict";

Protocols["ProxfordY"] = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH";
Protocols["PtParisBQ"] = "PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz";
Protocols["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";

@@ -113,2 +114,3 @@ })(Protocols || (exports.Protocols = Protocols = {}));

ChainIds["OXFORDNET2"] = "NetXxWsskGahzQB";
ChainIds["PARISNET"] = "NetXo8SqH1c38SS";
})(ChainIds || (exports.ChainIds = ChainIds = {}));

@@ -115,0 +117,0 @@ // A fixed fee reveal operation gasLimit accepted by both simulate and injection endpoint is between 1.2-5 times of actual gas consumption (3.5 fails occasionally with gas exhausted; 4 fails occasionally with fee too low)

@@ -307,2 +307,108 @@ "use strict";

*
* @description Stake a given amount for the source address
*
* @returns An operation handle with the result from the rpc node
*
* @param Stake pseudo-operation parameter
*/
stake(params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_a = params.source) !== null && _a !== void 0 ? _a : '');
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(params.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!params.to) {
params.to = params.source;
}
if (params.to && params.to !== params.source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
if (params.amount < 0) {
throw new core_1.InvalidAmountError(params.amount.toString());
}
const publicKeyHash = yield this.signer.publicKeyHash();
const estimate = yield this.estimate(params, this.estimator.stake.bind(this.estimator));
const source = params.source || publicKeyHash;
const prepared = yield this.prepare.stake(Object.assign(Object.assign({}, params), estimate));
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
const opBytes = yield this.forge(prepared);
const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes);
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
});
}
/**
*
* @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
* Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
* the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
*
* @returns An operation handle with the result from the rpc node
*
* @param Unstake pseudo-operation parameter
*/
unstake(params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_a = params.source) !== null && _a !== void 0 ? _a : '');
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(params.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!params.to) {
params.to = params.source;
}
if (params.to && params.to !== params.source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
if (params.amount < 0) {
throw new core_1.InvalidAmountError(params.amount.toString());
}
const publicKeyHash = yield this.signer.publicKeyHash();
const estimate = yield this.estimate(params, this.estimator.unstake.bind(this.estimator));
const source = params.source || publicKeyHash;
const prepared = yield this.prepare.unstake(Object.assign(Object.assign({}, params), estimate));
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
const opBytes = yield this.forge(prepared);
const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes);
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
});
}
/**
*
* @description Transfer all the finalizable unstaked funds of the source to their liquid balance
* @returns An operation handle with the result from the rpc node
*
* @param Finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_a = params.source) !== null && _a !== void 0 ? _a : '');
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(params.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!params.to) {
params.to = params.source;
}
if (params.to && params.to !== params.source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
if (!params.amount) {
params.amount = 0;
}
if (params.amount !== undefined && params.amount > 0) {
throw new core_1.InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.');
}
const publicKeyHash = yield this.signer.publicKeyHash();
const estimate = yield this.estimate(params, this.estimator.finalizeUnstake.bind(this.estimator));
const source = params.source || publicKeyHash;
const prepared = yield this.prepare.finalizeUnstake(Object.assign(Object.assign({}, params), estimate));
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
const opBytes = yield this.forge(prepared);
const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes);
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
});
}
/**
*
* @description Transfer Tickets to a smart contract address

@@ -309,0 +415,0 @@ *

@@ -183,2 +183,116 @@ "use strict";

*
* @description Estimate gasLimit, storageLimit and fees for an stake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Stake pseudo-operation parameter
*/
stake(_a) {
var _b;
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_b = rest.source) !== null && _b !== void 0 ? _b : '');
if (rest.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(rest.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!rest.to) {
rest.to = rest.source;
}
if (rest.to && rest.to !== rest.source) {
throw new core_1.InvalidStakingAddressError(rest.to);
}
if (rest.amount < 0) {
throw new core_1.InvalidAmountError(rest.amount.toString());
}
const preparedOperation = yield this.prepare.stake(Object.assign({ fee,
storageLimit,
gasLimit }, rest));
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
estimateProperties.shift();
estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2;
}
return estimate_1.Estimate.createEstimateInstanceFromProperties(estimateProperties);
});
}
/**
*
* @description Estimate gasLimit, storageLimit and fees for an Unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Unstake pseudo-operation parameter
*/
unstake(_a) {
var _b;
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_b = rest.source) !== null && _b !== void 0 ? _b : '');
if (rest.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(rest.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!rest.to) {
rest.to = rest.source;
}
if (rest.to && rest.to !== rest.source) {
throw new core_1.InvalidStakingAddressError(rest.to);
}
if (rest.amount < 0) {
throw new core_1.InvalidAmountError(rest.amount.toString());
}
const preparedOperation = yield this.prepare.unstake(Object.assign({ fee,
storageLimit,
gasLimit }, rest));
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
estimateProperties.shift();
estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2;
}
return estimate_1.Estimate.createEstimateInstanceFromProperties(estimateProperties);
});
}
/**
*
* @description Estimate gasLimit, storageLimit and fees for an finalize_unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(_a) {
var _b;
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const sourceValidation = (0, utils_1.validateAddress)((_b = rest.source) !== null && _b !== void 0 ? _b : '');
if (rest.source && sourceValidation !== utils_1.ValidationResult.VALID) {
throw new core_1.InvalidAddressError(rest.source, (0, utils_1.invalidDetail)(sourceValidation));
}
if (!rest.to) {
rest.to = rest.source;
}
if (rest.to && rest.to !== rest.source) {
throw new core_1.InvalidStakingAddressError(rest.to);
}
if (!rest.amount) {
rest.amount = 0;
}
if (rest.amount !== undefined && rest.amount !== 0) {
throw new Error('Amount must be 0 for finalize_unstake operation');
}
const preparedOperation = yield this.prepare.finalizeUnstake(Object.assign({ fee,
storageLimit,
gasLimit }, rest));
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
estimateProperties.shift();
estimateProperties[0].opSize -= this.OP_SIZE_REVEAL / 2;
}
return estimate_1.Estimate.createEstimateInstanceFromProperties(estimateProperties);
});
}
/**
*
* @description Estimate gasLimit, storageLimit and fees for a transferTicket operation

@@ -185,0 +299,0 @@ *

@@ -319,2 +319,106 @@ "use strict";

*
* @description Method to prepare a stake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
stake(_a) {
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const { pkh } = yield this.getKeys();
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
const op = yield (0, contract_1.createTransferOperation)(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: pkh }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
entrypoint: 'stake',
value: {
prim: 'Unit',
},
} }));
const operation = yield this.addRevealOperationIfNeeded(op, pkh);
const ops = this.convertIntoArray(operation);
const hash = yield this.getBlockHash();
const protocol = yield this.getProtocolHash();
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
const headCounter = parseInt(yield this.getHeadCounter(pkh), 10);
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
return {
opOb: {
branch: hash,
contents,
protocol,
},
counter: headCounter,
};
});
}
/**
*
* @description Method to prepare a unstake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
unstake(_a) {
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const { pkh } = yield this.getKeys();
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
const op = yield (0, contract_1.createTransferOperation)(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: pkh }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
entrypoint: 'unstake',
value: { prim: 'Unit' },
} }));
const operation = yield this.addRevealOperationIfNeeded(op, pkh);
const ops = this.convertIntoArray(operation);
const hash = yield this.getBlockHash();
const protocol = yield this.getProtocolHash();
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
const headCounter = parseInt(yield this.getHeadCounter(pkh), 10);
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
return {
opOb: {
branch: hash,
contents,
protocol,
},
counter: headCounter,
};
});
}
/**
*
* @description Method to prepare a finalize_unstake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
finalizeUnstake(_a) {
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
return __awaiter(this, void 0, void 0, function* () {
const { pkh } = yield this.getKeys();
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
const op = yield (0, contract_1.createTransferOperation)(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: pkh, amount: 0 }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
entrypoint: 'finalize_unstake',
value: { prim: 'Unit' },
} }));
const operation = yield this.addRevealOperationIfNeeded(op, pkh);
const ops = this.convertIntoArray(operation);
const hash = yield this.getBlockHash();
const protocol = yield this.getProtocolHash();
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
const headCounter = parseInt(yield this.getHeadCounter(pkh), 10);
const contents = this.constructOpContents(ops, headCounter, pkh, rest.source);
return {
opOb: {
branch: hash,
contents,
protocol,
},
counter: headCounter,
};
});
}
/**
*
* @description Method to prepare a delegation operation

@@ -321,0 +425,0 @@ * @param operation RPCOperation object or RPCOperation array

@@ -21,3 +21,3 @@ "use strict";

/**
* @description Access the balance of a contract.
* @description Access the spendable balance of a contract, excluding frozen bonds.
* @param address address from which we want to retrieve the balance

@@ -210,3 +210,10 @@ * @param block from which we want to retrieve the balance

}
/**
* @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
* @param block from which we want to retrieve the information
*/
getAdaptiveIssuanceLaunchCycle(block) {
return this.rpc.getAdaptiveIssuanceLaunchCycle({ block: String(block) });
}
}
exports.RpcReadAdapter = RpcReadAdapter;

4

dist/lib/version.js

@@ -6,4 +6,4 @@ "use strict";

exports.VERSION = {
"commitHash": "149f239050448e0dfb7d5e1ab98e578f61085d61",
"version": "19.2.1-beta.0"
"commitHash": "0ef631853ccfda5c5faed584f16069f34085817e",
"version": "20.0.0-beta.0"
};

@@ -33,2 +33,17 @@ "use strict";

}
mapStakeParamsToWalletParams(params) {
return __awaiter(this, void 0, void 0, function* () {
return (0, types_1.attachKind)(yield params(), types_1.OpKind.TRANSACTION);
});
}
mapUnstakeParamsToWalletParams(params) {
return __awaiter(this, void 0, void 0, function* () {
return (0, types_1.attachKind)(yield params(), types_1.OpKind.TRANSACTION);
});
}
mapFinalizeUnstakeParamsToWalletParams(params) {
return __awaiter(this, void 0, void 0, function* () {
return (0, types_1.attachKind)(yield params(), types_1.OpKind.TRANSACTION);
});
}
mapOriginateParamsToWalletParams(params) {

@@ -35,0 +50,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -297,8 +297,90 @@ "use strict";

*
* @description
* @description Stake a given amount for the source address
*
* @returns
* @returns An operation handle with the result from the rpc node
*
* @param params
* @param Stake pseudo-operation parameter
*/
stake(params) {
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
const mappedParams = yield this.walletProvider.mapStakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
const source = yield this.pkh();
if (!params.to) {
params.to = source;
}
if (params.to !== source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
params.parameter = { entrypoint: 'stake', value: { prim: 'Unit' } };
return params;
}));
const opHash = yield this.walletProvider.sendOperations([mappedParams]);
return this.context.operationFactory.createTransactionOperation(opHash);
}));
}
/**
*
* @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
* Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
* the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
*
* @returns An operation handle with the result from the rpc node
*
* @param Unstake pseudo-operation parameter
*/
unstake(params) {
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
const mappedParams = yield this.walletProvider.mapUnstakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
const source = yield this.pkh();
if (!params.to) {
params.to = source;
}
if (params.to !== source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
params.parameter = { entrypoint: 'unstake', value: { prim: 'Unit' } };
return params;
}));
const opHash = yield this.walletProvider.sendOperations([mappedParams]);
return yield this.context.operationFactory.createTransactionOperation(opHash);
}));
}
/**
*
* @description Transfer all the finalizable unstaked funds of the source to their liquid balance
* @returns An operation handle with the result from the rpc node
*
* @param Finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(params) {
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
const mappedParams = yield this.walletProvider.mapFinalizeUnstakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
const source = yield this.pkh();
if (!params.to) {
params.to = source;
}
if (params.to !== source) {
throw new core_1.InvalidStakingAddressError(params.to);
}
if (!params.amount) {
params.amount = 0;
}
if (params.amount !== 0) {
throw new core_1.InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.');
}
params.parameter = { entrypoint: 'finalize_unstake', value: { prim: 'Unit' } };
return params;
}));
const opHash = yield this.walletProvider.sendOperations([mappedParams]);
return yield this.context.operationFactory.createTransactionOperation(opHash);
}));
}
/**
*
* @description Increase the paid storage of a smart contract.
*
* @returns A wallet command from which we can send the operation to the wallet
*
* @param params operation parameter
*/
increasePaidStorage(params) {

@@ -305,0 +387,0 @@ const destinationValidation = (0, utils_1.validateAddress)(params.destination);

@@ -53,2 +53,3 @@ /**

ProxfordY = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",
PtParisBQ = "PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz",
ProtoALpha = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"

@@ -90,3 +91,4 @@ }

NAIROBINET = "NetXyuzvDo2Ugzb",
OXFORDNET2 = "NetXxWsskGahzQB"
OXFORDNET2 = "NetXxWsskGahzQB",
PARISNET = "NetXo8SqH1c38SS"
}

@@ -93,0 +95,0 @@ export declare const getRevealGasLimit: (address: string) => number;

@@ -10,3 +10,3 @@ import { BigMapKeyType, MichelsonMap, MichelsonMapKey, Schema } from '@taquito/michelson-encoder';

import { TransactionOperation } from '../operations/transaction-operation';
import { DelegateParams, OriginateParams, TransferParams, RegisterDelegateParams, ParamsWithKind, RevealParams, RegisterGlobalConstantParams, IncreasePaidStorageParams, TransferTicketParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams } from '../operations/types';
import { DelegateParams, OriginateParams, TransferParams, RegisterDelegateParams, ParamsWithKind, RevealParams, RegisterGlobalConstantParams, IncreasePaidStorageParams, TransferTicketParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
import { ContractAbstraction, ContractStorageType, DefaultContractType } from './contract';

@@ -122,2 +122,29 @@ import { IncreasePaidStorageOperation } from '../operations/increase-paid-storage-operation';

*
* @description Stake tz from current address to a specific address. Built on top of the existing transaction operation
*
* @returns An operation handle with the result from the rpc node
*
* @param Stake pseudo-operation parameter
*/
stake(params: StakeParams): Promise<TransactionOperation>;
/**
*
* @description Unstake tz from current address to a specific address. Built on top of the existing transaction operation
*
* @returns An operation handle with the result from the rpc node
*
* @param Unstake pseudo-operation parameter
*/
unstake(params: UnstakeParams): Promise<TransactionOperation>;
/**
*
* @description Finalize unstake tz from current address to a specific address. Built on top of the existing transaction operation
*
* @returns An operation handle with the result from the rpc node
*
* @param finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(params: FinalizeUnstakeParams): Promise<TransactionOperation>;
/**
*
* @description Transfer tickets from an implicit account to a contract or another implicit account.

@@ -124,0 +151,0 @@ *

@@ -9,3 +9,3 @@ import { BigMapKeyType, MichelsonMap, MichelsonMapKey, Schema } from '@taquito/michelson-encoder';

import { TransactionOperation } from '../operations/transaction-operation';
import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, RegisterGlobalConstantParams, RevealParams, TransferParams, TransferTicketParams, IncreasePaidStorageParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams } from '../operations/types';
import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, RegisterGlobalConstantParams, RevealParams, TransferParams, TransferTicketParams, IncreasePaidStorageParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
import { DefaultContractType, ContractStorageType, ContractAbstraction } from './contract';

@@ -132,2 +132,30 @@ import { ContractProvider, ContractSchema, StorageProvider } from './interface';

*
* @description Stake a given amount for the source address
*
* @returns An operation handle with the result from the rpc node
*
* @param Stake pseudo-operation parameter
*/
stake(params: StakeParams): Promise<TransactionOperation>;
/**
*
* @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
* Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
* the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
*
* @returns An operation handle with the result from the rpc node
*
* @param Unstake pseudo-operation parameter
*/
unstake(params: UnstakeParams): Promise<TransactionOperation>;
/**
*
* @description Transfer all the finalizable unstaked funds of the source to their liquid balance
* @returns An operation handle with the result from the rpc node
*
* @param Finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(params: FinalizeUnstakeParams): Promise<TransactionOperation>;
/**
*
* @description Transfer Tickets to a smart contract address

@@ -134,0 +162,0 @@ *

import { OriginateParams, TransferParams, DelegateParams, RegisterDelegateParams, ParamsWithKind } from '../operations';
import { RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams } from '../operations/types';
import { RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
import { Estimate } from './estimate';

@@ -26,2 +26,29 @@ import { ContractMethod, ContractMethodObject, ContractProvider } from '../contract';

*
* @description Estimate gasLimit, storageLimit and fees for an stake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Estimate
*/
stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for an unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Estimate
*/
unstake({ fee, storageLimit, gasLimit, ...rest }: UnstakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for an finalize_unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Estimate
*/
finalizeUnstake({ fee, storageLimit, gasLimit, ...rest }: FinalizeUnstakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for an transferTicket operation

@@ -28,0 +55,0 @@ *

@@ -1,2 +0,2 @@

import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, TransferParams, RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams } from '../operations/types';
import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, TransferParams, RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
import { Estimate } from './estimate';

@@ -34,2 +34,29 @@ import { EstimationProvider } from '../estimate/estimate-provider-interface';

*
* @description Estimate gasLimit, storageLimit and fees for an stake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Stake pseudo-operation parameter
*/
stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for an Unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param Unstake pseudo-operation parameter
*/
unstake({ fee, storageLimit, gasLimit, ...rest }: UnstakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for an finalize_unstake pseudo-operation
*
* @returns An estimation of gasLimit, storageLimit and fees for the operation
*
* @param finalize_unstake pseudo-operation parameter
*/
finalizeUnstake({ fee, storageLimit, gasLimit, ...rest }: FinalizeUnstakeParams): Promise<Estimate>;
/**
*
* @description Estimate gasLimit, storageLimit and fees for a transferTicket operation

@@ -36,0 +63,0 @@ *

@@ -173,2 +173,41 @@ import { OperationObject, InternalOperationResultKindEnum, OpKind, TransactionOperationParameter, MichelsonV1Expression, BallotVote, PvmKind } from '@taquito/rpc';

/**
* @description RPC Stake pseudo operation params
*/
export interface StakeParams {
to?: string;
source?: string;
amount: number;
fee?: number;
parameter?: TransactionOperationParameter;
gasLimit?: number;
storageLimit?: number;
mutez?: boolean;
}
/**
* @description RPC unstake pseudo operation params
*/
export interface UnstakeParams {
to?: string;
source?: string;
amount: number;
fee?: number;
parameter?: TransactionOperationParameter;
gasLimit?: number;
storageLimit?: number;
mutez?: boolean;
}
/**
* @description RPC finalize_unstake pseudo operation params
*/
export interface FinalizeUnstakeParams {
to?: string;
source?: string;
amount?: number;
fee?: number;
parameter?: TransactionOperationParameter;
gasLimit?: number;
storageLimit?: number;
mutez?: boolean;
}
/**
* @description RPC register global constant operation

@@ -175,0 +214,0 @@ */

import { PreapplyParams } from '@taquito/rpc';
import { DelegateParams, RevealParams, RegisterGlobalConstantParams, TransferParams, OriginateParams, UpdateConsensusKeyParams, TransferTicketParams, IncreasePaidStorageParams, BallotParams, ProposalsParams, DrainDelegateParams, ParamsWithKind, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, RegisterDelegateParams, ActivationParams } from '../operations/types';
import { DelegateParams, RevealParams, RegisterGlobalConstantParams, TransferParams, OriginateParams, UpdateConsensusKeyParams, TransferTicketParams, IncreasePaidStorageParams, BallotParams, ProposalsParams, DrainDelegateParams, ParamsWithKind, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, RegisterDelegateParams, ActivationParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
import { PreparationProvider, PreparedOperation } from './interface';

@@ -64,2 +64,26 @@ import { Context } from '../context';

*
* @description Method to prepare a stake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
stake({ fee, storageLimit, gasLimit, ...rest }: StakeParams): Promise<PreparedOperation>;
/**
*
* @description Method to prepare a unstake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
unstake({ fee, storageLimit, gasLimit, ...rest }: UnstakeParams): Promise<PreparedOperation>;
/**
*
* @description Method to prepare a finalize_unstake pseudo-operation
* @param operation RPCOperation object or RPCOperation array
* @param source string or undefined source pkh
* @returns a PreparedOperation object
*/
finalizeUnstake({ fee, storageLimit, gasLimit, ...rest }: FinalizeUnstakeParams): Promise<PreparedOperation>;
/**
*
* @description Method to prepare a delegation operation

@@ -66,0 +90,0 @@ * @param operation RPCOperation object or RPCOperation array

@@ -1,2 +0,2 @@

import { BlockResponse, EntrypointsResponse, MichelsonV1Expression, SaplingDiffResponse, ScriptedContracts } from '@taquito/rpc';
import { BlockResponse, EntrypointsResponse, MichelsonV1Expression, SaplingDiffResponse, ScriptedContracts, AILaunchCycleResponse } from '@taquito/rpc';
import BigNumber from 'bignumber.js';

@@ -13,3 +13,3 @@ export type BigMapQuery = {

/**
* @description Access the balance of a contract.
* @description Access the spendable balance of a contract, excluding frozen bonds.
* @param address address from which we want to retrieve the balance

@@ -121,2 +121,7 @@ * @param block from which we want to retrieve the balance

getLiveBlocks(block: BlockIdentifier): Promise<string[]>;
/**
* @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
* @param block from which we want to retrieve the information
*/
getAdaptiveIssuanceLaunchCycle(block: BlockIdentifier): Promise<AILaunchCycleResponse>;
}

@@ -1,2 +0,2 @@

import { BlockResponse, EntrypointsResponse, MichelsonV1Expression, RpcClientInterface, SaplingDiffResponse, ScriptedContracts } from '@taquito/rpc';
import { BlockResponse, EntrypointsResponse, MichelsonV1Expression, RpcClientInterface, SaplingDiffResponse, ScriptedContracts, AILaunchCycleResponse } from '@taquito/rpc';
import BigNumber from 'bignumber.js';

@@ -11,3 +11,3 @@ import { BigMapQuery, BlockIdentifier, SaplingStateQuery, TzReadProvider } from './interface';

/**
* @description Access the balance of a contract.
* @description Access the spendable balance of a contract, excluding frozen bonds.
* @param address address from which we want to retrieve the balance

@@ -119,2 +119,7 @@ * @param block from which we want to retrieve the balance

getLiveBlocks(block: BlockIdentifier): Promise<string[]>;
/**
* @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
* @param block from which we want to retrieve the information
*/
getAdaptiveIssuanceLaunchCycle(block: BlockIdentifier): Promise<AILaunchCycleResponse>;
}

@@ -6,3 +6,3 @@ import BigNumber from 'bignumber.js';

*
* @param address Tezos address you want to get the balance for (eg tz1...)
* @param address Tezos address you want to get the spendable balance for (eg tz1...)
*/

@@ -9,0 +9,0 @@ getBalance(address: string): Promise<BigNumber>;

@@ -1,4 +0,7 @@

import { DelegateParams, FailingNoopParams, IncreasePaidStorageParams, OriginateParams, TransferParams } from '../operations/types';
import { DelegateParams, FailingNoopParams, IncreasePaidStorageParams, OriginateParams, TransferParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types';
export type WalletDefinedFields = 'source';
export type WalletTransferParams = Omit<TransferParams, WalletDefinedFields>;
export type WalletStakeParams = Omit<StakeParams, WalletDefinedFields>;
export type WalletUnstakeParams = Omit<UnstakeParams, WalletDefinedFields>;
export type WalletFinalizeUnstakeParams = Omit<FinalizeUnstakeParams, WalletDefinedFields>;
export type WalletOriginateParams<TStorage = any> = Omit<OriginateParams<TStorage>, WalletDefinedFields>;

@@ -22,2 +25,14 @@ export type WalletDelegateParams = Omit<DelegateParams, WalletDefinedFields>;

/**
* @description Transform WalletStakeParams into a format compliant with the underlying wallet
*/
mapStakeParamsToWalletParams: (params: () => Promise<WalletStakeParams>) => Promise<any>;
/**
* @description Transform WalletUnstakeParams into a format compliant with the underlying wallet
*/
mapUnstakeParamsToWalletParams: (params: () => Promise<WalletUnstakeParams>) => Promise<any>;
/**
* @description Transform WalletFinalizeUnstakeParams into a format compliant with the underlying wallet
*/
mapFinalizeUnstakeParamsToWalletParams: (params: () => Promise<WalletFinalizeUnstakeParams>) => Promise<any>;
/**
* @description Transform WalletOriginateParams into a format compliant with the underlying wallet

@@ -24,0 +39,0 @@ */

import { Context } from '../context';
import { OpKind } from '../operations/types';
import { WalletDelegateParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams } from './interface';
import { WalletDelegateParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams } from './interface';
import { WalletParamsWithKind } from './wallet';

@@ -11,2 +11,5 @@ export declare class LegacyWalletProvider implements WalletProvider {

mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>): Promise<import("../operations/types").withKind<WalletTransferParams, OpKind.TRANSACTION>>;
mapStakeParamsToWalletParams(params: () => Promise<WalletStakeParams>): Promise<import("../operations/types").withKind<WalletStakeParams, OpKind.TRANSACTION>>;
mapUnstakeParamsToWalletParams(params: () => Promise<WalletUnstakeParams>): Promise<import("../operations/types").withKind<WalletUnstakeParams, OpKind.TRANSACTION>>;
mapFinalizeUnstakeParamsToWalletParams(params: () => Promise<WalletFinalizeUnstakeParams>): Promise<import("../operations/types").withKind<WalletFinalizeUnstakeParams, OpKind.TRANSACTION>>;
mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>): Promise<import("../operations/types").withKind<WalletOriginateParams, OpKind.ORIGINATION>>;

@@ -13,0 +16,0 @@ mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>): Promise<import("../operations/types").withKind<WalletDelegateParams, OpKind.DELEGATION>>;

@@ -7,3 +7,3 @@ import { Context } from '../context';

import { OriginationWalletOperation } from './origination-operation';
import { WalletDelegateParams, WalletFailingNoopParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams } from './interface';
import { WalletDelegateParams, WalletFailingNoopParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams } from './interface';
export interface PKHOption {

@@ -155,8 +155,42 @@ forceRefetch?: boolean;

*
* @description
* @description Stake a given amount for the source address
*
* @returns
* @returns An operation handle with the result from the rpc node
*
* @param params
* @param Stake pseudo-operation parameter
*/
stake(params: WalletStakeParams): {
send: () => Promise<import("./transaction-operation").TransactionWalletOperation>;
};
/**
*
* @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
* Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
* the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
*
* @returns An operation handle with the result from the rpc node
*
* @param Unstake pseudo-operation parameter
*/
unstake(params: WalletUnstakeParams): {
send: () => Promise<import("./transaction-operation").TransactionWalletOperation>;
};
/**
*
* @description Transfer all the finalizable unstaked funds of the source to their liquid balance
* @returns An operation handle with the result from the rpc node
*
* @param Finalize_unstake pseudo-operation parameter
*/
finalizeUnstake(params: WalletFinalizeUnstakeParams): {
send: () => Promise<import("./transaction-operation").TransactionWalletOperation>;
};
/**
*
* @description Increase the paid storage of a smart contract.
*
* @returns A wallet command from which we can send the operation to the wallet
*
* @param params operation parameter
*/
increasePaidStorage(params: WalletIncreasePaidStorageParams): {

@@ -163,0 +197,0 @@ send: () => Promise<import("./increase-paid-storage-operation").IncreasePaidStorageWalletOperation>;

{
"name": "@taquito/taquito",
"version": "19.2.1-beta.0",
"version": "20.0.0-beta.0",
"description": "High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.",

@@ -34,3 +34,3 @@ "keywords": [

"scripts": {
"test": "jest --coverage --testPathIgnorePatterns=operation-factory.spec.ts",
"test": "jest --coverage",
"test:watch": "jest --coverage --watch",

@@ -81,9 +81,9 @@ "test:prod": "npm run lint && npm run test -- --no-cache",

"dependencies": {
"@taquito/core": "^19.2.1-beta.0",
"@taquito/http-utils": "^19.2.1-beta.0",
"@taquito/local-forging": "^19.2.1-beta.0",
"@taquito/michel-codec": "^19.2.1-beta.0",
"@taquito/michelson-encoder": "^19.2.1-beta.0",
"@taquito/rpc": "^19.2.1-beta.0",
"@taquito/utils": "^19.2.1-beta.0",
"@taquito/core": "^20.0.0-beta.0",
"@taquito/http-utils": "^20.0.0-beta.0",
"@taquito/local-forging": "^20.0.0-beta.0",
"@taquito/michel-codec": "^20.0.0-beta.0",
"@taquito/michelson-encoder": "^20.0.0-beta.0",
"@taquito/rpc": "^20.0.0-beta.0",
"@taquito/utils": "^20.0.0-beta.0",
"bignumber.js": "^9.1.2",

@@ -130,3 +130,3 @@ "rxjs": "^7.8.1"

},
"gitHead": "5ca99ce640b7b450a3236babed4bfe0e77cb7368"
"gitHead": "88980709574468fad5e4e7d63d34e1d71accf550"
}

@@ -10,3 +10,3 @@ # Taquito high-level functions

```html
<script src="https://unpkg.com/@taquito/taquito@19.2.1-beta.0/dist/taquito.min.js"
<script src="https://unpkg.com/@taquito/taquito@20.0.0-beta.0/dist/taquito.min.js"
crossorigin="anonymous" integrity="sha384-IxvP0ECHi5oqLyz94wF85pU9+ktcsL1HHtA42MITxZsGbsUMEu/g+0Vkjj5vqiMR"></script>

@@ -13,0 +13,0 @@ ```

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc