mixin_bot 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/mixin_bot/api/app.rb +5 -4
- data/lib/mixin_bot/api/user.rb +11 -4
- data/lib/mixin_bot/version.rb +1 -1
- data/llms.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee9a02bff6da3b4331ff084e75d4f94d10d0a98b50e7b2c899679ec78340c659
|
|
4
|
+
data.tar.gz: 699c595d8f4acfd94041be582b0eda32db2ea4ba4da34359d1fc231d7e6bcbc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad0a66de09acfda9b1a4da94568ec4d704eab3be8f4eb92de145262bd0e74fc4b0efaee1243b16d5876199d270160c2fbd48aced6580af3308ab55117e156205
|
|
7
|
+
data.tar.gz: de638caf39c1af94cb169887f424d48127971f8bcd74c60a3f1b9e338b974c867001931e649244f16523e7d8efa501c6d81f0604c25f04a891cc7412550a45ed
|
data/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGENTS.md — MixinBot
|
|
2
2
|
|
|
3
|
-
Ruby gem (v2.2.
|
|
3
|
+
Ruby gem (v2.2.1): Mixin Network REST SDK + `mixinbot` CLI. Parity targets: [bot-api-go-client](https://github.com/MixinNetwork/bot-api-go-client), [bot-api-nodejs-client](https://github.com/MixinNetwork/bot-api-nodejs-client).
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.2.1] - 2026-05-24
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Billing preflight `increment`** — `ensure_app_billing_credit!` accepts an `increment` parameter (default `0`) instead of reading `app_properties.price`. `create_user` / `create_safe_user` default to `0.5` per billed user; pass `increment: 0` for free-tier headroom.
|
|
15
|
+
|
|
10
16
|
## [2.2.0] - 2026-05-24
|
|
11
17
|
|
|
12
18
|
### Added
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Ruby SDK and CLI for [Mixin Network](https://developers.mixin.one/docs): authent
|
|
|
6
6
|
|
|
7
7
|
The gem aims for **parity with the official [bot-api-go-client](https://github.com/MixinNetwork/bot-api-go-client)** Go SDK and **[bot-api-nodejs-client](https://github.com/MixinNetwork/bot-api-nodejs-client)** Node SDK. See [API_COVERAGE.md](API_COVERAGE.md) for the full mapping; run `rake mixin_bot:api_coverage` to confirm no gaps are marked missing.
|
|
8
8
|
|
|
9
|
-
Current gem version: **2.2.
|
|
9
|
+
Current gem version: **2.2.1** (see [CHANGELOG.md](CHANGELOG.md) for breaking changes and deprecations).
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
data/lib/mixin_bot/api/app.rb
CHANGED
|
@@ -29,21 +29,22 @@ module MixinBot
|
|
|
29
29
|
# creating a network user). Skipped when +force+ is true.
|
|
30
30
|
#
|
|
31
31
|
# @param force [Boolean] skip the preflight and call the API anyway
|
|
32
|
+
# @param increment [Numeric, String] estimated cost added to total billing
|
|
33
|
+
# cost for headroom (default +0+)
|
|
32
34
|
# @raise [InsufficientAppBillingError] when +credit+ is not greater than
|
|
33
|
-
# total cost plus
|
|
35
|
+
# total cost plus +increment+
|
|
34
36
|
#
|
|
35
|
-
def ensure_app_billing_credit!(force: false, access_token: nil)
|
|
37
|
+
def ensure_app_billing_credit!(force: false, access_token: nil, increment: 0)
|
|
36
38
|
return if force
|
|
37
39
|
|
|
38
40
|
app_id = config.app_id
|
|
39
41
|
billing = app_billing(app_id, access_token:)['data']
|
|
40
|
-
properties = app_properties(access_token:)['data']
|
|
41
42
|
|
|
42
43
|
credit = billing_decimal billing['credit']
|
|
43
44
|
cost_users = billing_decimal billing.dig('cost', 'users')
|
|
44
45
|
cost_resources = billing_decimal billing.dig('cost', 'resources')
|
|
45
46
|
cost = cost_users + cost_resources
|
|
46
|
-
increment = billing_decimal
|
|
47
|
+
increment = billing_decimal increment
|
|
47
48
|
|
|
48
49
|
return if credit > cost + increment
|
|
49
50
|
|
data/lib/mixin_bot/api/user.rb
CHANGED
|
@@ -23,6 +23,10 @@ module MixinBot
|
|
|
23
23
|
# the new TIP PIN has time to propagate on the server side.
|
|
24
24
|
TIP_PIN_PROPAGATION_DELAY = 1
|
|
25
25
|
|
|
26
|
+
# Billed cost per network user created via {#create_user} (USD), after
|
|
27
|
+
# the free tier. Pass +increment: 0+ to skip headroom for the new user.
|
|
28
|
+
CREATE_USER_BILLING_INCREMENT = '0.5'
|
|
29
|
+
|
|
26
30
|
def user(user_id, access_token: nil)
|
|
27
31
|
path = format('/users/%<user_id>s', user_id:)
|
|
28
32
|
client.get path, access_token:
|
|
@@ -39,11 +43,13 @@ module MixinBot
|
|
|
39
43
|
# @param key [String, nil] optional 32-byte Ed25519 seed
|
|
40
44
|
# @param force [Boolean] when false (default), verify app billing credit
|
|
41
45
|
# headroom before calling the API; when true, skip the preflight
|
|
46
|
+
# @param increment [Numeric, String] billing headroom for the new user
|
|
47
|
+
# (defaults to {CREATE_USER_BILLING_INCREMENT}; use +0+ on free tier)
|
|
42
48
|
# @return [Hash] Mixin response merged with the hex-encoded private key
|
|
43
49
|
# @raise [InsufficientAppBillingError] when billing credit lacks headroom
|
|
44
50
|
#
|
|
45
|
-
def create_user(full_name, key: nil, force: false)
|
|
46
|
-
ensure_app_billing_credit!(force:)
|
|
51
|
+
def create_user(full_name, key: nil, force: false, increment: CREATE_USER_BILLING_INCREMENT)
|
|
52
|
+
ensure_app_billing_credit!(force:, increment:)
|
|
47
53
|
|
|
48
54
|
keypair = JOSE::JWA::Ed25519.keypair key
|
|
49
55
|
session_secret = Base64.urlsafe_encode64 keypair[0], padding: false
|
|
@@ -92,6 +98,7 @@ module MixinBot
|
|
|
92
98
|
# @param spend_key [String, nil] optional 32-byte spend Ed25519 seed
|
|
93
99
|
# @param force [Boolean] forwarded to {#create_user}; see billing preflight
|
|
94
100
|
# there
|
|
101
|
+
# @param increment [Numeric, String] forwarded to {#create_user}
|
|
95
102
|
# @return [Hash] keystore with +:app_id+, +:session_id+,
|
|
96
103
|
# +:session_private_key+, +:server_public_key+ and +:spend_key+
|
|
97
104
|
# @raise [MixinBot::Error] when registration ultimately fails. Transient
|
|
@@ -100,13 +107,13 @@ module MixinBot
|
|
|
100
107
|
# @raise [InsufficientAppBillingError] when {#create_user} billing
|
|
101
108
|
# preflight fails
|
|
102
109
|
#
|
|
103
|
-
def create_safe_user(name, private_key: nil, spend_key: nil, force: false)
|
|
110
|
+
def create_safe_user(name, private_key: nil, spend_key: nil, force: false, increment: CREATE_USER_BILLING_INCREMENT)
|
|
104
111
|
session_keypair = JOSE::JWA::Ed25519.keypair private_key
|
|
105
112
|
spend_keypair = JOSE::JWA::Ed25519.keypair spend_key
|
|
106
113
|
|
|
107
114
|
spend_key_hex = spend_keypair[1].unpack1('H*')
|
|
108
115
|
|
|
109
|
-
user = create_user name, key: session_keypair[1][...32], force: force
|
|
116
|
+
user = create_user name, key: session_keypair[1][...32], force: force, increment: increment
|
|
110
117
|
data = user.fetch('data')
|
|
111
118
|
|
|
112
119
|
keystore = {
|
data/lib/mixin_bot/version.rb
CHANGED
data/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MixinBot
|
|
2
2
|
|
|
3
|
-
> Ruby SDK and CLI for Mixin Network: Safe UTXO transfers, REST API, Blaze messaging, transaction crypto, optional MVM helpers. Ruby >= 3.2. Gem version 2.2.
|
|
3
|
+
> Ruby SDK and CLI for Mixin Network: Safe UTXO transfers, REST API, Blaze messaging, transaction crypto, optional MVM helpers. Ruby >= 3.2. Gem version 2.2.1.
|
|
4
4
|
|
|
5
5
|
Important notes:
|
|
6
6
|
|