From 441e6fba4194984dff3a9cd8f154cb21f0efec35 Mon Sep 17 00:00:00 2001 From: Alireza Haghshenas Date: Thu, 5 Oct 2023 14:26:54 -0700 Subject: [PATCH] chore: rollback safe stringify in doc files --- docs/cancel_http_requests.md | 4 +- docs/complex_parameters.md | 10 ++--- docs/contract-test-collection.md | 8 ++-- docs/drain_account.md | 4 +- docs/estimate.md | 12 ++--- docs/inmemory_signer.md | 12 ++--- docs/lambda_view.md | 12 ++--- docs/ledger_signer.md | 4 +- docs/making_transfers.md | 2 +- docs/maps_bigmaps.md | 44 +++++++++---------- docs/metadata-tzip16.md | 44 +++++++++---------- docs/michelson_encoder.md | 20 ++++----- docs/michelsonmap.md | 2 +- docs/on_chain_views.md | 8 ++-- docs/originate.md | 12 ++--- docs/quick_start.md | 10 ++--- docs/sapling.md | 6 +-- docs/sapling_in_memory_viewing_key.md | 8 ++-- docs/signing.md | 4 +- docs/smartcontracts.md | 24 +++++----- docs/storage_annotations.md | 12 ++--- docs/tzip12.md | 20 ++++----- docs/version.md | 4 +- docs/wallet_API.md | 2 +- example/deploy-docs-live-code-contracts.ts | 8 ++-- example/encode-michelson.ts | 4 +- example/example-bigmap-keys-as-deep-pair.ts | 2 +- example/example-bigmap-keys-as-pair.ts | 2 +- ...16-contract-origination-hostile-strings.ts | 2 +- example/example-tzip-16-on-chain-one.ts | 2 +- example/example-tzip-16-on-chain-two.ts | 2 +- example/example-tzip-16-storage.ts | 2 +- example/example-tzip-16.ts | 2 +- website/src/theme/CodeBlock/index.js | 3 -- 34 files changed, 157 insertions(+), 160 deletions(-) diff --git a/docs/cancel_http_requests.md b/docs/cancel_http_requests.md index 9a6d5f75e9..266ad126ec 100644 --- a/docs/cancel_http_requests.md +++ b/docs/cancel_http_requests.md @@ -45,10 +45,10 @@ class CancellableHttpBackend extends HttpBackend { }); } catch (err: any) { throw new HttpResponseError( - `Http error response: (${err.response.status}) ${stringify(err.response.data)}`, + `Http error response: (${err.response.status}) $JSON.stringify(err.response.data)}`, err.response.status as STATUS_CODE, err.response.statusText, - stringify(err.response.data), + JSON.stringify(err.response.data), url + this.serialize(query) ) } diff --git a/docs/complex_parameters.md b/docs/complex_parameters.md index db7f27b5e3..f9a1c5c9ff 100644 --- a/docs/complex_parameters.md +++ b/docs/complex_parameters.md @@ -97,7 +97,7 @@ importKey(Tezos, secretKey) return contractOriginated.contract(); }).then((contract) => { println(`Origination completed.`); -}).catch((error) => println(`Error: ${stringify(error, null, 2)}`)); +}).catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` ## Calling the function of a contract having a complex object as a parameter @@ -139,8 +139,8 @@ importKey(Tezos, secretKey) const dataMap = new MichelsonMap(); dataMap.set("Hello World", { bool : true }) let inspect = myContract.methods.set_child_record('tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', dataMap, 'EEEE', 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', 'FFFF', '10').toTransferParams(); - println(stringify(inspect, null, 2)) -}).catch(error => println(`Error: ${stringify(error, null, 2)}`)); + printlnJSON.stringify(inspect, null, 2)) +}).catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` #### Call the set_child_record function when all the arguments are defined @@ -170,7 +170,7 @@ importKey(Tezos, secretKey) return op.confirmation(1).then(() => op.hash); }).then(hash => { println(`Operation injected: https://better-call.dev/ghostnet/KT1B2exfRrGMjfZqWK1bDemr3nBFhHsUWQuN/operations`); -}).catch(error => println(`Error: ${stringify(error, null, 2)}`)); +}).catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` #### Call the set_child_record function when optional arguments are null @@ -201,5 +201,5 @@ importKey(Tezos, secretKey) return op.confirmation(1).then(() => op.hash); }).then(hash => { println(`Operation injected: https://better-call.dev/ghostnet/KT1B2exfRrGMjfZqWK1bDemr3nBFhHsUWQuN/operations`); -}).catch(error => println(`Error: ${stringify(error, null, 2)}`)); +}).catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` \ No newline at end of file diff --git a/docs/contract-test-collection.md b/docs/contract-test-collection.md index 2e73c1c101..4075ab47d9 100644 --- a/docs/contract-test-collection.md +++ b/docs/contract-test-collection.md @@ -509,7 +509,7 @@ Tezos.contract println(`The value associated with the specified key of the bigMap is ${valueBigMap}.`); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -1060,7 +1060,7 @@ const metadataJSON = { const metadataBigMap = new MichelsonMap(); metadataBigMap.set('', char2Bytes('tezos-storage:here')); -metadataBigMap.set('here', char2Bytes(stringify(metadataJSON))); +metadataBigMap.set('here', char2BytesJSON.stringify(metadataJSON))); const tacoShopStorageMap = new MichelsonMap(); @@ -1292,7 +1292,7 @@ storage (pair nat (big_map %metadata string bytes)); ```js const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set('', char2Bytes('tezos-storage:here')); -metadataBigMAp.set('here', char2Bytes(stringify(metadataViewsExample1))); +metadataBigMAp.set('here', char2BytesJSON.stringify(metadataViewsExample1))); const op = await tezos.contract.originate({ code: contractCode, @@ -1341,7 +1341,7 @@ storage (pair nat (big_map %metadata string bytes)); ```js const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set('', char2Bytes('tezos-storage:here')); -metadataBigMAp.set('here', char2Bytes(stringify(metadataViewsExample2))); +metadataBigMAp.set('here', char2BytesJSON.stringify(metadataViewsExample2))); const op = await tezos.contract.originate({ code: contractCode, diff --git a/docs/drain_account.md b/docs/drain_account.md index ab78c17461..0bbf1594bf 100644 --- a/docs/drain_account.md +++ b/docs/drain_account.md @@ -75,7 +75,7 @@ Tezos.signer }); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` ## Draining originated accounts (KT1) @@ -156,5 +156,5 @@ Tezos.signer }); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/estimate.md b/docs/estimate.md index 4fec4280b3..0b10534a54 100644 --- a/docs/estimate.md +++ b/docs/estimate.md @@ -54,7 +54,7 @@ Tezos.estimate totalCost : ${est.totalCost}, usingBaseFeeMutez : ${est.usingBaseFeeMutez}`); }) - .catch((error) => console.table(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => console.table(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -79,7 +79,7 @@ Tezos.estimate totalCost : ${est.totalCost}, usingBaseFeeMutez : ${est.usingBaseFeeMutez}`); }) - .catch((error) => console.table(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => console.table(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -122,7 +122,7 @@ Tezos.contract totalCost : ${estimate.totalCost}, usingBaseFeeMutez : ${estimate.usingBaseFeeMutez}`); }) - .catch((error) => console.table(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => console.table(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -151,7 +151,7 @@ Tezos.wallet totalCost : ${estimate.totalCost}, usingBaseFeeMutez : ${estimate.usingBaseFeeMutez}`); }) - .catch((error) => console.table(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => console.table(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -193,7 +193,7 @@ Tezos.estimate totalCost : ${originationOp.totalCost}, usingBaseFeeMutez : ${originationOp.usingBaseFeeMutez}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -223,7 +223,7 @@ Tezos.estimate totalCost : ${originationOp.totalCost}, usingBaseFeeMutez : ${originationOp.usingBaseFeeMutez}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/inmemory_signer.md b/docs/inmemory_signer.md index b7374a3349..54d8c8feb9 100644 --- a/docs/inmemory_signer.md +++ b/docs/inmemory_signer.md @@ -52,7 +52,7 @@ InMemorySigner.fromSecretKey('edsk2rKA8YEExg9Zo2qNPiQnnYheF1DhqjLVmfKdxiFfu5GyGR .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` ```js live noInline @@ -69,7 +69,7 @@ InMemorySigner.fromSecretKey('spsk2Fiz7sGP5fNMJrokp6ynTa4bcFbsRhw58FHXbNf5ProDNF .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` When required, Taquito offers the `b58cencode` function allowing to encode the secret in base58. The parameters of the function are the secret, that can be a `hex string` or an `Uint8Array`, and the desired prefix. Here is an example with a `hex string`: @@ -97,7 +97,7 @@ InMemorySigner.fromSecretKey(b58encodedSecret) .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` ### Loading an encrypted private key with a passphrase @@ -133,7 +133,7 @@ InMemorySigner.fromSecretKey( .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` ```js live noInline @@ -153,7 +153,7 @@ InMemorySigner.fromSecretKey( .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` ```js live noInline @@ -173,7 +173,7 @@ InMemorySigner.fromSecretKey( .then((publicKeyHash) => { println(`The public key hash associated is: ${publicKeyHash}.`); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/lambda_view.md b/docs/lambda_view.md index ea6696f443..8260c9a974 100644 --- a/docs/lambda_view.md +++ b/docs/lambda_view.md @@ -59,7 +59,7 @@ Tezos.contract .then((response) => { println(response); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` **More examples:** @@ -85,9 +85,9 @@ Tezos.contract .read(); }) .then((response) => { - println(stringify(response, null, 2)); + printlnJSON.stringify(response, null, 2)); }) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/ledger_signer.md b/docs/ledger_signer.md index 01938aae10..15192a2c7e 100644 --- a/docs/ledger_signer.md +++ b/docs/ledger_signer.md @@ -117,7 +117,7 @@ Tezos.contract return op.confirmation(1).then(() => op.hash); }) .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) - .catch((error) => console.log(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => console.log(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` @@ -136,7 +136,7 @@ Tezos.wallet return op.confirmation(1).then(() => op.opHash); }) .then((hash) => console.log(`Operation injected: https://jakarta.tzstats.com/${hash}`)) - .catch((error) => console.log(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => console.log(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/making_transfers.md b/docs/making_transfers.md index 14a91c8315..29b7a7e5d0 100644 --- a/docs/making_transfers.md +++ b/docs/making_transfers.md @@ -47,7 +47,7 @@ fetch('https://keygen.ecadinfra.com/ghostnet/', { return op.confirmation(1).then(() => op.hash); }) .then((hash) => render(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => render(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => render(`Error: $JSON.stringify(error, null, 2)}`)); ``` ## Transfers involving "originated" KT1 addresses diff --git a/docs/maps_bigmaps.md b/docs/maps_bigmaps.md index 190136abde..543c5df90c 100644 --- a/docs/maps_bigmaps.md +++ b/docs/maps_bigmaps.md @@ -61,7 +61,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -91,7 +91,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -126,7 +126,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -152,7 +152,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -209,7 +209,7 @@ Tezos.contract ); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -252,7 +252,7 @@ Tezos.wallet ); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -332,7 +332,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -389,7 +389,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -425,7 +425,7 @@ Tezos.contract println(`Values associated with this key : amount : ${value[Object.keys(value)[0]]}, quantity : ${value[Object.keys(value)[1]]}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -445,7 +445,7 @@ Tezos.wallet println(`Values associated with this key : amount : ${value[Object.keys(value)[0]]}, quantity : ${value[Object.keys(value)[1]]}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -525,7 +525,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -577,7 +577,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -619,7 +619,7 @@ Tezos.contract }); println(`The value associated to this key is ${value}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -645,7 +645,7 @@ Tezos.wallet }); println(`The value associated to this key is ${value}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -723,7 +723,7 @@ Tezos.contract .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -780,7 +780,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -825,7 +825,7 @@ Tezos.contract println(`The value associated with the specified key of the bigMap is ${valueBigMap}.`); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -858,7 +858,7 @@ Tezos.wallet println(`The value associated with the specified key of the bigMap is ${valueBigMap}.`); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -922,10 +922,10 @@ Tezos.contract }) .then((values) => { values.forEach((value, key) => { - println(`The value of the key ${key} is:\n${stringify(value, null, 2)}.\n`); + println(`The value of the key ${key} is:\n$JSON.stringify(value, null, 2)}.\n`); }); }) - .catch((error) => println(stringify(error))); + .catch((error) => printlnJSON.stringify(error))); ``` @@ -952,10 +952,10 @@ Tezos.wallet }) .then((values) => { values.forEach((value, key) => { - println(`The value of the key ${key} is:\n${stringify(value, null, 2)}.\n`); + println(`The value of the key ${key} is:\n$JSON.stringify(value, null, 2)}.\n`); }); }) - .catch((error) => println(stringify(error))); + .catch((error) => printlnJSON.stringify(error))); ``` diff --git a/docs/metadata-tzip16.md b/docs/metadata-tzip16.md index 238fea411c..acb11c709d 100644 --- a/docs/metadata-tzip16.md +++ b/docs/metadata-tzip16.md @@ -108,9 +108,9 @@ Tezos.contract return contract.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -132,9 +132,9 @@ Tezos.wallet return wallet.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -166,9 +166,9 @@ Tezos.contract return contract.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -189,9 +189,9 @@ Tezos.wallet return wallet.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -222,9 +222,9 @@ Tezos.contract return contract.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -246,9 +246,9 @@ Tezos.wallet return wallet.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -280,9 +280,9 @@ Tezos.contract return contract.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -304,9 +304,9 @@ Tezos.wallet return wallet.tzip16().getMetadata(); }) .then((metadata) => { - println(stringify(metadata, null, 2)); + printlnJSON.stringify(metadata, null, 2)); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -377,7 +377,7 @@ Tezos.contract println(`Result of the view someJson: ${result}`); println(`Transform result to char: ${bytes2Char(result)}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -406,7 +406,7 @@ Tezos.wallet println(`Result of the view someJson: ${result}`); println(`Transform result to char: ${bytes2Char(result)}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -449,7 +449,7 @@ Tezos.contract .then((result) => { println(`Result of the view 'multiply-the-nat-in-storage': ${result}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -480,7 +480,7 @@ Tezos.wallet .then((result) => { println(`Result of the view 'multiply-the-nat-in-storage': ${result}`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -529,7 +529,7 @@ Tezos.contract println(`Result of the custom view: ${result}`); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -566,7 +566,7 @@ Tezos.wallet println(`Result of the custom view: ${result}`); }); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` \ No newline at end of file diff --git a/docs/michelson_encoder.md b/docs/michelson_encoder.md index f81d3312b9..8b457897d5 100644 --- a/docs/michelson_encoder.md +++ b/docs/michelson_encoder.md @@ -82,7 +82,7 @@ const storageType = { }; const storageSchema = new Schema(storageType); const extractSchema = storageSchema.ExtractSchema(); -println(stringify(extractSchema, null, 2)); +printlnJSON.stringify(extractSchema, null, 2)); ``` When there is no annotation, the keys of the object are indexes starting from 0. @@ -103,7 +103,7 @@ const storageType = { }; const storageSchema = new Schema(storageType); const extractSchema = storageSchema.ExtractSchema(); -println(stringify(extractSchema, null, 2)); +printlnJSON.stringify(extractSchema, null, 2)); ``` Here is another example using a complex storage: @@ -245,7 +245,7 @@ const storageType = }; const storageSchema = new Schema(storageType); const extractSchema = storageSchema.ExtractSchema(); -println(stringify(extractSchema, null, 2)); +printlnJSON.stringify(extractSchema, null, 2)); ``` ### The Typecheck method @@ -300,7 +300,7 @@ const michelsonData = storageSchema.Encode({ threshold: 5, keys: ['edpkvS5QFv7KRGfa3b87gg9DBpxSm3NpSwnjhUjNBQrRUUR66F7C9g', 'edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'] }) -println(stringify(michelsonData, null, 2)); +printlnJSON.stringify(michelsonData, null, 2)); ``` ### The Execute method @@ -348,7 +348,7 @@ const dataMichelson = { ] } const data = storageSchema.Execute(dataMichelson) -println(stringify(data, null, 2)); +printlnJSON.stringify(data, null, 2)); ``` The `Execute` method takes an optional parameter of type `Semantic`. It allows overriding the default representation returned by the Michelson Encoder for specific types. @@ -362,12 +362,12 @@ const schema = new Schema({ prim: 'big_map', args: [{ prim: 'address' }, { prim: const dataMichelson = { int: 123456 } const data = schema.Execute(dataMichelson) -println(`Default value returned by the Michelson Encoder for big_map: ${stringify(data, null, 2)}`); +println(`Default value returned by the Michelson Encoder for big_map: $JSON.stringify(data, null, 2)}`); // instead of returning the big map id, we can override it // we return an object in this case const dataCustom = schema.Execute(dataMichelson, { big_map: (val) => Object({ id: val.int })}) -println(`Customised representation of the big_map value: ${stringify(dataCustom)}`); +println(`Customised representation of the big_map value: $JSON.stringify(dataCustom)}`); ``` Here is an example for the `ticket` type: @@ -377,10 +377,10 @@ const schema = new Schema({"prim":"ticket","args":[{"prim":"string"}]}); const dataMichelson = {"prim":"Pair","args":[{"string":"KT1PVuv7af4VkPsZVZ8oZz9GSSdGnGBCbFWw"},{"string":"test"},{"int":"2"}]} const data = schema.Execute(dataMichelson) -println(`Default representation of the ticket value returned by the Michelson Encoder: ${stringify(data, null, 2)}`); +println(`Default representation of the ticket value returned by the Michelson Encoder: $JSON.stringify(data, null, 2)}`); const dataCustom = schema.Execute(dataMichelson, { ticket: (val) => val.args[1].string}) -println(`Customised representation of the ticket value: ${stringify(dataCustom)}`); +println(`Customised representation of the ticket value: $JSON.stringify(dataCustom)}`); ``` ### How the Schema class is used inside Taquito @@ -407,7 +407,7 @@ const michelsonData = parameterSchema.Encode( 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', '12' ) -println(stringify(michelsonData, null, 2)); +printlnJSON.stringify(michelsonData, null, 2)); ``` ### How the ParameterSchema class is used inside Taquito diff --git a/docs/michelsonmap.md b/docs/michelsonmap.md index 7eda15adbe..f3cc61753e 100644 --- a/docs/michelsonmap.md +++ b/docs/michelsonmap.md @@ -132,7 +132,7 @@ const entries = storage.entries(); for (let entry of entries) { entriesPairs.push({ address: entry[0], amount: entry[1].toNumber() / 10 ** 6 }); } -console.log('entries => ' + stringify(entriesPairs) + '\n'); +console.log('entries => ' +JSON.stringify(entriesPairs) + '\n'); ``` This code will yield the same result as the one above. A generator may be preferable according to your use case. diff --git a/docs/on_chain_views.md b/docs/on_chain_views.md index 06df2beed4..b7662ca73e 100644 --- a/docs/on_chain_views.md +++ b/docs/on_chain_views.md @@ -146,7 +146,7 @@ Tezos.contract.at(contractCallFib) }) }) }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -175,7 +175,7 @@ Tezos.wallet.at(contractCallFib) }) }) }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -218,7 +218,7 @@ Tezos.contract.at(contractTopLevelViews) println(`The result of the view simulation is ${viewResult}.`); }) }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -236,7 +236,7 @@ Tezos.wallet.at(contractTopLevelViews) println(`The result of the view simulation is ${viewResult}.`); }) }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/originate.md b/docs/originate.md index da923176cf..d5e4fc19a6 100644 --- a/docs/originate.md +++ b/docs/originate.md @@ -106,7 +106,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -136,7 +136,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -173,7 +173,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -199,7 +199,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -246,7 +246,7 @@ Tezos.contract .then((contract) => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -284,7 +284,7 @@ Tezos.wallet .then((contract) => { println(`Origination completed for ${contract.address}.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/quick_start.md b/docs/quick_start.md index 5808e0fed5..345b4fd661 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -60,7 +60,7 @@ Tezos.setProvider({ Tezos.tz .getBalance('tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY') .then((balance) => println(`${balance.toNumber() / 1000000} ęś©`)) - .catch((error) => println(stringify(error))); + .catch((error) => printlnJSON.stringify(error))); ``` ### Using the inMemory Signer and Importing a key @@ -110,7 +110,7 @@ Tezos.contract return op.confirmation(1).then(() => op.hash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` @@ -129,7 +129,7 @@ Tezos.wallet return op.confirmation(1).then(() => op.opHash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` @@ -161,7 +161,7 @@ Tezos.contract return op.confirmation(1).then(() => op.hash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -181,7 +181,7 @@ Tezos.wallet return op.confirmation(1).then(() => op.opHash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/sapling.md b/docs/sapling.md index 8df3266bb3..afc5b4000f 100644 --- a/docs/sapling.md +++ b/docs/sapling.md @@ -100,7 +100,7 @@ saplingToolkit.getSaplingTransactionViewer() return txViewer.getBalance(); }) .then((balance) => println(`Alice's balance is ${balance.toString()} mutez`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` ## How to retrieve my transaction history? @@ -132,8 +132,8 @@ saplingToolkit.getSaplingTransactionViewer() println(`Fetching Alice's history of transactions in the shielded pool...`); return txViewer.getIncomingAndOutgoingTransactions(); }) - .then((history) => println(`Alice's transaction history is ${stringify(history, null, 2)}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .then((history) => println(`Alice's transaction history is $JSON.stringify(history, null, 2)}`)) + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` ## How to prepare a shielded transaction? diff --git a/docs/sapling_in_memory_viewing_key.md b/docs/sapling_in_memory_viewing_key.md index d9cb0ee18d..2a3ce77d69 100644 --- a/docs/sapling_in_memory_viewing_key.md +++ b/docs/sapling_in_memory_viewing_key.md @@ -25,7 +25,7 @@ InMemoryViewingKey.fromSpendingKey( const viewingKey = inMemoryViewingKey.getFullViewingKey() println(`The viewing key is ${viewingKey.toString('hex')}`); }) -.catch((error) => println(`Error: ${stringify(error, null, 2)}`)); +.catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -41,7 +41,7 @@ InMemoryViewingKey.fromSpendingKey( const viewingKey = inMemoryViewingKey.getFullViewingKey() println(`The viewing key is ${viewingKey.toString('hex')}`); }) -.catch((error) => println(`Error: ${stringify(error, null, 2)}`)); +.catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -57,6 +57,6 @@ const inMemoryViewingKey = new InMemoryViewingKey( ); inMemoryViewingKey.getAddress() -.then((address) => println(`The address is ${stringify(address, null, 2)}`)) -.catch((error) => println(`Error: ${stringify(error, null, 2)}`)); +.then((address) => println(`The address is $JSON.stringify(address, null, 2)}`)) +.catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` \ No newline at end of file diff --git a/docs/signing.md b/docs/signing.md index a8e1d92e8d..bc62070904 100644 --- a/docs/signing.md +++ b/docs/signing.md @@ -167,8 +167,8 @@ const packed = packDataBytes( ); Tezos.signer .sign(packed.bytes) - .then((signed) => println(stringify(signed, null, 2))) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .then((signed) => printlnJSON.stringify(signed, null, 2))) + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` First, you provide the Michelson code to be signed as a string along with its type. diff --git a/docs/smartcontracts.md b/docs/smartcontracts.md index ad9437186a..0ad76db5bc 100644 --- a/docs/smartcontracts.md +++ b/docs/smartcontracts.md @@ -91,7 +91,7 @@ Tezos.contract .at('KT1KAUbe1gsdw5BeVQfgjh9xZFrHrKVs8ApD') .then((c) => { let methods = c.parameterSchema.ExtractSignatures(); - println(stringify(methods, null, 2)); + printlnJSON.stringify(methods, null, 2)); }) .catch((error) => console.log(`Error: ${error}`)); ``` @@ -106,7 +106,7 @@ Tezos.wallet .at('KT1KAUbe1gsdw5BeVQfgjh9xZFrHrKVs8ApD') .then((c) => { let methods = c.parameterSchema.ExtractSignatures(); - println(stringify(methods, null, 2)); + printlnJSON.stringify(methods, null, 2)); }) .catch((error) => console.log(`Error: ${error}`)); ``` @@ -139,7 +139,7 @@ Tezos.contract .at('KT1KAUbe1gsdw5BeVQfgjh9xZFrHrKVs8ApD') .then((c) => { let incrementParams = c.methods.increment(2).toTransferParams(); - println(stringify(incrementParams, null, 2)); + printlnJSON.stringify(incrementParams, null, 2)); }) .catch((error) => console.log(`Error: ${error}`)); ``` @@ -153,7 +153,7 @@ Tezos.wallet .at('KT1KAUbe1gsdw5BeVQfgjh9xZFrHrKVs8ApD') .then((c) => { let incrementParams = c.methods.increment(2).toTransferParams(); - println(stringify(incrementParams, null, 2)); + printlnJSON.stringify(incrementParams, null, 2)); }) .catch((error) => console.log(`Error: ${error}`)); ``` @@ -192,7 +192,7 @@ Tezos.contract return op.confirmation(3).then(() => op.hash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -213,7 +213,7 @@ Tezos.wallet return op.confirmation(3).then(() => op.opHash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -248,14 +248,14 @@ Tezos.contract .then((contract) => { println(`List all contract methods: ${Object.keys(contract.methods)}\n`); println( - `Inspect the signature of the 'set_child_record' contract method: ${stringify( + `Inspect the signature of the 'set_child_record' contract method: $JSON.stringify( contract.methods.set_child_record().getSignature(), null, 2 )}` ); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` The preceding example returns an array which contains the different possible signatures. Different signatures are possible as the `set_child_record` method contains some optional arguments. In the following example the `set_child_record` method is called by passing the arguments in the flattened way: @@ -286,7 +286,7 @@ importKey(Tezos, secretKey) return op.confirmation().then(() => op.hash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -302,14 +302,14 @@ Tezos.contract .then((contract) => { println(`List all contract methods: ${Object.keys(contract.methodsObject)}\n`); println( - `Inspect the signature of the 'set_child_record' contract method: ${stringify( + `Inspect the signature of the 'set_child_record' contract method: $JSON.stringify( contract.methodsObject.set_child_record().getSignature(), null, 2 )}` ); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` The preceding example returns an object giving indication on how to structure the parameter when calling the`set_child_record` method. Here is an example where the `set_child_record` method is called by passing the parameter in an object format: @@ -339,7 +339,7 @@ importKey(Tezos, secretKey) return op.confirmation().then(() => op.hash); }) .then((hash) => println(`Operation injected: https://ghost.tzstats.com/${hash}`)) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/storage_annotations.md b/docs/storage_annotations.md index a6e52c15dc..711f4518d8 100644 --- a/docs/storage_annotations.md +++ b/docs/storage_annotations.md @@ -56,7 +56,7 @@ Tezos.contract .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -83,7 +83,7 @@ Tezos.wallet .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -131,7 +131,7 @@ Tezos.contract .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -158,7 +158,7 @@ Tezos.wallet .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -208,7 +208,7 @@ Tezos.contract .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -236,7 +236,7 @@ Tezos.wallet .then(() => { println(`Origination completed.`); }) - .catch((error) => println(`Error: ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` \ No newline at end of file diff --git a/docs/tzip12.md b/docs/tzip12.md index b70e0ac8f1..b2e3974277 100644 --- a/docs/tzip12.md +++ b/docs/tzip12.md @@ -101,9 +101,9 @@ Tezos.contract.at(contractAddress, compose(tzip12, tzip16)) return contract.tzip12().getTokenMetadata(tokenId); }) .then (tokenMetadata => { - println(stringify(tokenMetadata, null, 2)); + printlnJSON.stringify(tokenMetadata, null, 2)); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -125,9 +125,9 @@ Tezos.wallet.at(contractAddress, compose(tzip12, tzip16)) return wallet.tzip12().getTokenMetadata(tokenId); }) .then (tokenMetadata => { - println(stringify(tokenMetadata, null, 2)); + printlnJSON.stringify(tokenMetadata, null, 2)); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -166,7 +166,7 @@ Tezos.contract.at(contractAddress, tzip16) println(`symbol: ${bytes2Char((Object.values(result)[1]).get('symbol'))}`); println(`extra: ${bytes2Char((Object.values(result)[1]).get('extra'))}`); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -195,7 +195,7 @@ Tezos.wallet.at(contractAddress, tzip16) println(`symbol: ${bytes2Char((Object.values(result)[1]).get('symbol'))}`); println(`extra: ${bytes2Char((Object.values(result)[1]).get('extra'))}`); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -266,9 +266,9 @@ Tezos.contract.at(contractAddress, tzip12) return contract.tzip12().getTokenMetadata(tokenId); }) .then (tokenMetadata => { - println(stringify(tokenMetadata, null, 2)); + printlnJSON.stringify(tokenMetadata, null, 2)); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` @@ -289,9 +289,9 @@ Tezos.wallet.at(contractAddress, tzip12) return wallet.tzip12().getTokenMetadata(tokenId); }) .then (tokenMetadata => { - println(stringify(tokenMetadata, null, 2)); + printlnJSON.stringify(tokenMetadata, null, 2)); }) -.catch(error => println(`Error: ${stringify(error, null, 2)}`)); +.catch(error => println(`Error: $JSON.stringify(error, null, 2)}`)); ``` diff --git a/docs/version.md b/docs/version.md index 4f3b9d5c46..2f13076a1b 100644 --- a/docs/version.md +++ b/docs/version.md @@ -2163,7 +2163,7 @@ const storageType = { }; const storageSchema = new Schema(storageType); const extractSchema = storageSchema.ExtractSchema(); -println(stringify(extractSchema, null, 2)); +printlnJSON.stringify(extractSchema, null, 2)); ``` *before version 10.0.0-beta, the returned value was:* ```typescript= @@ -2213,7 +2213,7 @@ const storageType = { }; const storageSchema = new Schema(storageType); const extractSchema = storageSchema.ExtractSchema(); -println(stringify(extractSchema, null, 2)); +printlnJSON.stringify(extractSchema, null, 2)); ``` *before version 10.0.0-beta the returned value was:* ```json= diff --git a/docs/wallet_API.md b/docs/wallet_API.md index e6a69a51f4..f16b0d92a7 100644 --- a/docs/wallet_API.md +++ b/docs/wallet_API.md @@ -248,7 +248,7 @@ Tezos.wallet return op.confirmation().then(() => op.opHash); }) .then(() => println(`Operation injected!`)) - .catch((error) => println(`Error: ${error} ${stringify(error, null, 2)}`)); + .catch((error) => println(`Error: ${error} $JSON.stringify(error, null, 2)}`)); ``` Transactions to smart contracts operate in the same fashion as transactions to an implicit account, the only difference being the `KT1...` address. You will also receive a transaction hash and have to wait for the transaction to be confirmed. Once confirmed, it can be the right time to update the user's/contract's balance, for example. diff --git a/example/deploy-docs-live-code-contracts.ts b/example/deploy-docs-live-code-contracts.ts index 3029171997..6776eff3c6 100644 --- a/example/deploy-docs-live-code-contracts.ts +++ b/example/deploy-docs-live-code-contracts.ts @@ -180,7 +180,7 @@ async function originateTheContracts() { contract_catalogue.forEach((value, key) => { jsonObject[key] = value; }); - console.log(stringify(jsonObject)); + console.logJSON.stringify(jsonObject)); } } @@ -585,7 +585,7 @@ async function originateTzip16Storage() { const metadataBigMap = new MichelsonMap(); metadataBigMap.set('', char2Bytes('tezos-storage:here')); - metadataBigMap.set('here', char2Bytes(stringify(metadataJSON))); + metadataBigMap.set('here', char2BytesJSON.stringify(metadataJSON))); const tacoShopStorageMap = new MichelsonMap(); @@ -697,7 +697,7 @@ async function originateTzip16OnChainJSON() { try { const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set('', char2Bytes('tezos-storage:here')); - metadataBigMAp.set('here', char2Bytes(stringify(metadataViewsExample1))); + metadataBigMAp.set('here', char2BytesJSON.stringify(metadataViewsExample1))); const op = await tezos.contract.originate({ code: contractCode, @@ -720,7 +720,7 @@ async function originateTzip16OnChainMultiply() { try { const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set('', char2Bytes('tezos-storage:here')); - metadataBigMAp.set('here', char2Bytes(stringify(metadataViewsExample2))); + metadataBigMAp.set('here', char2BytesJSON.stringify(metadataViewsExample2))); const op = await tezos.contract.originate({ code: contractCode, diff --git a/example/encode-michelson.ts b/example/encode-michelson.ts index a8b33d5a5d..e96183522e 100644 --- a/example/encode-michelson.ts +++ b/example/encode-michelson.ts @@ -16,11 +16,11 @@ const example = async () => { console.log('Example 1') const exp1 = p.parseMichelineExpression(ex1) - console.log(stringify(exp1)) + console.logJSON.stringify(exp1)) console.log('Example 2') const exp2 = p.parseMichelineExpression(ex2) - console.log(stringify(exp2)) + console.logJSON.stringify(exp2)) } catch (ex) { console.log(ex) diff --git a/example/example-bigmap-keys-as-deep-pair.ts b/example/example-bigmap-keys-as-deep-pair.ts index 2e352a996b..f84b1121b0 100644 --- a/example/example-bigmap-keys-as-deep-pair.ts +++ b/example/example-bigmap-keys-as-deep-pair.ts @@ -20,7 +20,7 @@ const example = async () => { const parsed_storage: any = p.parseMichelineExpression(example_storage_in_michelson ) const schema = new Schema(parsed_storage); - console.log(stringify(schema.ExtractSchema(), null, 2)) + console.logJSON.stringify(schema.ExtractSchema(), null, 2)) } catch (ex) { console.log(ex) } diff --git a/example/example-bigmap-keys-as-pair.ts b/example/example-bigmap-keys-as-pair.ts index b4e0904a12..b4db7d795d 100644 --- a/example/example-bigmap-keys-as-pair.ts +++ b/example/example-bigmap-keys-as-pair.ts @@ -20,7 +20,7 @@ const example = async () => { const parsed_storage: any = p.parseMichelineExpression(example_storage_in_michelson ) const schema = new Schema(parsed_storage); - console.log(stringify(schema.ExtractSchema(), null, 2)) + console.logJSON.stringify(schema.ExtractSchema(), null, 2)) } catch (ex) { console.log(ex) } diff --git a/example/example-tzip-16-contract-origination-hostile-strings.ts b/example/example-tzip-16-contract-origination-hostile-strings.ts index 85f3ef4134..ef94c33101 100644 --- a/example/example-tzip-16-contract-origination-hostile-strings.ts +++ b/example/example-tzip-16-contract-origination-hostile-strings.ts @@ -35,7 +35,7 @@ async function example() { const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set("", char2Bytes('tezos-storage:here')); - metadataBigMAp.set("here", char2Bytes(stringify(metadataJSON))) + metadataBigMAp.set("here", char2BytesJSON.stringify(metadataJSON))) const tacoShopStorageMap = new MichelsonMap(); diff --git a/example/example-tzip-16-on-chain-one.ts b/example/example-tzip-16-on-chain-one.ts index 78d6d86530..d2232a139a 100644 --- a/example/example-tzip-16-on-chain-one.ts +++ b/example/example-tzip-16-on-chain-one.ts @@ -15,7 +15,7 @@ async function example() { const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set("", char2Bytes('tezos-storage:here')); - metadataBigMAp.set("here", char2Bytes(stringify(metadataViewsExample1))) + metadataBigMAp.set("here", char2BytesJSON.stringify(metadataViewsExample1))) const op = await tezos.contract.originate({ code: contractCode, diff --git a/example/example-tzip-16-on-chain-two.ts b/example/example-tzip-16-on-chain-two.ts index 6c071c160d..6090f3d029 100644 --- a/example/example-tzip-16-on-chain-two.ts +++ b/example/example-tzip-16-on-chain-two.ts @@ -15,7 +15,7 @@ async function example() { const metadataBigMAp = new MichelsonMap(); metadataBigMAp.set("", char2Bytes('tezos-storage:here')); - metadataBigMAp.set("here", char2Bytes(stringify(metadataViewsExample2))) + metadataBigMAp.set("here", char2BytesJSON.stringify(metadataViewsExample2))) const op = await tezos.contract.originate({ code: contractCode, diff --git a/example/example-tzip-16-storage.ts b/example/example-tzip-16-storage.ts index dd7ebefd93..1731101b80 100644 --- a/example/example-tzip-16-storage.ts +++ b/example/example-tzip-16-storage.ts @@ -26,7 +26,7 @@ async function example() { const metadataBigMap = new MichelsonMap(); metadataBigMap.set("", char2Bytes('tezos-storage:here')); - metadataBigMap.set("here", char2Bytes(stringify(metadataJSON))) + metadataBigMap.set("here", char2BytesJSON.stringify(metadataJSON))) // Ligo Taco shop contract modified to include metadata in storage // https://ide.ligolang.org/p/-uS469slzUlSm1zwNqHl1A diff --git a/example/example-tzip-16.ts b/example/example-tzip-16.ts index e529fc5bd6..3921577a79 100644 --- a/example/example-tzip-16.ts +++ b/example/example-tzip-16.ts @@ -9,7 +9,7 @@ async function example() { tezos.addExtension(new Tzip16Module()); const contract = await tezos.contract.at("KT1JZVozQHLZN7TaACnX6NGBxUkhNjn6tmTB", tzip16) const metadata = await contract.tzip16().getMetadata(); - console.log(stringify(metadata, null, 2)); + console.logJSON.stringify(metadata, null, 2)); } catch (ex) { console.error(ex); diff --git a/website/src/theme/CodeBlock/index.js b/website/src/theme/CodeBlock/index.js index f54accc4c8..9d18107ab7 100755 --- a/website/src/theme/CodeBlock/index.js +++ b/website/src/theme/CodeBlock/index.js @@ -84,7 +84,6 @@ export default ({ const { Parser, packDataBytes } = await import('@taquito/michel-codec'); const { RpcClient } = await import('@taquito/rpc'); const { SaplingToolkit, InMemorySpendingKey, InMemoryViewingKey } = await import('@taquito/sapling'); - const { stringify } = await import('@taquito/core'); let wallet; if (typeof window !== 'undefined') { @@ -136,7 +135,6 @@ export default ({ ECDSA, Path, generateSecretKey, - stringify, }); } if (!dependencies) { @@ -191,7 +189,6 @@ export default ({ ECDSA: dependencies?.ECDSA, Path: dependencies?.Path, generateSecretKey: dependencies?.generateSecretKey, - stringify: dependencies?.stringify, }} code={children.trim()} theme={prism.theme || defaultTheme}