💡Configuration
How to configure the intents sdk
In order to create new intents and send it to the auctioneer network where a network of solvers will try to give the best quote for your cross-chain swap, we need to create a blockchain client for your specific chain.
Set up EVM Chains (Arbitrum, Optimism, Base)
For EVM-compatible chains, we use the EVMSDK
class to create a client that can interact with Ethereum-based blockchains for sending orders as source chain.
Configuration for Local Accounts (e.g. private key/mnemonic wallets.)
Local accounts are cryptocurrency wallets controlled through private keys or seed phrases. This configuration is typically employed in server-side applications or situations that need automatic transaction signing and wallet operations.
import { ChainID, EVMSDK } from "@shogun-network/intents-sdk";
// Create EVM client for Arbitrum
const evmClient = new EVMSDK({
chainId: ChainID.Arbitrum, // Supported: Arbitrum, Optimism, Base
privateKey: '0x1234567890abcdef...', // Your private key with 0x prefix
rpcProviderUrl: 'https://arb1.arbitrum.io/rpc' // Optional: custom RPC endpoint
});
Configuration for wallet providers (e.g. Browser Extension Wallets, WalletConnect, etc.).
Wallet providers like browser extensions (MetaMask, Coinbase Wallet) and WalletConnect offer secure, user-friendly wallet integration. Users maintain control of their private keys while benefiting from familiar interfaces and enhanced security through established authentication mechanisms.
For EVM chains, we use Permit2 with EIP-712 to enable gasless token approvals and standardized signing. This approach reduces transaction costs and provides a consistent user experience across different wallets.
const order = Order.create({ ... })
// Creates EIP-712 typed data for signing with wallet.
const { orderTypedData, nonce } = getEvmOrderTypedData(order);
// Front-end should then call auctioneer with the provided signature...
Set up Solana
For Solana blockchain, we use the SolanaSDK
class to create a client that can interact with the Solana network for sending orders as source chain.
Configuration for Local Accounts (e.g. private key/mnemonic wallets.)
import { SolanaSDK } from "@shogun-network/intents-sdk";
// Create Solana client
const solanaClient = new SolanaSDK({
privateKey: 'base58-encoded-private-key', // Your Solana private key in Base58 format
commitment: 'finalized', // Transaction confirmation level: 'finalized' or 'confirmed'
rpcProviderUrl: 'https://api.mainnet-beta.solana.com' // Optional: custom RPC endpoint
});
Configuration for wallet providers (e.g. Browser Extension Wallets, Phantom, etc.).
We provide the order key pair and the set of instructions to be signed by the wallet provider.
const order = Order.create({ ... });
// Generate Solana-specific transaction instructions for the order
const { orderKeyPair, instructions } = await getSolanaOrderInstructions(order);
// Execute these instructions on the Solana network
// Send the order's public key to the auctioneer to initiate the intent
Set up Sui
For the Sui blockchain, we use the SuiSDK
class to create a client that communicates with the Sui network.
Configuration for Local Accounts (e.g. private key/mnemonic wallets.)
import { SuiSDK } from "@shogun-network/intents-sdk";
// Create Sui client
const suiClient = new SuiSDK({
privateKey: 'hex-encoded-private-key' // Your Sui private key in hex format
});
Configuration for wallet providers (e.g. Browser Extension Wallets, Phantom, etc.).
We provide a function in order to get the transaction builder that should be executed onchain later
const order = Order.create({ ... });
const transaction = await getSuiOrderTransaction(order);
// Execute this transaction with your wallet provider
// Send the tx digest to auctioneer
Last updated