title: "CLI & SDK quickstart" description: "This quickstart guide will show you how to use the CLI and the SDK to send SOL." keywords:
- solana cli send transaction
- send SOL using SDK
- transfer SOL using CLI
- set up Solana Javascript SDK
import { Turnkey } from '@turnkey/sdk-server'; | |
import { logger } from '../utils/logger.js'; | |
import fetch from 'node-fetch'; | |
const turnkey = new Turnkey({ | |
apiBaseUrl: process.env.TURNKEY_API_BASE_URL || 'https://api.turnkey.com', | |
apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY, | |
apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY, | |
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID, | |
}); |
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | |
import { Turnkey } from "npm:@turnkey/sdk-server"; | |
import { corsHeaders } from "../_shared/cors.ts"; | |
const turnkey = new Turnkey({ | |
apiBaseUrl: "https://api.turnkey.com", | |
apiPrivateKey: Deno.env.get("TURNKEY_API_PRIVATE_KEY")!, | |
apiPublicKey: Deno.env.get("TURNKEY_API_PUBLIC_KEY")!, | |
defaultOrganizationId: Deno.env.get("TURNKEY_ORGANIZATION_ID")!, | |
}); |
import {TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID} from '@solana/spl-token' | |
import {useConnection, useWallet, WalletContextState} from '@solana/wallet-adapter-react' | |
import { | |
Connection, | |
LAMPORTS_PER_SOL, | |
PublicKey, | |
SystemProgram, | |
TransactionMessage, | |
TransactionSignature, | |
VersionedTransaction, |
title: "CLI & SDK quickstart" description: "This quickstart guide will show you how to use the CLI and the SDK to send SOL." keywords:
// "@solana/web3.js": "^1.87.6", | |
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js'; | |
import dotenv from 'dotenv'; | |
dotenv.config(); | |
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed'); | |
const payerSecretKey = JSON.parse(process.env.PAYER); | |
const payer = Keypair.fromSecretKey(Uint8Array.from(payerSecretKey)); |
import pyaudio | |
import numpy as np | |
import os | |
import time | |
import ctypes | |
from colorama import Fore, Back, init | |
# Initialize colorama | |
init(autoreset=True) |
use solana_program::{ | |
account_info::{AccountInfo}, | |
entrypoint, | |
entrypoint::ProgramResult, | |
msg, | |
pubkey::Pubkey, | |
}; | |
entrypoint!(process_instruction); |
import NonFungibleToken from 0x631e88ae7f1d7c20; | |
import MetadataViews from 0x631e88ae7f1d7c20; | |
pub contract CatMoji: NonFungibleToken { | |
pub var totalSupply: UInt64 | |
pub event ContractInitialized() | |
pub event Withdraw(id: UInt64, from: Address?) | |
pub event Deposit(id: UInt64, to: Address?) |
// SPDX-License-Identifier: MIT | |
// Source: | |
// https://github.com/ensdomains/ens-contracts/blob/master/contracts/ethregistrar/StringUtils.sol | |
pragma solidity >=0.8.4; | |
library StringUtils { | |
/** | |
* @dev Returns the length of a given string | |
* | |
* @param s The string to measure the length of |
// https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountsbyowner | |
import axios from "axios"; | |
async function getTokenAccounts(address: string) { | |
try { | |
return new Promise(async (resolve, reject) => { | |
let data = { | |
jsonrpc: "2.0", | |
id: 1, | |
method: "getProgramAccounts", |