Installation
Command Line
# Make sure your project is using Go Modules
go mod init
# Install otim-go-sdk
go get github.com/otimlabs/otim-go-sdk
# Initialize your project
pnpm init
# Install otim-sdk-server
pnpm add @otim/sdk-server
Initialize the Client
main.go
package main
import (
"context"
"fmt"
"log"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/otimlabs/otim-go-sdk/client"
"github.com/otimlabs/otim-go-sdk/signer"
)
func main() {
ctx := context.Background()
// Initialize the signer with your private key
ethSigner, err := signer.NewEthSigner("<YOUR_OTIM_PRIVATE_KEY>")
if err != nil {
log.Fatal("Failed to create signer:", err)
}
// Create the client
otimClient, err := client.NewClient(
ethSigner,
"https://api.otim.com",
"<YOUR_OTIM_API_KEY>",
)
if err != nil {
log.Fatal("Failed to create client:", err)
}
fmt.Println("Otim client initialized successfully")
}
import { chains, createOtimServerClient, prepareSettlement } from '@otim/sdk-server';
async function main() {
const client = createOtimServerClient({
appId: "<YOUR_OTIM_APP_ID>",
privateKey: "<YOUR_OTIM_PRIVATE_KEY>",
publicKey: "<YOUR_OTIM_PUBLIC_KEY>",
apiKey: "<YOUR_OTIM_API_KEY>",
environment: "production", // or "sandbox" for testnets
});
await client.init();
console.log('Otim client initialized successfully');
}
main().catch(console.error);