@@ -938,10 +938,135 @@ const totalSize = memoryManager.calculateStackSpace([
938938console.log('Total structure size:', totalSize, 'bytes');` ,
939939 demoUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/assembly-bpf' ,
940940 sourceUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/assembly-bpf'
941+ } ,
942+ // C++ SDK Examples
943+ {
944+ id : 'cpp-basic-payment' ,
945+ title : 'C++ Basic Payment Integration' ,
946+ description : 'Simple payment URL creation and processing using C++ SDK' ,
947+ category : 'C++' ,
948+ difficulty : 'Beginner' ,
949+ tech : [ 'C++17' , 'CMake' , 'SVM-Pay C++ SDK' ] ,
950+ preview : `#include <iostream>
951+ #include <svm-pay/svm_pay.hpp>
952+
953+ using namespace svm_pay;
954+
955+ int main() {
956+ // Initialize the SDK
957+ initialize_sdk();
958+
959+ // Create a client
960+ Client client(SVMNetwork::SOLANA);
961+
962+ // Create a simple transfer URL
963+ std::string recipient = "7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn";
964+ std::string amount = "1.5";
965+
966+ std::unordered_map<std::string, std::string> options = {
967+ {"label", "Coffee Shop"},
968+ {"message", "Payment for coffee and pastry"},
969+ {"memo", "Order #12345"}
970+ };
971+
972+ std::string payment_url = client.create_transfer_url(recipient, amount, options);
973+ std::cout << "Payment URL: " << payment_url << std::endl;
974+
975+ return 0;
976+ }` ,
977+ demoUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/basic-payment' ,
978+ sourceUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/basic-payment'
979+ } ,
980+ {
981+ id : 'cpp-url-parsing' ,
982+ title : 'C++ URL Parsing and Validation' ,
983+ description : 'Parse and validate different types of SVM-Pay URLs with C++' ,
984+ category : 'C++' ,
985+ difficulty : 'Intermediate' ,
986+ tech : [ 'C++17' , 'URL Parsing' , 'SVM-Pay C++ SDK' ] ,
987+ preview : `#include <iostream>
988+ #include <vector>
989+ #include <svm-pay/svm_pay.hpp>
990+
991+ using namespace svm_pay;
992+
993+ int main() {
994+ initialize_sdk();
995+ Client client;
996+
997+ // Test URLs for different networks and types
998+ std::vector<std::string> test_urls = {
999+ // Solana transfer
1000+ "solana:7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn?amount=1.5&label=Coffee%20Shop",
1001+
1002+ // USDC transfer
1003+ "solana:7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn?amount=100&spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
1004+
1005+ // Cross-chain transfer
1006+ "solana:7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn?amount=50&source-network=ethereum&bridge=wormhole",
1007+
1008+ // Sonic network
1009+ "sonic:7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn?amount=2.0&memo=Sonic%20payment"
1010+ };
1011+
1012+ for (const auto& url : test_urls) {
1013+ auto request = client.parse_url(url);
1014+ std::cout << "Network: " << network_to_string(request->network) << std::endl;
1015+ }
1016+
1017+ return 0;
1018+ }` ,
1019+ demoUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/url-parsing' ,
1020+ sourceUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/url-parsing'
1021+ } ,
1022+ {
1023+ id : 'cpp-network-adapters' ,
1024+ title : 'C++ Network Adapters' ,
1025+ description : 'Working with different network adapters for multi-chain support' ,
1026+ category : 'C++' ,
1027+ difficulty : 'Advanced' ,
1028+ tech : [ 'C++17' , 'Network Adapters' , 'Async Operations' , 'SVM-Pay C++ SDK' ] ,
1029+ preview : `#include <iostream>
1030+ #include <thread>
1031+ #include <chrono>
1032+ #include <svm-pay/svm_pay.hpp>
1033+
1034+ using namespace svm_pay;
1035+
1036+ int main() {
1037+ initialize_sdk();
1038+ Client client;
1039+
1040+ // Check available network adapters
1041+ NetworkAdapter* solana_adapter = client.get_adapter(SVMNetwork::SOLANA);
1042+ if (solana_adapter) {
1043+ std::cout << "✓ Solana adapter available" << std::endl;
1044+
1045+ // Create transfer transaction
1046+ TransferRequest transfer_request(
1047+ SVMNetwork::SOLANA,
1048+ "7v91N7iZ9eyTktBwWC2ckrjdLhvmS4R1HqvYZzG5FGvn",
1049+ "1.5"
1050+ );
1051+ transfer_request.label = "Test Payment";
1052+ transfer_request.memo = "SDK Example";
1053+
1054+ // Submit transaction asynchronously
1055+ auto future = solana_adapter->submit_transaction(transfer_request);
1056+
1057+ // Wait for result
1058+ auto result = future.get();
1059+ std::cout << "Transaction submitted: " << result.transaction_id << std::endl;
1060+ }
1061+
1062+ return 0;
1063+ }` ,
1064+ demoUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/network-adapters' ,
1065+ sourceUrl : 'https://github.com/openSVM/svm-pay/tree/main/examples/cpp-examples/network-adapters'
9411066 }
9421067]
9431068
944- const categories = [ 'All' , 'Getting Started' , 'Cross-Chain' , 'Advanced' , 'E-commerce' , 'Gaming' , 'DeFi' , 'SaaS' , 'Social' , 'Enterprise' , 'Mobile' , 'IoT' , 'Assembly-BPF' , 'Tools' , 'NFT' ]
1069+ const categories = [ 'All' , 'Getting Started' , 'Cross-Chain' , 'Advanced' , 'E-commerce' , 'Gaming' , 'DeFi' , 'SaaS' , 'Social' , 'Enterprise' , 'Mobile' , 'IoT' , 'Assembly-BPF' , 'C++' , ' Tools', 'NFT' ]
9451070const difficulties = [ 'All' , 'Beginner' , 'Intermediate' , 'Advanced' , 'Expert' ]
9461071
9471072export function ExamplesPage ( ) {
0 commit comments