solrengine-sdp 0.1.0 → 0.2.0

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: bb2f00e8f363ed1bacd78cf67bee25acbf50d1dd488b87fa00f8837512dd354b
4
- data.tar.gz: 3ba656e022c2dfa6a866345d368e92767d085fa711b813cffa8035a3269c3c2b
3
+ metadata.gz: 6fac7a0ecbbf6a3c7f9c8f56f21079965c7b33dad55d2f0050223fab13952b39
4
+ data.tar.gz: cf05ff3fd6363eaab0739b031d7cd0d7de51775ca5b63b2462bc0b87edf6ed81
5
5
  SHA512:
6
- metadata.gz: 2ea6942f560cf9bc6fe428fb8a86d60c2658ce01466ca48937454b48639de37477478d76662caae635f9b038176df739f850a9a78895f78513dce487228254b1
7
- data.tar.gz: ee990fd2117b0acd96da2cd54953de35b215a7aa16459585e3b1e58b58f52ce3ecaae4417e075dc7195b18e36d607a05b982d67c05cf36ed726ca76b0195b6b8
6
+ metadata.gz: e9fee17c0180f8d2615e3b82179c3d18200b64a579ec041374633905d9d316dc30fa0faea741a55c98d996f336136f51d19aa545a45ec874a84a84267bb02b54
7
+ data.tar.gz: 9bcab7a570b2899a883dc4216802e480f5e2d8ee9c1008f31bbb0def8775de424e8aa8ad2251f634eb006faaed65e3c01c993d4ff208527e07ea4f3aa2d8e849
@@ -19,6 +19,11 @@ Solrengine::Sdp.configure do |config|
19
19
  # the Rails application name.
20
20
  # config.label_namespace = "myapp"
21
21
 
22
+ # Default fiat ramp provider (e.g. "bvnk"). The ramps helper injects it so
23
+ # you don't repeat `provider:` on every call: Solrengine::Sdp.ramps.onramp_quote(...).
24
+ # Leave unset to pass `provider:` per call instead.
25
+ # config.ramp_provider = ENV["SDP_RAMP_PROVIDER"]
26
+
22
27
  # The wallet-owner model (the one including Solrengine::Sdp::WalletOwner).
23
28
  # Defaults to "User".
24
29
  # config.user_class = "Account"
@@ -42,3 +47,14 @@ Solrengine::Sdp.configure do |config|
42
47
  # } }
43
48
  # ]
44
49
  end
50
+
51
+ # Token issuance and fiat ramps (new in v0.2) need no extra config — reach them
52
+ # through the client and the ramps helper:
53
+ #
54
+ # Solrengine::Sdp.client.create_token(name: "...", symbol: "...", signing_wallet_id: "...")
55
+ # Solrengine::Sdp.client.mint_token(token_id, signing_wallet_id: "...", destination: "...", amount: "...")
56
+ # Solrengine::Sdp.ramps.onramp_quote(counterparty_id: "...", destination_wallet: "...",
57
+ # crypto_token: "SOL", fiat_currency: "USD", fiat_amount: "100")
58
+ #
59
+ # Ramps are SANDBOX-ONLY in v0.2 (preview). Mint/burn/deploy are money-path:
60
+ # like transfers they need FEE_PAYMENT_PROVIDER=kora on a self-hosted SDP.
@@ -15,7 +15,7 @@ module Solrengine
15
15
  DEFAULT_TRANSFER_POLL_INTERVAL = 3 # seconds — confirmation is usually seconds away
16
16
  DEFAULT_PROVISIONING_LEASE = 10 * 60 # seconds — see provisioning_lease below
17
17
 
18
- attr_writer :api_key, :base_url, :custody_provider, :label_namespace, :logger
18
+ attr_writer :api_key, :base_url, :custody_provider, :ramp_provider, :label_namespace, :logger
19
19
  # provisioning_lease (seconds): how long a wallet-owner row may sit in
20
20
  # "provisioning" untouched before the claim is considered abandoned
21
21
  # (worker died between claim and settle) and another job may take it
@@ -50,6 +50,13 @@ module Solrengine
50
50
  @custody_provider || ENV["SDP_CUSTODY_PROVIDER"]
51
51
  end
52
52
 
53
+ # Default fiat ramp provider (e.g. "bvnk") for the ramps helper, so apps
54
+ # don't repeat `provider:` on every on/off-ramp call. nil is fine — the
55
+ # caller can pass `provider:` per call instead. Sandbox-only in v0.2.
56
+ def ramp_provider
57
+ @ramp_provider || ENV["SDP_RAMP_PROVIDER"]
58
+ end
59
+
53
60
  # Prefix for SDP wallet labels ("#{label_namespace}-user-#{id}").
