diff --git a/src/ExecuteExample.ts b/src/ExecuteExample.ts index 2d5d5543..ebc7d6e1 100644 --- a/src/ExecuteExample.ts +++ b/src/ExecuteExample.ts @@ -22,6 +22,10 @@ import requestOperationBeacon from "./examples/getting-started-operation-request import requestOperationTaquito from "./examples/getting-started-operation-request.taquito"; import requestPermissionsBeacon from "./examples/getting-started-permission-request.beacon"; import requestPermissionsTaquito from "./examples/getting-started-permission-request.taquito"; +import infoConnectionBeacon from "./examples/info-connection.beacon"; +import infoConnectionTaquito from "./examples/info-connection.taquito"; +import infoVersionBeacon from "./examples/info-version.beacon"; +import infoVersionTaquito from "./examples/info-version.taquito"; import networkCustomBeacon from "./examples/network-custom-network.beacon"; import networkCustomTaquito from "./examples/network-custom-network.taquito"; import networkEdonetWithRpcBeacon from "./examples/network-edonet-with-url.beacon"; @@ -194,6 +198,24 @@ export class ExecuteExample { case "taquito different node": await differentNodeTaquito(updateLogs); break; + case "beacon sdk version": + await infoVersionBeacon(updateLogs); + break; + case "taquito sdk version": + await infoVersionTaquito(updateLogs); + break; + case "beacon sdk client": + await infoVersionBeacon(updateLogs); + break; + case "taquito sdk client": + await infoVersionTaquito(updateLogs); + break; + case "beacon sdk connection": + await infoConnectionBeacon(updateLogs); + break; + case "taquito sdk connection": + await infoConnectionTaquito(updateLogs); + break; default: break; } diff --git a/src/docs/advanced/sdk-info.mdx b/src/docs/advanced/sdk-info.mdx index ebf8f512..567abf73 100644 --- a/src/docs/advanced/sdk-info.mdx +++ b/src/docs/advanced/sdk-info.mdx @@ -16,6 +16,7 @@ import TabItem from "@theme/TabItem"; ```ts live +// beacon sdk version import { BEACON_VERSION, SDK_VERSION } from "@airgap/beacon-sdk"; console.log("SDK Version", SDK_VERSION); @@ -27,6 +28,7 @@ console.log("Beacon Version", BEACON_VERSION); ```ts live +// taquito sdk version import { BEACON_VERSION, SDK_VERSION } from "@airgap/beacon-sdk"; console.log("SDK Version", SDK_VERSION); @@ -47,6 +49,7 @@ console.log("Beacon Version", BEACON_VERSION); ```ts live +// beacon sdk client import { DAppClient } from "@airgap/beacon-sdk"; const dAppClient = new DAppClient({ name: "Beacon Docs" }); @@ -60,6 +63,7 @@ console.log(`Connected Peers:`, await dAppClient.getPeers()); ```ts live +// taquito sdk client import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; @@ -86,6 +90,7 @@ console.log(`Connected Peers:`, await wallet.client.getPeers()); ```ts live +// beacon sdk connection import { DAppClient, NetworkType } from "@airgap/beacon-sdk"; const dAppClient = new DAppClient({ name: "Beacon Docs" }); @@ -121,6 +126,7 @@ console.log("Own Metadata:", ownMetadata); ```ts live +// taquito sdk connection import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; import { DAppClient, NetworkType } from "@airgap/beacon-sdk"; diff --git a/src/examples/info-client.beacon.ts b/src/examples/info-client.beacon.ts index a5a656fc..818f7b53 100644 --- a/src/examples/info-client.beacon.ts +++ b/src/examples/info-client.beacon.ts @@ -1,12 +1,15 @@ /// START import { DAppClient } from "../node_modules/beacon-sdk/dist/cjs"; +import Logger from "../Logger"; /// END -async () => { +const infoClientBeacon = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START const dAppClient = new DAppClient({ name: "Beacon Docs" }); - console.log(`Connected Accounts:`, await dAppClient.getAccounts()); - console.log(`Connected Peers:`, await dAppClient.getPeers()); + logger.log(`Connected Accounts:`, await dAppClient.getAccounts()); + logger.log(`Connected Peers:`, await dAppClient.getPeers()); /// END }; +export default infoClientBeacon; diff --git a/src/examples/info-client.taquito.ts b/src/examples/info-client.taquito.ts index d04b7389..80d48c22 100644 --- a/src/examples/info-client.taquito.ts +++ b/src/examples/info-client.taquito.ts @@ -1,16 +1,19 @@ /// START import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; +import Logger from "../Logger"; /// END -async () => { +const infoVersionTaquito = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START const Tezos = new TezosToolkit("https://mainnet-tezos.giganode.io"); const wallet = new BeaconWallet({ name: "Beacon Docs Taquito" }); Tezos.setWalletProvider(wallet); - console.log(`Connected Accounts:`, await wallet.client.getAccounts()); - console.log(`Connected Peers:`, await wallet.client.getPeers()); + logger.log(`Connected Accounts:`, await wallet.client.getAccounts()); + logger.log(`Connected Peers:`, await wallet.client.getPeers()); /// END }; +export default infoVersionTaquito; diff --git a/src/examples/info-connection.beacon.ts b/src/examples/info-connection.beacon.ts index 23e66fef..c6000102 100644 --- a/src/examples/info-connection.beacon.ts +++ b/src/examples/info-connection.beacon.ts @@ -1,8 +1,10 @@ /// START import { DAppClient, NetworkType } from "../node_modules/beacon-sdk/dist/cjs"; +import Logger from "../Logger"; /// END -async () => { +const infoConnectionBeacon = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START const dAppClient = new DAppClient({ name: "Beacon Docs" }); @@ -10,26 +12,27 @@ async () => { "tz1MJx9vhaNRSimcuXPK2rW4fLccQnDAnVKJ", { type: NetworkType.MAINNET }, ); - console.log("Address Link", addressLink); + logger.log("Address Link", addressLink); const txLink = await dAppClient.blockExplorer.getTransactionLink( "onzCRJhQ9zPC38TLGhBTghCW7WAJpfUJ2NpwbbQKbW6LeEL8RfK", { type: NetworkType.MAINNET }, ); - console.log("Transaction Link", txLink); + logger.log("Transaction Link", txLink); - console.log("\n\nConnection Info:\n"); - console.log("Status:", dAppClient.connectionStatus); + logger.log("\n\nConnection Info:\n"); + logger.log("Status:", dAppClient.connectionStatus); const accounts = await dAppClient.getAccounts(); - console.log("Accounts:", accounts); + logger.log("Accounts:", accounts); const peers = await dAppClient.getPeers(); - console.log("Peers:", peers); + logger.log("Peers:", peers); - console.log("\n\nDebug:\n"); - console.log("Local Beacon ID:", await dAppClient.beaconId); + logger.log("\n\nDebug:\n"); + logger.log("Local Beacon ID:", await dAppClient.beaconId); const colorMode = await dAppClient.getColorMode(); - console.log("Color Mode:", colorMode); + logger.log("Color Mode:", colorMode); const ownMetadata = await dAppClient.getOwnAppMetadata(); - console.log("Own Metadata:", ownMetadata); + logger.log("Own Metadata:", ownMetadata); /// END }; +export default infoConnectionBeacon; diff --git a/src/examples/info-connection.taquito.ts b/src/examples/info-connection.taquito.ts index a0d5708c..e4b25778 100644 --- a/src/examples/info-connection.taquito.ts +++ b/src/examples/info-connection.taquito.ts @@ -1,10 +1,12 @@ /// START import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; -import { DAppClient, NetworkType } from "../node_modules/beacon-sdk/dist/cjs"; +import { NetworkType } from "../node_modules/beacon-sdk/dist/cjs"; +import Logger from "../Logger"; /// END -async () => { +const infoConnectionTaquito = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START const Tezos = new TezosToolkit("https://mainnet-tezos.giganode.io"); const wallet = new BeaconWallet({ name: "Beacon Docs Taquito" }); @@ -15,26 +17,27 @@ async () => { "tz1MJx9vhaNRSimcuXPK2rW4fLccQnDAnVKJ", { type: NetworkType.MAINNET }, ); - console.log("Address Link", addressLink); + logger.log("Address Link", addressLink); const txLink = await wallet.client.blockExplorer.getTransactionLink( "onzCRJhQ9zPC38TLGhBTghCW7WAJpfUJ2NpwbbQKbW6LeEL8RfK", { type: NetworkType.MAINNET }, ); - console.log("Transaction Link", txLink); + logger.log("Transaction Link", txLink); - console.log("\n\nConnection Info:\n"); - console.log("Status:", wallet.client.connectionStatus); + logger.log("\n\nConnection Info:\n"); + logger.log("Status:", wallet.client.connectionStatus); const accounts = await wallet.client.getAccounts(); - console.log("Accounts:", accounts); + logger.log("Accounts:", accounts); const peers = await wallet.client.getPeers(); - console.log("Peers:", peers); + logger.log("Peers:", peers); - console.log("\n\nDebug:\n"); - console.log("Local Beacon ID:", await wallet.client.beaconId); + logger.log("\n\nDebug:\n"); + logger.log("Local Beacon ID:", await wallet.client.beaconId); const colorMode = await wallet.client.getColorMode(); - console.log("Color Mode:", colorMode); + logger.log("Color Mode:", colorMode); const ownMetadata = await wallet.client.getOwnAppMetadata(); - console.log("Own Metadata:", ownMetadata); + logger.log("Own Metadata:", ownMetadata); /// END }; +export default infoConnectionTaquito; diff --git a/src/examples/info-version.beacon.ts b/src/examples/info-version.beacon.ts index 6529308d..103a83bb 100644 --- a/src/examples/info-version.beacon.ts +++ b/src/examples/info-version.beacon.ts @@ -3,11 +3,14 @@ import { BEACON_VERSION, SDK_VERSION, } from "../node_modules/beacon-sdk/dist/cjs"; +import Logger from "../Logger"; /// END -async () => { +const infoVersionBeacon = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START - console.log("SDK Version", SDK_VERSION); - console.log("Beacon Version", BEACON_VERSION); + logger.log("SDK Version", SDK_VERSION); + logger.log("Beacon Version", BEACON_VERSION); /// END }; +export default infoVersionBeacon; diff --git a/src/examples/info-version.taquito.ts b/src/examples/info-version.taquito.ts index 6529308d..48537859 100644 --- a/src/examples/info-version.taquito.ts +++ b/src/examples/info-version.taquito.ts @@ -3,11 +3,14 @@ import { BEACON_VERSION, SDK_VERSION, } from "../node_modules/beacon-sdk/dist/cjs"; +import Logger from "../Logger"; /// END -async () => { +const infoVersionTaquito = async (loggerFun: Function) => { + const logger = new Logger(loggerFun); /// START - console.log("SDK Version", SDK_VERSION); - console.log("Beacon Version", BEACON_VERSION); + logger.log("SDK Version", SDK_VERSION); + logger.log("Beacon Version", BEACON_VERSION); /// END }; +export default infoVersionTaquito;