Hot answers tagged

7

Taquito can parse forged bytes using the parse() method in the @taquito/local-forging package. TypeDocs are here. You can see the unit tests here. Implementation to decode a signed transaction: const { localForger } = require('@taquito/local-forging'); const sbytes = '...


7

You can use the tezos-codec binary to decode this: tezos-codec decode 006-PsCARTHA.operation from ...


5

As of Taquito release v6.1.0-beta.0 Taquito offers a new API for Maps which support pairs as keys in Maps and BigMaps. Here's a link to documentation & examples on Accessing Map values using Pairs


4

This is not something you will be able to achieve with Taquito (at least not for now, that will change in the future) and you have to use an indexer API. I recommend Better Call Dev API, you can easily get the number of keys with a fetch call to api.better-call.dev/v1/bigmap/${network}/${big_map_id}/keys (the big map ID should be available in Taquito by ...


4

The contract you point to takes a single parameter of type address. Thus, as you write, it only has the default entrypoint. In taquito, the main entry point can be call through contract.methods.main. So your call should be: contract.methods.main(contractAddress).send()


4

There is no formula that will give you the full cost and gas usage of smart contract invocation. The best method is to simulate. Contract code size and storage directly affects costs through storage burn. Parameter size indirectly affect fees through gas size. See: Here for an overview on different fees and burns in Tezos. Here for a more detailed ...


3

After working with @taquito/rpc for a little while and having success there I also discovered in the main @taquito/taquito package there's some useful things you can subscribe to on the stream. A simple example to listen for new block hashes: const tezos = new TezosToolkit("http://localhost:8732"); const blockSub = tezos.stream.subscribe("...


3

It is not possible using Taquito alone. You must use an indexer to extract all the key/value pairs from a big map (Better Call Dev is developed by Baking Bad who also offers an indexer API). This will however be possible in the near future as Taquito will soon be able to plug into any indexer and extract all the values from a big map.


3

You can call toTransferParams({amount: 5}) on the method you want to estimate, and pass that result to Tezos.estimate.transfer() The results of which will look something like: Estimate { _gasLimit: 66993, _storageLimit: 0, opSize: 216, baseFeeMutez: 100 } Full example: Tezos.contract.at('KT1KBhwoSeqJt26oK8yjubTfdSgDuaVC87xR')) .then(contract =>...


2

You can use the RPC endpoint: /chains/main/blocks/head/helpers/parse/operations to do that. Example: await axios.post( `${nodeURL}/chains/main/blocks/head/helpers/parse/operations`, parseOperationBytesData, { headers: { 'Content-Type': 'application/json' } } ...


2

I ran your code, and found out that your payload hash is not correct; these lines of code: const payload: string = bufferToHexString(Buffer.from(bb)); await sodium.ready; const payloadHash = bufferToHexString(Buffer.from(sodium.crypto_generichash(32, payload))) . The function sodium.crypto_generichash involving the hashing of a uint8array and the ...


2

Util Link: base58.ml The pre-apply RPC call validates the signature prefix, while the inject operation call doesn't. You should use the specific curve prefix. sig([4, 130, 43]) # sig(96) generic signature (Used after the operation injection) edsig([9, 245, 205, 134, 18]) # edsig(99) ED25519 signature (Used for tz1 signatures) spsig1([13, 115, 101, 19, 63]) #...


2

As of Taquito release v6.1.0-beta.0 Taquito offers a new API for Maps which provides you with get and set calls. The API does not offer an optional default value param, You will have to catch the error and assign your value. We will change the behaviour of get to return undefined on the unknown key. I will update this issue when it is released. You can ...


2

From my experience with Harbinger I believe it's best practice to pull the data from the Normalizer contracts, as opposed to the Storage contracts. The Normalizer contract gives you a volume weighted average so you know the numbers won't be skewed. Here's how I pulled the price feed with async/await syntax: // Ping Oracle contract const contract = ...


2

The correct syntax for the parameter is the following: "remove", [account1, account2] (2 different parameters, no object). I built a simple contract to emulate your case, deployed it and wrote a little script to test it. After calling the entrypoint of your choice, you must provide 2 parameters: 1- the field you want to set the union value with 2- ...


2

There is https://github.com/baking-bad/netezos, a .NET Standard 2.0 library for working with Tezos. You can easily use it to interact with Tezos node via RPC, manage keys (it also supports Ledger), forge and send operations, etc. This library is actively developing (by the way, mscappini, author of Tz.Net, is also working with us on Netezos v2) and soon we ...


2

First, note that there is work in progress to implement on-chain events for Tezos: TZIP and MR. At the moment however, I don't think you have a choice other than using an indexer. In addition to tzindex that you mentioned, there is also Nomadic Labs Tezos indexer.


2

Yes, that is possible with TzKT API (it's free and open-source), which allows you to specify a path to a particular part in the storage you want to receive. For example, if a contract has the following storage: { "vesting": { "vesting_schedule": { "next_payout": "2019-09-29T08:30:00Z", ...


2

The issue is caused by an invalid IPFS link. Steps to FIX the issue: Update the metadata (including views, etc...) Copy the generated JSON Upload the metadata JSON to IPFS You can use Pinata for this. Update the metadata link in the code Replace all occurences of sp.metadata_of_url("https://example.com") with sp.metadata_of_url("<...


2

The bytes2Char function from the @taquito/utils package will convert these bytes to a string. The char2bytes is the counterpart that does the reverse.


1

Tezos Taquito has docs on how to drain an account which you can find here: https://tezostaquito.io/docs/drain_account It covers how to drain implicit and originated accounts.


1

[Edit] As Simon has suggested, the fee has been reduced, and the only restriction is to have 1 mutez left on the account or undelegate the account if the account is used for delegation. Jev suggested a link to the newly provided documentation. Tezos does not allow for sending the whole address balance, some dust left on the account is required to be able to ...


1

I suspect you are using Taquito's Contract API, but the Wallet API should be used to interact with a wallet. For example: const contract = await tezos.wallet.at(contractAddress); Instead of : const contract = await tezos.contract.at(contractAddress); More details on the wallet API here: https://tezostaquito.io/docs/wallet_API#calling-a-smart-contract


1

wallet.connect seems to indicate you are using the @temple-wallet/dapp package. If you are using TypeScript, there is the TempleDAppNetwork enum that you can import from the package with all the different network names. With the right settings on your editor, you should get a list of the network names when you type the parameter of wallet.connect :)


1

First of all, there is an error in your Javascript, you cannot name the array indices and assign them a value, instead of [from_ = sender ...], just write [sender ...]. Then, the argument for the creation of an FA2 token through Taquito is formatted in this way: [{ from_: sender, txs: [{to_: recipient, token_id: token_id, amount: amountOfTokens}]}]. This is ...


1

Yes, you can get the function signature, not just the function names. This can be done like this. const contract: ContractAbstraction<ContractProvider> = client.contract.at(this.state.contractAddress); const signatures: string[][] = contract.parameterSchema.ExtractSignatures(); signatures will then contain an array of an array of strings, where ...


1

I believe the error is that you pass the 2 parameters (add and remove), but you should only pass the chosen one. I suggest you try : { add: [account1, account2] }


1

The syntax is correct for Taquito, you declare a set as a JavaScript array. The error seems to be coming from the fact that sets can only hold comparable values and you try to use it with cryptographic signatures, which is not a comparable type.


1

If you want to do it with Taquito, the confirmation method on the operation object returns a promise with different information like the block, the status, etc. You can also use confirmationObservable to get the same information with an observable. For more detailed information, you will have to use an indexer like Better Call Dev (although Taquito is ...


1

If you just want the balance of the contract, you should directly look in its storage. What you are doing now is calling an entry point which will cause the contract to call another contract and pass its balance as as an input. There are circumstances where this might be what you want but, in that case, you will need to pass two parameters, one being the key ...


Only top voted, non community-wiki answers of a minimum length are eligible