Repository navigation
Getting Started
Bundler:
# Gemfile
gem 'mixin_bot'bundle installOr directly:
gem install mixin_botThe gem ships the mixinbot executable. The separate mixin native CLI is optional — it is used only by encode_raw_transaction_native and decode_raw_transaction_native.
Configure credentials on the global configuration, then call the API:
require 'mixin_bot'
MixinBot.configure do
self.app_id = '25696f85-b7b4-4509-8c3f-2684a8fc4a2a'
self.session_id = '25696f85-b7b4-4509-8c3f-2684a8fc4a2a'
self.session_private_key = 'base64-ed25519-or-pem-rsa-key'
self.server_public_key = 'base64-or-hex-public-key'
self.spend_key = 'base64-encoded-spend-key' # required for Safe transfers
end
puts MixinBot.api.me['full_name']
MixinBot.api.assets.each { |a| puts "#{a['symbol']}: #{a['balance']}" }MixinBot.api is a singleton MixinBot::API bound to the global configuration. For an additional bot, build a dedicated instance — see Configuration.
result = MixinBot.api.create_transfer(
members: '6ae1c7ae-1df1-498e-8f21-d48cb6d129b5',
asset_id: '965e5c6e-434c-3fa9-b780-c50f43cd955c',
amount: '0.01',
memo: 'test transfer',
trace_id: SecureRandom.uuid
)
puts result['transaction_hash']spend_key must be configured (or passed per call) — the Safe pipeline signs with it. create_transfer selects UTXOs, builds, verifies, signs and submits in one call; see Safe Pipeline.
Note: Several convenience methods (
meand friends) historically return the innerdatahash.MixinBot::Models::ApiEnvelopealso allowsres['data']['user_id']style access — see Models.
- Ruby >= 4.0 (
mixin_bot.gemspecsetsrequired_ruby_version >= 4.0.0) - Bundler 2.6+ recommended
- Optional
mixinCLI for the native encoder helpers
| Command | Purpose |
|---|---|
rake |
Default task: test + rubocop
|
rake test |
Offline test suite (WebMock stubs) |
rake test_live |
Live API tests (LIVE=1 rake test, needs test/config.yml) |
rake mixin_bot:api_coverage |
Compare the endpoint catalog with the Go SDK |
rake rdoc |
Generate doc/
|
rake build |
Build the .gem package |
rake publish |
Build and push to RubyGems |