erpc-sdk 0.8.0 → 0.9.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: e1e41b728c27ddf8d794aa91d44a2503204b00f6953580d0db2498d44a5b041b
4
- data.tar.gz: 5dc759af0fe505cd30f6fb45cf43344687d2df1f7aff34cb4b66b8e787419e8b
3
+ metadata.gz: 6b59a0ebcac5873a33f4d929b342933ac506d63ce560c6901a31ceddca8f3201
4
+ data.tar.gz: cdce8eb401c427a1da00fe312247504882d71263350e8a6125bf949f9cc5b3e0
5
5
  SHA512:
6
- metadata.gz: 982fb52b52b3e88855eb4405aece06bf5f76518202cd990458ae9955b1796b4756cd61db2373b86072e75db60f4371d9674a4d7b4e927b7deba898a47130bc26
7
- data.tar.gz: d174e090167c4a1b45a2b35f7d19dacffad5e57b5d8842fbf9335c9c4354f4df7df9c08fa83665ec9f97376f60fc4678696ac39f0e54f5499b664b9333146bed
6
+ metadata.gz: 6376993befcaf12497cbccb0bd1f00467939f0af13063a0c7811fed33174048bfc2ac79f57157798d9988ab3cb552ecfd233789537546c40276deafda06e9548
7
+ data.tar.gz: 59c8b5a09592f57c1d4590799813cc2ca67718d6f814ba99129197669c5afadc444377b6a3a373885e56ddfad593c2d3be43e6be2a0e1ffd28d3645c31328a05
data/LICENSE CHANGED
@@ -2,6 +2,77 @@ MIT License
2
2
 
3
3
  Copyright (c) 2026 ELSOUL LABO B.V.
4
4
 
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ -------------------------------------------------------------------------------
24
+ Upstream Mayan Finance source notice
25
+
26
+ The following notice is retained for the local bridge construction boundary
27
+ reviewed from Mayan Finance swap-sdk commit
28
+ c4c98031aaad9264d17630d7b4de0cb18688cf78 (SHA-256:
29
+ a5b74ba954fd256feffa4c25251a0cbbfb7002af43278e3e4e6268a2e8208865).
30
+ Adapted local path: packages/ruby/lib/erpc_sdk/bridge_local.rb. The Ruby
31
+ implementation adds bounded serialization, hashing, validation, and read-only
32
+ transport integration; no signing or custody code is included.
33
+
34
+ Third-party MIT notice: pinned Mayan source commit
35
+ c4c98031aaad9264d17630d7b4de0cb18688cf78
36
+ (source LICENSE SHA-256: a5b74ba954fd256feffa4c25251a0cbbfb7002af43278e3e4e6268a2e8208865)
37
+
38
+ The MIT License (MIT)
39
+ Copyright (c) 2022-2026 Mayan Finance
40
+
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ of this software and associated documentation files (the "Software"), to deal
44
+ in the Software without restriction, including without limitation the rights
45
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ copies of the Software, and to permit persons to whom the Software is
47
+ furnished to do so, subject to the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be included in all
50
+ copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
+ SOFTWARE.
59
+
60
+ -------------------------------------------------------------------------------
61
+ Official npm Mayan swap-sdk 15.2.2 oracle notice
62
+
63
+ The following notice is retained for reference-only vectors from the official
64
+ npm @mayanfinance/swap-sdk 15.2.2 package (SHA-256:
65
+ 3333053878e484331d629fb35ba704b0a635f26b9d81d9c5d51ab2d5817f4744).
66
+ Reference-only oracle source: installed package utilities used to freeze
67
+ cross-language vectors; it is not a Ruby runtime dependency.
68
+
69
+ Third-party MIT notice: npm oracle @mayanfinance/swap-sdk 15.2.2
70
+ (oracle LICENSE SHA-256: 3333053878e484331d629fb35ba704b0a635f26b9d81d9c5d51ab2d5817f4744)
71
+
72
+ The MIT License (MIT)
73
+ Copyright (c) 2019-2020 Hugo Di Francesco
74
+
75
+
5
76
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
77
  of this software and associated documentation files (the "Software"), to deal
7
78
  in the Software without restriction, including without limitation the rights
data/README.md CHANGED
@@ -8,7 +8,8 @@ price REST and server-sent events, account usage, and scoped Cloud reads.
8
8
  gem install erpc-sdk
