Skip to content

Commit

Permalink
chore: rollback safe stringify in doc files
Browse files Browse the repository at this point in the history
  • Loading branch information
ac10n committed Oct 5, 2023
1 parent 520e7da commit 441e6fb
Show file tree
Hide file tree
Showing 34 changed files with 157 additions and 160 deletions.
4 changes: 2 additions & 2 deletions docs/cancel_http_requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}
Expand Down
10 changes: 5 additions & 5 deletions docs/complex_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)}`));
```
8 changes: 4 additions & 4 deletions docs/contract-test-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`));
```

</TabItem>
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions docs/drain_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -156,5 +156,5 @@ Tezos.signer
});
});
})
.catch((error) => println(`Error: ${stringify(error, null, 2)}`));
.catch((error) => println(`Error: $JSON.stringify(error, null, 2)}`));
```
12 changes: 6 additions & 6 deletions docs/estimate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`));
```

</TabItem>
Expand All @@ -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)}`));
```

</TabItem>
Expand Down Expand Up @@ -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)}`));
```


Expand Down Expand Up @@ -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)}`));
```

</TabItem>
Expand Down Expand Up @@ -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)}`));
```

</TabItem>
Expand Down Expand Up @@ -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)}`));
```

</TabItem>
Expand Down
12 changes: 6 additions & 6 deletions docs/inmemory_signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)}`));
```


Expand Down
12 changes: 6 additions & 6 deletions docs/lambda_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`));
```

<!-- ```js live noInline
Expand All @@ -71,7 +71,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:**
Expand All @@ -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)}`));
```

<!-- ```js live noInline
Expand All @@ -97,7 +97,7 @@ Tezos.contract
return contract.views.getBalance('tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5').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)}`));
``` -->
4 changes: 2 additions & 2 deletions docs/ledger_signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`));
```

</TabItem>
Expand All @@ -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)}`));
```

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/making_transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 441e6fb

Please sign in to comment.