
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@printr/sdk
Advanced tools
TypeScript SDK for the Printr API - create and manage tokens across EVM chains and Solana
TypeScript SDK for Printr — create and manage tokens across EVM chains and Solana.
npm install @printr/sdk
# or
bun add @printr/sdk
# or
yarn add @printr/sdk
import { createPrintrClient, buildToken } from '@printr/sdk';
const client = createPrintrClient({
apiKey: process.env.PRINTR_API_KEY!,
baseUrl: process.env.PRINTR_API_BASE_URL ?? 'https://api-preview.printr.money',
});
const result = await buildToken(
{
creator_accounts: ['eip155:8453:0xYourAddress'],
name: 'My Token',
symbol: 'TKN',
description: 'A cool token',
chains: ['eip155:8453'], // Base
initial_buy: { spend_usd: 10 },
},
client,
);
if (result.isOk()) {
console.log('Token created:', result.value.token_id);
}
import { signAndSubmitEvm } from '@printr/sdk/evm';
import { ResultAsync } from 'neverthrow';
// Chain buildToken directly into signing
buildToken(input, client)
.andThen(({ token_id, payload }) =>
ResultAsync.fromPromise(
signAndSubmitEvm(payload, process.env.EVM_WALLET_PRIVATE_KEY!),
(e) => ({ message: e instanceof Error ? e.message : String(e) }),
).map((tx) => ({ token_id, tx }))
)
.match(
({ token_id, tx }) => console.log('Token:', token_id, 'TX:', tx.tx_hash),
(err) => console.error('Failed:', err.message),
);
import { checkEvmBalance } from '@printr/sdk/balance';
// checkEvmBalance returns ResultAsync — chain directly or await
const balance = await checkEvmBalance(
'0xYourWalletAddress',
8453, // Base chain ID
21000, // gas limit estimate
);
balance.match(
({ balanceFormatted, symbol, sufficient }) =>
console.log(`Balance: ${balanceFormatted} ${symbol} (sufficient: ${sufficient})`),
(err) => console.error('Balance fetch failed:', err), // 'no_rpc' | 'fetch_failed'
);
import { executeTransfer } from '@printr/sdk/transfer';
import { getChainMeta } from '@printr/sdk/chains';
const meta = getChainMeta('eip155:8453')!;
const result = await executeTransfer(
'eip155', // namespace
'8453', // chainRef (Base)
'0xRecipientAddress',
'1.5', // amount in native token units
process.env.EVM_WALLET_PRIVATE_KEY!,
meta,
);
if (result.isOk()) {
console.log('tx_hash' in result.value ? result.value.tx_hash : result.value.signature);
}
The SDK is organized into focused modules that can be imported individually:
// Main exports
import { createPrintrClient, buildToken } from '@printr/sdk';
// Client utilities
import { createPrintrClient } from '@printr/sdk/client';
// Chain information
import { CHAIN_META, getChainMeta } from '@printr/sdk/chains';
// EVM operations
import { signAndSubmitEvm, normalisePrivateKey } from '@printr/sdk/evm';
// Solana operations
import { signAndSubmitSvm, getSvmRpcUrl } from '@printr/sdk/svm';
// Balance queries
import { checkEvmBalance, checkSvmBalance, getEvmNativeBalance } from '@printr/sdk/balance';
// Token transfers
import { executeTransfer, transferEvm, transferSvm } from '@printr/sdk/transfer';
// Wallet keystore
import { addWallet, decryptKey, encryptKey, listWallets } from '@printr/sdk/keystore';
// Image generation
import { generateImageFromPrompt, generateTokenImage } from '@printr/sdk/image';
// CAIP utilities — both return null for invalid input (never throw)
import { parseCaip2, parseCaip10, chainTypeFromCaip2 } from '@printr/sdk/caip';
// Staking API
import {
listStakePositionsWithRewards,
claimStakingRewards,
parseStakingCaip10,
formatStakingCaip10,
StakingLockPeriod,
} from '@printr/sdk';
| Variable | Description |
|---|---|
PRINTR_API_KEY | Optional API key. Defaults to public AI integration key |
PRINTR_API_BASE_URL | API base URL (default: https://api-preview.printr.money) |
OPENROUTER_API_KEY | For AI image generation |
OPENROUTER_IMAGE_MODEL | Image model override (default: google/gemini-2.5-flash-image) |
EVM_WALLET_PRIVATE_KEY | Default EVM private key for signing |
SVM_WALLET_PRIVATE_KEY | Default Solana keypair secret for signing |
PRINTR_DEPLOYMENT_PASSWORD | Master password for encrypted keystore (min 16 chars) |
The SDK uses AES-256-GCM encryption with scrypt key derivation to securely store wallet private keys:
import { encryptKey, addWallet, listWallets, type WalletEntry } from '@printr/sdk/keystore';
import { randomUUID } from 'node:crypto';
// Encrypt a private key and build a WalletEntry
const encrypted = encryptKey('0x...', password);
const entry: WalletEntry = {
id: randomUUID(),
label: 'my-evm-wallet',
chain: 'eip155:8453',
address: '0xYourAddress',
...encrypted,
createdAt: Date.now(),
};
// Persist to ~/.printr/wallets.json
addWallet(entry);
// List all stored wallets (keys are encrypted — address is safe to read)
const wallets = listWallets();
console.log(wallets.map((w) => `${w.label}: ${w.address}`));
eip155:1eip155:56eip155:130eip155:143eip155:999eip155:4326eip155:5000eip155:8453eip155:9745eip155:42161eip155:43114solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpcreatePrintrClient(options?: {
apiKey?: string;
baseUrl?: string;
}): PrintrClient
buildToken(input: BuildTokenInput, client: PrintrClient): ResultAsync<BuildTokenOutput, PrintrApiError>
getToken(tokenId: string, client: PrintrClient): ResultAsync<TokenDetails, PrintrApiError>
quoteToken(input: QuoteInput, client: PrintrClient): ResultAsync<QuoteOutput, PrintrApiError>
// Low-level: throws on error — wrap in ResultAsync.fromPromise or try/catch
signAndSubmitEvm(payload: EvmPayload, privateKey: string, rpcUrl?: string): Promise<EvmSubmitResult>
signAndSubmitSvm(payload: SvmPayload, privateKey: string, rpcUrl?: string): Promise<SvmSubmitResult>
// High-level transfer (Result-safe):
executeTransfer(namespace, chainRef, toAddress, amount, privateKey, meta): ResultAsync<TransferResult, TransferError>
import { generateImageFromPrompt } from '@printr/sdk/image';
const result = await generateImageFromPrompt(
'A futuristic digital coin with purple glow',
{ openrouterApiKey: process.env.OPENROUTER_API_KEY! },
);
if (result.isOk()) {
// result.value is a raw base64 string (no data-URI prefix)
console.log('Image base64 length:', result.value.length);
}
import { CHAIN_META, getChainMeta } from '@printr/sdk/chains';
// List all supported chains
console.log(CHAIN_META);
// Get specific chain info
const base = getChainMeta('eip155:8453');
console.log(base?.name); // "Base"
Most operations return ResultAsync<T, E> from neverthrow — a typed, chainable async result that never throws.
// Preferred: .match() for expression-style dispatch
buildToken(input, client).match(
(value) => console.log('Token ID:', value.token_id),
(error) => console.error('Failed:', error.message),
);
// Chain operations without awaiting
buildToken(input, client)
.andThen(({ token_id, payload }) =>
ResultAsync.fromPromise(signAndSubmitEvm(payload, privateKey), (e) => e as Error)
.map((tx) => ({ token_id, tx }))
)
.match(
({ token_id, tx }) => console.log(token_id, tx.tx_hash),
(err) => console.error(err),
);
// Await to get Result<T, E> for imperative control flow
const result = await buildToken(input, client);
if (result.isErr()) {
console.error('Error:', result.error.message);
return;
}
console.log('Token ID:', result.value.token_id);
The SDK is written in TypeScript and exports all types:
import type {
BuildTokenInput,
BuildTokenOutput,
QuoteInput,
QuoteOutput,
TokenDetails,
Chain,
Keystore,
} from '@printr/sdk';
# Install dependencies
bun install
# Build
bun run build
# Test
bun test
# Type check
bun run typecheck
Apache-2.0
FAQs
TypeScript SDK for the Printr API - create and manage tokens across EVM chains and Solana
We found that @printr/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.