9
9
  ```
10
10
 
11
- Ruby 3.1 or newer is required. The gem has no runtime dependencies.
11
+ Ruby 3.1 or newer is required. Local Mayan unsigned construction uses the
12
+ approved native `digest-keccak` 0.0.7 runtime dependency.
12
13
 
13
14
  ## Quick start
14
15
 
@@ -242,8 +243,11 @@ See the [Solana v1 guide](https://github.com/elsoul/erpc-sdk/blob/main/packages/
242
243
 
243
244
  ## Optional Mayan Swift v2 bridge (introduced in 0.8.0)
244
245
 
245
- The `0.8.0` API's `MayanSwiftV2BridgeClient` is an explicit standalone adapter for the reviewed
246
- issued EURC routes between Ethereum mainnet and Solana mainnet. It does not
246
+ The published `0.8.1` API's `MayanSwiftV2BridgeClient` is an explicit standalone adapter for the
247
+ reviewed issued EURC routes between Ethereum mainnet and Solana mainnet. The current source
248
+ checkout contains unreleased native USDC and local-builder additions alongside EURC. The
249
+ published `0.8.1` Worker patch does not include those native USDC or local-builder additions.
250
+ The adapter does not
247
251
  attach to `ERPC::Client`, inherit eRPC credentials or headers, or make any
248
252
  request during construction. Configure the Mayan builder and Explorer
249
253
  endpoints separately when needed:
@@ -252,17 +256,18 @@ endpoints separately when needed:
252
256
  bridge = ERPC::MayanSwiftV2BridgeClient.new(
253
257
  builder_endpoint: "https://tx-builder.mayan.finance",
254
258
  explorer_endpoint: "https://explorer-api.mayan.finance/v3",
255
- builder_api_key: ENV.fetch("MAYAN_BUILDER_API_KEY"),
256
259
  http_adapter: ERPC::NetHttpAdapter.new
257
260
  )
258
261
 
259
262
  quotes = bridge.quote_exact_input(
260
- "sourceChainId" => ERPC::TokenChainIDs::ETHEREUM_MAINNET,
261
- "destinationChainId" => ERPC::TokenChainIDs::SOLANA_MAINNET,
262
- "sourceTokenDeploymentId" => "deployment-0011",
263
- "destinationTokenDeploymentId" => "deployment-0013",
264
- "amountIn" => "100000000",
265
- "slippageBps" => 50
263
+ {
264
+ "sourceChainId" => ERPC::TokenChainIDs::ETHEREUM_MAINNET,
265
+ "destinationChainId" => ERPC::TokenChainIDs::SOLANA_MAINNET,
266
+ "sourceTokenDeploymentId" => "deployment-0011",
267
+ "destinationTokenDeploymentId" => "deployment-0013",
268
+ "amountIn" => "100000000",
269
+ "slippageBps" => 50
270
+ }
266
271
  )
267
272
  ```
268
273
 
@@ -271,12 +276,104 @@ Builds return unsigned, structurally checked provider transactions and an
271
276
  Ethereum allowance description; the SDK does not approve, sign, broadcast,
272
277
  submit, cancel, refund, or claim settlement verification. Provider source
273
278
  swaps use Mayan's disclosed internal USDC path (and Jupiter v6 for Solana
274
- source orders), so this optional adapter is separate from the SDK's configured
275
- RPC-only swap helpers. The defaults are `https://tx-builder.mayan.finance` for
279
+ source EURC orders), while native USDC uses direct forwarding with no source
280
+ swap or Jupiter dependency. This optional adapter is separate from the SDK's configured
281
+ RPC-only swap helpers. Native USDC Ethereum builds use the reviewed
282
+ `0xe4269fc4` selector. The defaults are `https://tx-builder.mayan.finance` for
276
283
  quote/build and `https://explorer-api.mayan.finance/v3` for indexed status; set
277
284
  `builder_endpoint` and `explorer_endpoint` to customize them. The
