remitmd 0.2.1 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75be0a5249f87323f7c007b13b7b89f9e2153557b355381000b7d3d007adcfc0
4
- data.tar.gz: e0f9b80bc11f7eb9888f037cba3589548a3344bdba9f621994142f5b20a3b14d
3
+ metadata.gz: 7726bbaff2286aa99b1f12cf78138e376d620b6063dfc2c844cc3334d9d3af56
4
+ data.tar.gz: 438d8d1cff61e10468d5ef368bde13ffc291a977362ba6d4bde447f1bbaf8892
5
5
  SHA512:
6
- metadata.gz: 5198b515870956a99eccee4152e991d4fc32f6f03acd5a91a499b9c853b57da2c0b3cad4657381e1524553f10d021415b1d9202ce35848eb06331e5420758c73
7
- data.tar.gz: 5bcaab9bc1d75389f524ad3ab36920a02bf9dbacf68792c6492f8bc04a6ebb2197725a73342191a26c2debf7dceddf31a3247968e82f470c228fe76203a51df0
6
+ metadata.gz: 54b55932ceeff519a091e3a745e862feae46ccf9fd9dcc53ce66a6556f11c9a641c57f96ec10b2d82d7d391deb931caff6402263edb320027d3db9ffd6dd213c
7
+ data.tar.gz: 0aae67743e0462a6081ad907f97203d921b456beef974a81df3825c5b324e377d0c9702b8f72a7e7fed7e213ec8a2dab0455ac2c55f4b4e6148ee46cbbe8881c
data/lib/remitmd/a2a.rb CHANGED
@@ -188,23 +188,26 @@ module Remitmd
188
188
  # @param memo [String] optional memo
189
189
  # @param mandate [IntentMandate, nil] optional intent mandate
190
190
  # @return [A2ATask]
191
- def send(to:, amount:, memo: "", mandate: nil)
191
+ def send(to:, amount:, memo: "", mandate: nil, permit: nil)
192
192
  nonce = SecureRandom.hex(16)
193
193
  message_id = SecureRandom.hex(16)
194
194
 
195
+ data = {
196
+ model: "direct",
197
+ to: to,
198
+ amount: format("%.2f", amount),
199
+ memo: memo,
200
+ nonce: nonce,
201
+ }
202
+ data[:permit] = permit_to_h(permit) if permit
203
+
195
204
  message = {
196
205
  messageId: message_id,
197
206
  role: "user",
198
207
  parts: [
199
208
  {
200
209
  kind: "data",
201
- data: {
202
- model: "direct",
203
- to: to,
204
- amount: format("%.2f", amount),
205
- memo: memo,
206
- nonce: nonce,
207
- },
210
+ data: data,
208
211
  },
209
212
  ],
210
213
  }
@@ -230,6 +233,16 @@ module Remitmd
230
233
 
231
234
  private
232
235
 
236
+ def permit_to_h(permit)
237
+ {
238
+ value: permit.value.to_s,
239
+ deadline: permit.deadline.to_s,
240
+ v: permit.v,
241
+ r: permit.r,
242
+ s: permit.s,
243
+ }
244
+ end
245
+
233
246
  def rpc(method, params, call_id)
234
247
  body = { jsonrpc: "2.0", id: call_id, method: method, params: params }
235
248
  data = @transport.post(@path, body)
@@ -67,11 +67,11 @@ module Remitmd
67
67
 
68
68
  alias to_s inspect
69
69
 
70
- # Check all three conditions for CliSigner activation.
70
+ # Check conditions for CliSigner activation.
71
71
  #
72
72
  # 1. CLI binary found on PATH (via `which` / `where`)
73
- # 2. Keystore file exists at ~/.remit/keys/default.enc
74
- # 3. REMIT_KEY_PASSWORD env var is set
73
+ # 2. Meta file at ~/.remit/keys/default.meta (keychain — no password needed), OR
74
+ # 3. Keystore file at ~/.remit/keys/default.enc AND REMIT_KEY_PASSWORD env var set
75
75
  #
76
76
  # @param cli_path [String] path or name of the remit CLI binary
77
77
  # @return [Boolean]
@@ -81,11 +81,15 @@ module Remitmd
81
81
  _out, _err, st = Open3.capture3(which_cmd, cli_path)
82
82
  return false unless st.success?
83
83
 
84
- # 2. Keystore file exists
85
- keystore = File.join(Dir.home, ".remit", "keys", "default.enc")
84
+ keys_dir = File.join(Dir.home, ".remit", "keys")
85
+
86
+ # 2. Keychain meta file — no password needed
87
+ return true if File.exist?(File.join(keys_dir, "default.meta"))
88
+
89
+ # 3. Encrypted keystore + password
90
+ keystore = File.join(keys_dir, "default.enc")
86
91
  return false unless File.exist?(keystore)
87
92
 
88
- # 3. REMIT_KEY_PASSWORD set
89
93
  password = ENV["REMIT_KEY_PASSWORD"]
90
94
  return false if password.nil? || password.empty?
91
95
 
@@ -169,7 +169,7 @@ module Remitmd
169
169
  class Reputation < Model
170
170
  def initialize(attrs)
171
171
  h = attrs.transform_keys(&:to_s)
172
- @address = h["address"]
172
+ @address = h["wallet"] || h["address"]
173
173
  @score = h["score"].to_i
174
174
  @total_paid = decimal(h["total_paid"])
175
175
  @total_received = decimal(h["total_received"])
@@ -335,7 +335,7 @@ module Remitmd
335
335
  )
336
336
 
337
337
  # Encode tabId as bytes32: ASCII bytes right-padded with zeroes
338
- tab_id_bytes = tab_id.b.ljust(32, "\x00".b)
338
+ tab_id_bytes = tab_id.b[0, 32].ljust(32, "\x00".b)
339
339
 
340
340
  struct_data = type_hash + tab_id_bytes + abi_uint256(total_charged_base_units) + abi_uint256(call_count)
341
341
  struct_hash = keccak256_raw(struct_data)
data/lib/remitmd.rb CHANGED
@@ -26,5 +26,5 @@ require_relative "remitmd/x402_paywall"
26
26
  # mock.was_paid?("0x0000000000000000000000000000000000000001", 1.00) # => true
27
27
  #
28
28
  module Remitmd
29
- VERSION = "0.2.1"
29
+ VERSION = "0.2.4"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remitmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - remit.md
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-27 00:00:00.000000000 Z
11
+ date: 2026-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec