@taquito/taquito 24.2.0 → 24.3.0-beta.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.
- package/README.md +1 -1
- package/dist/lib/batch/rpc-batch-provider.js +91 -83
- package/dist/lib/context.js +22 -26
- package/dist/lib/contract/big-map.js +16 -29
- package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
- package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
- package/dist/lib/contract/contract.js +21 -32
- package/dist/lib/contract/errors.js +9 -9
- package/dist/lib/contract/prepare.js +36 -45
- package/dist/lib/contract/rpc-contract-provider.js +426 -475
- package/dist/lib/contract/sapling-state-abstraction.js +3 -14
- package/dist/lib/contract/semantic.js +2 -2
- package/dist/lib/errors.js +3 -3
- package/dist/lib/estimate/errors.js +1 -1
- package/dist/lib/estimate/estimate.js +66 -20
- package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
- package/dist/lib/forger/composite-forger.js +16 -27
- package/dist/lib/forger/errors.js +2 -2
- package/dist/lib/forger/taquito-local-forger.js +9 -22
- package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
- package/dist/lib/global-constants/errors.js +2 -2
- package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
- package/dist/lib/import-key.js +23 -34
- package/dist/lib/injector/rpc-injector.js +13 -24
- package/dist/lib/operations/ballot-operation.js +2 -3
- package/dist/lib/operations/delegate-operation.js +5 -8
- package/dist/lib/operations/drain-delegate-operation.js +1 -1
- package/dist/lib/operations/errors.js +9 -6
- package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
- package/dist/lib/operations/operations.js +100 -30
- package/dist/lib/operations/origination-operation.js +16 -27
- package/dist/lib/operations/proposals-operation.js +2 -3
- package/dist/lib/operations/register-global-constant-operation.js +4 -7
- package/dist/lib/operations/reveal-operation.js +1 -1
- package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
- package/dist/lib/operations/transaction-operation.js +2 -2
- package/dist/lib/operations/transfer-ticket-operation.js +4 -6
- package/dist/lib/operations/types.js +17 -19
- package/dist/lib/operations/update-companion-key-operation.js +4 -7
- package/dist/lib/operations/update-consensus-key-operation.js +4 -7
- package/dist/lib/packer/michel-codec-packer.js +3 -14
- package/dist/lib/packer/rpc-packer.js +2 -13
- package/dist/lib/parser/michel-codec-parser.js +82 -107
- package/dist/lib/parser/noop-parser.js +2 -13
- package/dist/lib/prepare/prepare-provider.js +780 -744
- package/dist/lib/provider.js +322 -128
- package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
- package/dist/lib/signer/errors.js +1 -1
- package/dist/lib/signer/noop.js +9 -26
- package/dist/lib/subscribe/errors.js +2 -2
- package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
- package/dist/lib/taquito.js +33 -33
- package/dist/lib/tz/rpc-tz-provider.js +27 -44
- package/dist/lib/version.js +2 -2
- package/dist/lib/wallet/batch-operation.js +32 -45
- package/dist/lib/wallet/delegation-operation.js +25 -40
- package/dist/lib/wallet/errors.js +15 -3
- package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
- package/dist/lib/wallet/legacy.js +28 -63
- package/dist/lib/wallet/operation-factory.js +27 -56
- package/dist/lib/wallet/operation.js +123 -59
- package/dist/lib/wallet/origination-operation.js +34 -46
- package/dist/lib/wallet/register-global-constant-operation.js +26 -43
- package/dist/lib/wallet/transaction-operation.js +21 -36
- package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
- package/dist/lib/wallet/wallet.js +187 -184
- package/dist/taquito.es6.js +3424 -3197
- package/dist/taquito.es6.js.map +1 -1
- package/dist/taquito.min.js +1 -1
- package/dist/taquito.umd.js +7930 -7701
- package/dist/taquito.umd.js.map +1 -1
- package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
- package/dist/types/context.d.ts +4 -4
- package/dist/types/contract/big-map.d.ts +3 -3
- package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
- package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
- package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
- package/dist/types/contract/contract.d.ts +6 -6
- package/dist/types/contract/errors.d.ts +11 -11
- package/dist/types/contract/interface.d.ts +42 -42
- package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
- package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
- package/dist/types/contract/semantic.d.ts +2 -2
- package/dist/types/errors.d.ts +5 -5
- package/dist/types/estimate/errors.d.ts +1 -1
- package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
- package/dist/types/estimate/estimate.d.ts +28 -11
- package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
- package/dist/types/forger/errors.d.ts +2 -2
- package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
- package/dist/types/global-constants/errors.d.ts +2 -2
- package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
- package/dist/types/import-key.d.ts +2 -2
- package/dist/types/operations/ballot-operation.d.ts +1 -1
- package/dist/types/operations/delegate-operation.d.ts +2 -2
- package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
- package/dist/types/operations/errors.d.ts +5 -5
- package/dist/types/operations/failing-noop-operation.d.ts +1 -1
- package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
- package/dist/types/operations/operations.d.ts +2 -2
- package/dist/types/operations/origination-operation.d.ts +5 -5
- package/dist/types/operations/proposals-operation.d.ts +1 -1
- package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
- package/dist/types/operations/reveal-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
- package/dist/types/operations/transaction-operation.d.ts +2 -2
- package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
- package/dist/types/operations/types.d.ts +387 -25
- package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
- package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
- package/dist/types/prepare/interface.d.ts +32 -33
- package/dist/types/prepare/prepare-provider.d.ts +34 -60
- package/dist/types/provider.d.ts +7 -1
- package/dist/types/read-provider/interface.d.ts +21 -21
- package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
- package/dist/types/signer/errors.d.ts +1 -1
- package/dist/types/signer/noop.d.ts +1 -1
- package/dist/types/subscribe/errors.d.ts +2 -2
- package/dist/types/taquito.d.ts +33 -33
- package/dist/types/wallet/errors.d.ts +10 -2
- package/dist/types/wallet/interface.d.ts +13 -13
- package/dist/types/wallet/operation.d.ts +4 -3
- package/dist/types/wallet/wallet.d.ts +36 -35
- package/package.json +27 -15
- package/LICENSE +0 -202
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.CompositeForger = void 0;
|
|
13
4
|
const errors_1 = require("./errors");
|
|
@@ -18,26 +9,24 @@ class CompositeForger {
|
|
|
18
9
|
throw new errors_1.UnspecifiedForgerError();
|
|
19
10
|
}
|
|
20
11
|
}
|
|
21
|
-
forge(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
async forge({ branch, contents }) {
|
|
13
|
+
const results = await Promise.all(this.forgers.map((forger) => {
|
|
14
|
+
return forger.forge({ branch, contents });
|
|
15
|
+
}));
|
|
16
|
+
if (results.length === 0) {
|
|
17
|
+
throw new errors_1.UnspecifiedForgerError();
|
|
18
|
+
}
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
let lastResult = results.pop(); // Assumed to be more than one since we
|
|
21
|
+
while (results.length) {
|
|
29
22
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const currentResult = results.pop();
|
|
34
|
-
if (currentResult !== lastResult) {
|
|
35
|
-
throw new errors_1.ForgingMismatchError([lastResult, currentResult]);
|
|
36
|
-
}
|
|
37
|
-
lastResult = currentResult;
|
|
23
|
+
const currentResult = results.pop();
|
|
24
|
+
if (currentResult !== lastResult) {
|
|
25
|
+
throw new errors_1.ForgingMismatchError([lastResult, currentResult]);
|
|
38
26
|
}
|
|
39
|
-
|
|
40
|
-
}
|
|
27
|
+
lastResult = currentResult;
|
|
28
|
+
}
|
|
29
|
+
return lastResult;
|
|
41
30
|
}
|
|
42
31
|
}
|
|
43
32
|
exports.CompositeForger = CompositeForger;
|
|
@@ -4,7 +4,7 @@ exports.UnspecifiedForgerError = exports.ForgingMismatchError = void 0;
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates CompositeForger.forge() results doesn't match each other
|
|
8
8
|
*/
|
|
9
9
|
class ForgingMismatchError extends core_1.TaquitoError {
|
|
10
10
|
constructor(results) {
|
|
@@ -17,7 +17,7 @@ class ForgingMismatchError extends core_1.TaquitoError {
|
|
|
17
17
|
exports.ForgingMismatchError = ForgingMismatchError;
|
|
18
18
|
/**
|
|
19
19
|
* @category Error
|
|
20
|
-
*
|
|
20
|
+
* Error that indicates no forger has been configured for CompositeForger
|
|
21
21
|
*/
|
|
22
22
|
class UnspecifiedForgerError extends core_1.TezosToolkitConfigError {
|
|
23
23
|
constructor() {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.TaquitoLocalForger = void 0;
|
|
13
4
|
const local_forging_1 = require("@taquito/local-forging");
|
|
@@ -15,20 +6,16 @@ class TaquitoLocalForger {
|
|
|
15
6
|
constructor(context) {
|
|
16
7
|
this.context = context;
|
|
17
8
|
}
|
|
18
|
-
getNextProto() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return this.context.proto;
|
|
25
|
-
});
|
|
9
|
+
async getNextProto() {
|
|
10
|
+
if (!this.context.proto) {
|
|
11
|
+
const nextProto = await this.context.readProvider.getNextProtocol('head');
|
|
12
|
+
this.context.proto = nextProto;
|
|
13
|
+
}
|
|
14
|
+
return this.context.proto;
|
|
26
15
|
}
|
|
27
|
-
forge(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return forger.forge({ branch, contents });
|
|
31
|
-
});
|
|
16
|
+
async forge({ branch, contents }) {
|
|
17
|
+
const forger = new local_forging_1.LocalForger(await this.getNextProto());
|
|
18
|
+
return forger.forge({ branch, contents });
|
|
32
19
|
}
|
|
33
20
|
}
|
|
34
21
|
exports.TaquitoLocalForger = TaquitoLocalForger;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.DefaultGlobalConstantsProvider = void 0;
|
|
13
4
|
const errors_1 = require("./errors");
|
|
@@ -17,7 +8,7 @@ class DefaultGlobalConstantsProvider {
|
|
|
17
8
|
}
|
|
18
9
|
/**
|
|
19
10
|
*
|
|
20
|
-
*
|
|
11
|
+
* Allows to load global constant hashes and their corresponding Michelson JSON values
|
|
21
12
|
*/
|
|
22
13
|
loadGlobalConstant(globalConstant) {
|
|
23
14
|
for (const hash in globalConstant) {
|
|
@@ -28,19 +19,17 @@ class DefaultGlobalConstantsProvider {
|
|
|
28
19
|
}
|
|
29
20
|
/**
|
|
30
21
|
*
|
|
31
|
-
*
|
|
22
|
+
* Retrieve the Michelson value of a global constant based on its hash
|
|
32
23
|
*
|
|
33
24
|
* @param hash a string representing the global constant hash
|
|
34
25
|
* @returns Expr, the JSON Michelson value
|
|
35
26
|
*/
|
|
36
|
-
getGlobalConstantByHash(hash) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return value;
|
|
43
|
-
});
|
|
27
|
+
async getGlobalConstantByHash(hash) {
|
|
28
|
+
const value = this._globalConstantsLibrary[hash];
|
|
29
|
+
if (!value) {
|
|
30
|
+
throw new errors_1.GlobalConstantNotFound(hash);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
35
|
exports.DefaultGlobalConstantsProvider = DefaultGlobalConstantsProvider;
|
|
@@ -4,7 +4,7 @@ exports.UnconfiguredGlobalConstantsProviderError = exports.GlobalConstantNotFoun
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates that a global constant does not exist
|
|
8
8
|
*/
|
|
9
9
|
class GlobalConstantNotFound extends core_1.TaquitoError {
|
|
10
10
|
constructor(hash) {
|
|
@@ -17,7 +17,7 @@ class GlobalConstantNotFound extends core_1.TaquitoError {
|
|
|
17
17
|
exports.GlobalConstantNotFound = GlobalConstantNotFound;
|
|
18
18
|
/**
|
|
19
19
|
* @category Error
|
|
20
|
-
*
|
|
20
|
+
* Error that indicates the global constant provider not being configured under TezosToolkit
|
|
21
21
|
*/
|
|
22
22
|
class UnconfiguredGlobalConstantsProviderError extends core_1.TezosToolkitConfigError {
|
|
23
23
|
constructor() {
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.NoopGlobalConstantsProvider = void 0;
|
|
13
4
|
const errors_1 = require("./errors");
|
|
14
5
|
class NoopGlobalConstantsProvider {
|
|
15
|
-
getGlobalConstantByHash(_hash) {
|
|
16
|
-
|
|
17
|
-
throw new errors_1.UnconfiguredGlobalConstantsProviderError();
|
|
18
|
-
});
|
|
6
|
+
async getGlobalConstantByHash(_hash) {
|
|
7
|
+
throw new errors_1.UnconfiguredGlobalConstantsProviderError();
|
|
19
8
|
}
|
|
20
9
|
}
|
|
21
10
|
exports.NoopGlobalConstantsProvider = NoopGlobalConstantsProvider;
|
package/dist/lib/import-key.js
CHANGED
|
@@ -1,51 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.importKey = importKey;
|
|
13
4
|
const signer_1 = require("@taquito/signer");
|
|
14
5
|
/**
|
|
15
6
|
*
|
|
16
|
-
*
|
|
7
|
+
* Import a key to sign operation with the side-effect of setting the Tezos instance to use the InMemorySigner provider
|
|
17
8
|
*
|
|
18
|
-
* @
|
|
9
|
+
* @remarks The JSON faucets are no longer available on https://teztnets.com/
|
|
19
10
|
* @param toolkit The toolkit instance to attach a signer
|
|
20
11
|
* @param privateKeyOrEmail Key to load in memory
|
|
21
12
|
* @param passphrase If the key is encrypted passphrase to decrypt it
|
|
22
13
|
* @param mnemonic Faucet mnemonic
|
|
23
14
|
* @param secret Faucet secret
|
|
24
15
|
*/
|
|
25
|
-
function importKey(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
throw ex;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (op) {
|
|
42
|
-
yield op.confirmation();
|
|
16
|
+
async function importKey(toolkit, privateKeyOrEmail, passphrase, mnemonic, secret) {
|
|
17
|
+
if (privateKeyOrEmail && passphrase && mnemonic && secret) {
|
|
18
|
+
const signer = signer_1.InMemorySigner.fromFundraiser(privateKeyOrEmail, passphrase, mnemonic);
|
|
19
|
+
toolkit.setProvider({ signer });
|
|
20
|
+
const pkh = await signer.publicKeyHash();
|
|
21
|
+
let op;
|
|
22
|
+
try {
|
|
23
|
+
op = await toolkit.tz.activate(pkh, secret);
|
|
24
|
+
}
|
|
25
|
+
catch (ex) {
|
|
26
|
+
const isInvalidActivationError = ex && ex.body && /Invalid activation/.test(ex.body);
|
|
27
|
+
if (!isInvalidActivationError) {
|
|
28
|
+
throw ex;
|
|
43
29
|
}
|
|
44
30
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const signer = yield signer_1.InMemorySigner.fromSecretKey(privateKeyOrEmail, passphrase);
|
|
48
|
-
toolkit.setProvider({ signer });
|
|
31
|
+
if (op) {
|
|
32
|
+
await op.confirmation();
|
|
49
33
|
}
|
|
50
|
-
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Fallback to regular import
|
|
37
|
+
const signer = await signer_1.InMemorySigner.fromSecretKey(privateKeyOrEmail, passphrase);
|
|
38
|
+
toolkit.setProvider({ signer });
|
|
39
|
+
}
|
|
51
40
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.RpcInjector = void 0;
|
|
13
4
|
const helper_1 = require("./helper");
|
|
@@ -16,23 +7,21 @@ class RpcInjector {
|
|
|
16
7
|
constructor(context) {
|
|
17
8
|
this.context = context;
|
|
18
9
|
}
|
|
19
|
-
inject(signedOperationBytes) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
async inject(signedOperationBytes) {
|
|
11
|
+
let hash;
|
|
12
|
+
try {
|
|
13
|
+
hash = await this.context.rpc.injectOperation(signedOperationBytes);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
const stringToStrip = '. You may want to use --replace to provide adequate fee and replace it';
|
|
17
|
+
if (error instanceof http_utils_1.HttpResponseError && error.message.includes(stringToStrip)) {
|
|
18
|
+
throw (0, helper_1.formatErrorMessage)(error, stringToStrip);
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (error instanceof http_utils_1.HttpResponseError && error.message.includes(stringToStrip)) {
|
|
28
|
-
throw (0, helper_1.formatErrorMessage)(error, stringToStrip);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
20
|
+
else {
|
|
21
|
+
throw error;
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
}
|
|
24
|
+
return hash;
|
|
36
25
|
}
|
|
37
26
|
}
|
|
38
27
|
exports.RpcInjector = RpcInjector;
|
|
@@ -4,7 +4,7 @@ exports.BallotOperation = void 0;
|
|
|
4
4
|
const operations_1 = require("./operations");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* BallotOperation provides utility functions to fetch a new operation of kind ballot
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
class BallotOperation extends operations_1.Operation {
|
|
@@ -20,8 +20,7 @@ class BallotOperation extends operations_1.Operation {
|
|
|
20
20
|
return result ? result : undefined;
|
|
21
21
|
}
|
|
22
22
|
get period() {
|
|
23
|
-
|
|
24
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.period;
|
|
23
|
+
return this.operationResults?.period;
|
|
25
24
|
}
|
|
26
25
|
get proposal() {
|
|
27
26
|
return this.params.proposal;
|
|
@@ -4,9 +4,9 @@ exports.DelegateOperation = void 0;
|
|
|
4
4
|
const bignumber_js_1 = require("bignumber.js");
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Delegation operation provide utility function to fetch newly issued delegation
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @remarks Currently support only one delegation per operation
|
|
10
10
|
*/
|
|
11
11
|
class DelegateOperation extends operations_1.Operation {
|
|
12
12
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -21,8 +21,7 @@ class DelegateOperation extends operations_1.Operation {
|
|
|
21
21
|
return result ? result : undefined;
|
|
22
22
|
}
|
|
23
23
|
get status() {
|
|
24
|
-
|
|
25
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
24
|
+
return this.operationResults?.status ?? 'unknown';
|
|
26
25
|
}
|
|
27
26
|
get delegate() {
|
|
28
27
|
return this.params.delegate;
|
|
@@ -46,12 +45,10 @@ class DelegateOperation extends operations_1.Operation {
|
|
|
46
45
|
: undefined;
|
|
47
46
|
}
|
|
48
47
|
get consumedMilliGas() {
|
|
49
|
-
|
|
50
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
48
|
+
return this.operationResults?.consumed_milligas;
|
|
51
49
|
}
|
|
52
50
|
get errors() {
|
|
53
|
-
|
|
54
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
51
|
+
return this.operationResults?.errors;
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
exports.DelegateOperation = DelegateOperation;
|
|
@@ -4,7 +4,7 @@ exports.DrainDelegateOperation = void 0;
|
|
|
4
4
|
const operations_1 = require("./operations");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* DrainDelegateOperation provides utility functions to fetch a new operation of kind drain_delegate
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
class DrainDelegateOperation extends operations_1.Operation {
|
|
@@ -8,7 +8,7 @@ const isErrorWithMessage = (error) => {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* @category Error
|
|
11
|
-
*
|
|
11
|
+
* Generic tezos error that will be thrown when a mistake occurs when doing an operation; more details here https://tezos.gitlab.io/api/errors.html
|
|
12
12
|
*/
|
|
13
13
|
class TezosOperationError extends core_1.RpcError {
|
|
14
14
|
constructor(errors, errorDetails, operationsWithResults) {
|
|
@@ -42,7 +42,7 @@ class TezosOperationError extends core_1.RpcError {
|
|
|
42
42
|
exports.TezosOperationError = TezosOperationError;
|
|
43
43
|
/**
|
|
44
44
|
* @category Error
|
|
45
|
-
*
|
|
45
|
+
* Tezos error that will be thrown when a mistake happens during the preapply stage
|
|
46
46
|
*/
|
|
47
47
|
class TezosPreapplyFailureError extends Error {
|
|
48
48
|
constructor(result) {
|
|
@@ -65,7 +65,10 @@ const flattenOperationResult = (response) => {
|
|
|
65
65
|
for (let j = 0; j < results[i].contents.length; j++) {
|
|
66
66
|
const content = results[i].contents[j];
|
|
67
67
|
if ((0, types_1.hasMetadataWithResult)(content) && 'fee' in content) {
|
|
68
|
-
returnedResults.push(
|
|
68
|
+
returnedResults.push({
|
|
69
|
+
fee: content.fee,
|
|
70
|
+
...content.metadata.operation_result,
|
|
71
|
+
});
|
|
69
72
|
if (Array.isArray(content.metadata.internal_operation_results)) {
|
|
70
73
|
content.metadata.internal_operation_results.forEach((x) => returnedResults.push(x.result));
|
|
71
74
|
}
|
|
@@ -76,7 +79,7 @@ const flattenOperationResult = (response) => {
|
|
|
76
79
|
};
|
|
77
80
|
exports.flattenOperationResult = flattenOperationResult;
|
|
78
81
|
/***
|
|
79
|
-
*
|
|
82
|
+
* Flatten all error from preapply response (including internal error)
|
|
80
83
|
*/
|
|
81
84
|
const flattenErrors = (response, status = 'failed') => {
|
|
82
85
|
const results = Array.isArray(response) ? response : [response];
|
|
@@ -106,7 +109,7 @@ const flattenErrors = (response, status = 'failed') => {
|
|
|
106
109
|
exports.flattenErrors = flattenErrors;
|
|
107
110
|
/**
|
|
108
111
|
* @category Error
|
|
109
|
-
*
|
|
112
|
+
* Error that indicates a general failure happening during an origination operation.
|
|
110
113
|
*/
|
|
111
114
|
class OriginationOperationError extends core_1.TaquitoError {
|
|
112
115
|
constructor(message) {
|
|
@@ -118,7 +121,7 @@ class OriginationOperationError extends core_1.TaquitoError {
|
|
|
118
121
|
exports.OriginationOperationError = OriginationOperationError;
|
|
119
122
|
/**
|
|
120
123
|
* @category Error
|
|
121
|
-
*
|
|
124
|
+
* Error that indicates an invalid estimate value being passed
|
|
122
125
|
*/
|
|
123
126
|
class InvalidEstimateValueError extends core_1.ParameterValidationError {
|
|
124
127
|
constructor(message) {
|
|
@@ -4,7 +4,7 @@ exports.IncreasePaidStorageOperation = void 0;
|
|
|
4
4
|
const operations_1 = require("./operations");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* IncreasePaidStorageOperation provides utility functions to fetch a new operation of kind increase_paid_storage
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
class IncreasePaidStorageOperation extends operations_1.Operation {
|
|
@@ -22,8 +22,7 @@ class IncreasePaidStorageOperation extends operations_1.Operation {
|
|
|
22
22
|
return result ? result : undefined;
|
|
23
23
|
}
|
|
24
24
|
get status() {
|
|
25
|
-
|
|
26
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
25
|
+
return this.operationResults?.status ?? 'unknown';
|
|
27
26
|
}
|
|
28
27
|
get fee() {
|
|
29
28
|
return Number(this.params.fee);
|
|
@@ -35,12 +34,10 @@ class IncreasePaidStorageOperation extends operations_1.Operation {
|
|
|
35
34
|
return Number(this.params.storage_limit);
|
|
36
35
|
}
|
|
37
36
|
get errors() {
|
|
38
|
-
|
|
39
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
37
|
+
return this.operationResults?.errors;
|
|
40
38
|
}
|
|
41
39
|
get consumedMilliGas() {
|
|
42
|
-
|
|
43
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
40
|
+
return this.operationResults?.consumed_milligas;
|
|
44
41
|
}
|
|
45
42
|
get amount() {
|
|
46
43
|
return this.params.amount;
|