54
61
  # Defaults to the Rails application name, else "app".
55
62
  def label_namespace
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solrengine
4
+ module Sdp
5
+ # Thin engine wrapper over solana-sdp's ramps surface (SDP fiat on/off-ramps).
6
+ # Its only job is to default `provider:` from config.ramp_provider so apps
7
+ # don't repeat it on every call — the same convenience custody_provider gives
8
+ # wallet calls. Everything else passes straight through to the client; there
9
+ # is no model and no extra state.
10
+ #
11
+ # SANDBOX-ONLY in v0.2: wired against SDP's ramp surface and verified against
12
+ # the sandbox, not live fiat rails. Treat as preview.
13
+ class Ramps
14
+ # provider may be nil (no configured default) — then callers must pass
15
+ # `provider:` per call, and the client validates it.
16
+ def initialize(client:, provider: nil)
17
+ @client = client
18
+ @provider = provider
19
+ end
20
+
21
+ def onramp_currencies(**kwargs)
22
+ @client.onramp_currencies(**with_provider(kwargs))
23
+ end
24
+
25
+ def offramp_currencies(**kwargs)
26
+ @client.offramp_currencies(**with_provider(kwargs))
27
+ end
28
+
29
+ def onramp_quote(**kwargs)
30
+ @client.onramp_quote(**with_provider(kwargs))
31
+ end
32
+
33
+ def onramp_execute(**kwargs)
34
+ @client.onramp_execute(**with_provider(kwargs))
35
+ end
36
+
37
+ def offramp_execute(**kwargs)
38
+ @client.offramp_execute(**with_provider(kwargs))
39
+ end
40
+
41
+ # The sandbox event hook — no provider involved; pure passthrough.
42
+ def simulate_ramp(**payload)
43
+ @client.simulate_ramp(**payload)
44
+ end
45
+
46
+ private
47
+
48
+ # Inject the configured provider unless the caller named one explicitly
49
+ # (an explicit `provider: nil` is honored — it means "don't scope").
50
+ def with_provider(kwargs)
51
+ return kwargs if kwargs.key?(:provider) || @provider.nil?
52
+
53
+ kwargs.merge(provider: @provider)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Solrengine
4
4
  module Sdp
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
 
7
7
  # The SDP release this engine version is tested against. SDP breaks its
8
8
  # API between minors; bump this (and re-verify) on every SDP upgrade.
9
- COMPATIBLE_SDP_VERSION = "0.28"
9
+ COMPATIBLE_SDP_VERSION = "0.31"
10
10
  end
11
11
  end
@@ -10,6 +10,7 @@ require_relative "sdp/configuration"
10
10
  require_relative "sdp/wallet_owner"
11
11
  require_relative "sdp/broadcaster"
12
12
  require_relative "sdp/faucet"
13
+ require_relative "sdp/ramps"
13
14
  require_relative "sdp/engine" if defined?(Rails::Engine)
14
15
 
15
16
  module Solrengine
@@ -33,6 +34,7 @@ module Solrengine
33
34
  def configure
34
35
  yield(configuration)
35
36
  @client = nil
37
+ @ramps = nil
36
38
  configuration
37
39
  end
38
40
 
@@ -41,13 +43,22 @@ module Solrengine
41
43
  def client
42
44
  @client ||= ::Sdp::Client.new(
43
45
  api_key: configuration.validate!.api_key,
44
- base_url: configuration.base_url
46
+ base_url: configuration.base_url,
47
+ custody_provider: configuration.custody_provider
45
48
  )
46
49
  end
47
50
 
51
+ # Thin ramps helper bound to the configured client + default ramp
52
+ # provider. Reset alongside the client whenever configure runs.
53
+ # Sandbox-only in v0.2 (see Solrengine::Sdp::Ramps).
54
+ def ramps
55
+ @ramps ||= Ramps.new(client: client, provider: configuration.ramp_provider)
56
+ end
57
+
48
58
  def reset_configuration!
49
59
  @configuration = nil
50
60
  @client = nil
61
+ @ramps = nil
51
62
  end
52
63
 
53
64
  # Pure function over rake task names so the exemption logic is
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrengine-sdp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Ferrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-13 00:00:00.000000000 Z
11
+ date: 2026-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: solrengine-realtime
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +79,7 @@ files:
79
79
  - lib/solrengine/sdp/engine.rb
80
80
  - lib/solrengine/sdp/errors.rb
81
81
  - lib/solrengine/sdp/faucet.rb
82
+ - lib/solrengine/sdp/ramps.rb
82
83
  - lib/solrengine/sdp/version.rb
83
84
  - lib/solrengine/sdp/wallet_owner.rb
84
85
  homepage: https://github.com/solrengine/sdp