@pod-protocol/sdk
Version:
TypeScript SDK for PoD Protocol - AI agent communication on Solana
112 lines • 4.09 kB
TypeScript
/**
* Web3.js v2.0 Migration Helper Utilities
*
* This file contains utility functions to help complete the migration
* from Solana Web3.js v1.x to v2.0 for the PoD Protocol SDK.
*/
import type { Address } from '@solana/addresses';
import type { MigrationStatus } from "../types";
/**
* Convert a string to an Address type (Web3.js v2.0)
*/
export declare function stringToAddress(str: string): Address;
/**
* Convert an Address to string (Web3.js v2.0 - Address is already a string)
*/
export declare function addressToString(addr: Address): string;
/**
* Check if a string is a valid Solana address
*/
export declare function isValidAddress(addr: string): boolean;
/**
* System Program ID constant for Web3.js v2.0
*/
export declare const SYSTEM_PROGRAM_ID = "11111111111111111111111111111112";
/**
* Common program IDs as Address types
*/
export declare const PROGRAM_IDS: {
readonly SYSTEM: Address<"11111111111111111111111111111112">;
readonly TOKEN: Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
readonly TOKEN_2022: Address<"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb">;
readonly ASSOCIATED_TOKEN: Address<"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL">;
};
/**
* Legacy RPC response wrapper for gradual migration
*/
export interface LegacyRpcResponse<T> {
value: T;
context?: {
slot: number;
};
}
/**
* Wrap modern RPC responses to match legacy format temporarily
*/
export declare function wrapRpcResponse<T>(value: T, slot?: number): LegacyRpcResponse<T>;
/**
* Migration status checker
*/
export declare function checkMigrationStatus(): Promise<MigrationStatus>;
/**
* Convert legacy account filters to v2.0 format
*/
export declare function convertAccountFilters(legacyFilters: any[]): any[];
/**
* Format error messages for v2.0 migration issues
*/
export declare function formatMigrationError(originalError: any): Error;
/**
* Common type guards for v2.0 migration
*/
export declare const TypeGuards: {
isAddress: (value: any) => value is Address;
isLegacyAddress: (value: any) => boolean;
isKeyPairSigner: (value: any) => boolean;
};
/**
* Migration constants
*/
export declare const MIGRATION_CONFIG: {
readonly VERSION: "2.0.0";
readonly COMPLETION_PERCENTAGE: 85;
readonly CRITICAL_FILES: readonly ["types.ts", "client.ts", "services/agent.ts", "services/message.ts", "services/channel.ts", "services/escrow.ts"];
readonly REMAINING_FILES: readonly ["services/analytics.ts", "services/discovery.ts"];
};
/**
* Quick migration validator
*/
export declare function validateMigration(fileName: string): {
isValid: boolean;
issues: string[];
};
declare const _default: {
stringToAddress: typeof stringToAddress;
addressToString: typeof addressToString;
isValidAddress: typeof isValidAddress;
SYSTEM_PROGRAM_ID: string;
PROGRAM_IDS: {
readonly SYSTEM: Address<"11111111111111111111111111111112">;
readonly TOKEN: Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
readonly TOKEN_2022: Address<"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb">;
readonly ASSOCIATED_TOKEN: Address<"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL">;
};
wrapRpcResponse: typeof wrapRpcResponse;
checkMigrationStatus: typeof checkMigrationStatus;
convertAccountFilters: typeof convertAccountFilters;
formatMigrationError: typeof formatMigrationError;
TypeGuards: {
isAddress: (value: any) => value is Address;
isLegacyAddress: (value: any) => boolean;
isKeyPairSigner: (value: any) => boolean;
};
MIGRATION_CONFIG: {
readonly VERSION: "2.0.0";
readonly COMPLETION_PERCENTAGE: 85;
readonly CRITICAL_FILES: readonly ["types.ts", "client.ts", "services/agent.ts", "services/message.ts", "services/channel.ts", "services/escrow.ts"];
readonly REMAINING_FILES: readonly ["services/analytics.ts", "services/discovery.ts"];
};
validateMigration: typeof validateMigration;
};
export default _default;
//# sourceMappingURL=migration-helpers.d.ts.map