Tezos
Tezos
#Installation
Magic interacts with the Tezos blockchain via Magic's extension NPM package @magic-ext/taquito
. The Tezos extension also lets you interact with the blockchain using methods from Tezos's Taquito SDK.
You can skip straight to our kitchen sink example directly:
01npm install --save @magic-ext/taquito
#Initialization
01import { Magic } from 'magic-sdk';
02import { TaquitoExtension } from '@magic-ext/taquito';
03
04const magic = new Magic('YOUR_API_KEY', {
05 extensions: [
06 new TaquitoExtension({
07 rpcUrl: 'TEZOS_RPC_NODE_URL',
08 }),
09 ],
10});
#Common Methods
#Send Transaction
Note that the Magic Taquito extension follows the method names and conventions by Taquito. To send a standard Tezos blockchain transaction, you can call the magic.taquito.createMagicSigner
method to create a signer to inject to Tezos client.
01import { Magic } from 'magic-sdk';
02import { TaquitoExtension } from '@magic-ext/taquito';
03import { TezosToolkit } from '@taquito/taquito';
04
05const magic = new Magic('YOUR_API_KEY', {
06 extensions: [
07 new TaquitoExtension({
08 rpcUrl: 'https://rpc.oxfordnet.teztnets.com',
09 }),
10 ],
11});
12
13const Tezos = new TezosToolkit('https://rpc.oxfordnet.teztnets.com');
14const magicSigner = await magic.taquito.createMagicSigner();
15
16Tezos.setProvider({ signer: magicSigner });
17
18const op = await Tezos.wallet.transfer({ to: destinationAddress, amount: sendXTZAmount });
19
20const result = await op.confirmation();
21
22console.log('result', result)