278
- `builder_api_key` is a separate Mayan build-only key and is never an eRPC
279
- credential. `BridgeError#code` provides stable secret-free errors.
285
+ `builder_api_key` is build-only and is never sent to quote or Explorer. The
286
+ local default guard can be bypassed with `allow_unauthenticated_build: true` at
287
+ any configured endpoint, including the default endpoint; this only permits a
288
+ request and does not change provider authentication. It is never an eRPC
289
+ credential.
290
+ `BridgeError#code` provides stable secret-free errors.
291
+
292
+ Select native USDC with its exact deployment IDs:
293
+
294
+ ```ruby
295
+ quotes = bridge.quote_exact_input(
296
+ {
297
+ "sourceChainId" => ERPC::TokenChainIDs::ETHEREUM_MAINNET,
298
+ "destinationChainId" => ERPC::TokenChainIDs::SOLANA_MAINNET,
299
+ "sourceTokenDeploymentId" => "deployment-0008",
300
+ "destinationTokenDeploymentId" => "deployment-0010",
301
+ "amountIn" => "100000000",
302
+ "slippageBps" => 50
303
+ }
304
+ )
305
+ ```
306
+
307
+ The published `0.8.1` gem supports the EURC bridge only. Native USDC and local-builder
308
+ support are currently source-only and have not been published.
309
+
310
+ ### Local unsigned Mayan construction
311
+
312
+ The source checkout also exposes explicit keyless local construction for the
313
+ four reviewed native EURC and USDC routes. It keeps the hosted quote unchanged,
314
+ fetches the EURC source-swap instructions when required, reads only the
315
+ matching caller-configured source RPC, and returns an unsigned EVM or Solana
316
+ transaction. It never loads keys, signs, approves, submits, or falls back to
317
+ the hosted `/build` endpoint.
318
+
319
+ ```ruby
320
+ bridge = ERPC::MayanSwiftV2BridgeClient.new(
321
+ local_build: {
322
+ source_swap_endpoint: "https://price-api.mayan.finance/v3",
323
+ ethereum_rpc: ERPC::RpcEndpointConfig.new(
324
+ http_url: "https://ethereum.example/rpc",
325
+ headers: { "authorization" => "Bearer node-token" }
326
+ )
327
+ }
328
+ )
329
+
330
+ context = {
331
+ "quote" => quote,
332
+ "swapperAddress" => "0x1111111111111111111111111111111111111111",
333
+ "destinationAddress" => "HQhyrHjgq5ftgsibxdUwLvDZ5HT4c9bNuBWJMmZvTd5b",
334
+ "orderNonce" => "0x00112233445566778899aabbccddeeff"
335
+ }
336
+ plan = bridge.prepare_source_swap(context)
337
+ unsigned = bridge.build_local_unsigned(context.merge("sourceSwapPlan" => plan))
338
+ ```
339
+
340
+ `orderNonce` is caller-supplied public entropy and must be a fresh lowercase
341
+ `0x` plus 32 hexadecimal digits. A local build requires the configured RPC for
342
+ the source chain; RPC headers stay on that RPC request and are never forwarded
343
+ to Mayan. The returned validation fields describe structural construction and
344
+ do not claim provider-signature verification, signing, or settlement.
345
+
346
+ ## Wallets, signing, and Mayan authentication
347
+
348
+ The Ruby SDK does not load wallet or private-key material and does not sign
349
+ transactions. `sender`, `from`, `swapperAddress`, and `feePayer` are public
350
+ addresses; ERPC API keys, direct-RPC headers, and Mayan service keys authenticate
351
+ services and are not signer keys. Swap preparation and Mayan builds return
352
+ unsigned data. After an application-owned wallet signs it, submit the
353
+ serialized bytes through the selected ERPC RPC method; the SDK performs that
354
+ RPC request and does not perform cryptographic signing. Approval policy, fees,
355
+ nonces or blockhashes, review, and confirmation remain in the caller's wallet
356
+ flow.
357
+
358
+ See the [common wallet and signing responsibilities](https://github.com/elsoul/erpc-sdk/blob/main/README.md#wallets-and-signing)
359
+ and the [TypeScript examples for signing and broadcast](https://github.com/elsoul/erpc-sdk/blob/main/packages/typescript/docs/signing-and-broadcast.md)
360
+ for worked external-wallet flows. The TypeScript examples are consumer
361
+ integrations and do not add runtime dependencies to this Ruby gem.
362
+
363
+ Mayan's [official quote API documentation](https://docs.mayan.finance/integration/quote-api#api-key)
364
+ and the [pinned transaction-builder authentication guidance](https://github.com/mayan-finance/tx-builder/blob/e966f16a155cd9091b02ef5d9b91c3f837c228ad/README.md#authentication)
365
+ describe the provider key as optional. Ruby applies a local safety guard:
366
+ `build_unsigned` requires a separate `builder_api_key` unless the caller
367
+ explicitly sets `allow_unauthenticated_build: true`. That option permits a
368
+ keyless request to the configured or default builder endpoint; it grants no
369
+ permission at the provider. The builder key is sent only to `/build`, never to
370
+ `/quote` or Explorer, and is never reused as an ERPC credential.
371
+
372
+ In the anonymous recheck at 2026-09-17 11:27 UTC, four EURC/USDC quotes returned
373
+ HTTP 200 and four hosted builder requests returned HTTP 401. This dated
374
+ observation records the current provider discrepancy and does not establish a
375
+ universal or permanent key requirement; the deployed provider revision is
376
+ unknown, and no authenticated build or funds evidence was collected.
280
377
 
281
378
  ## Namespaces
282
379