erpc-sdk 0.8.1 → 0.9.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/LICENSE +71 -0
- data/README.md +118 -15
- data/lib/erpc_sdk/bridge.rb +151 -47
- data/lib/erpc_sdk/bridge_local.rb +1836 -0
- data/lib/erpc_sdk/generated/bridge_capabilities.rb +3 -3
- data/lib/erpc_sdk/generated/token_catalog.rb +11 -4
- data/lib/erpc_sdk/token_catalog.rb +13 -3
- data/lib/erpc_sdk/version.rb +1 -1
- data/lib/erpc_sdk.rb +1 -0
- metadata +31 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48fb4d773602547b8b938cc0f5e20f3f46c00b905d20beda739c0ae7b5edcaad
|
|
4
|
+
data.tar.gz: 581ac31956aa8f63e1d4e3d40808e798aa96a542e9580f0cb452c6c597263339
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5a83daf119e875927486500e389a5741bdf3fcc0e502d51fb9a01bad6f7801cdff34c416eef7e08ae4e24be37d5ecc2c6b61521f21b42d70f516378a50119fc
|
|
7
|
+
data.tar.gz: bc07e411ed03ea21642c485ccbf318a7e4bdca365ba93bb2a013b86cd79af854bcd16614662e7033d291d87d821004e55913c3ac4c0c2aceb53423aaee25a340
|
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
|
@@ -5,10 +5,17 @@ Avalanche C/P/X-chain JSON-RPC, indexed data, analytics, WebSocket subscriptions
|
|
|
5
5
|
price REST and server-sent events, account usage, and scoped Cloud reads.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
# After RubyGems lists 0.9.1:
|
|
9
|
+
gem install erpc-sdk -v 0.9.1
|
|
10
|
+
# For local validation, use the public 0.9.0 gem or this source checkout.
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
Ruby 3.1 or newer is required.
|
|
13
|
+
Ruby 3.1 or newer is required. Local Mayan unsigned construction uses the
|
|
14
|
+
approved native `digest-keccak` 0.0.7 runtime dependency.
|
|
15
|
+
|
|
16
|
+
This source/release cohort targets `0.9.1`; check the
|
|
17
|
+
[RubyGems release metadata](https://rubygems.org/api/v1/versions/erpc-sdk.json)
|
|
18
|
+
for current package availability.
|
|
12
19
|
|
|
13
20
|
## Quick start
|
|
14
21
|
|
|
@@ -242,8 +249,11 @@ See the [Solana v1 guide](https://github.com/elsoul/erpc-sdk/blob/main/packages/
|
|
|
242
249
|
|
|
243
250
|
## Optional Mayan Swift v2 bridge (introduced in 0.8.0)
|
|
244
251
|
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
`MayanSwiftV2BridgeClient` is an explicit standalone adapter for the reviewed issued EURC
|
|
253
|
+
routes between Ethereum mainnet and Solana mainnet. The public `0.9.0` gem contains
|
|
254
|
+
the native USDC and local-builder additions alongside EURC. The `0.9.1` package
|
|
255
|
+
also includes these APIs as the source/release cohort target.
|
|
256
|
+
The adapter does not
|
|
247
257
|
attach to `ERPC::Client`, inherit eRPC credentials or headers, or make any
|
|
248
258
|
request during construction. Configure the Mayan builder and Explorer
|
|
249
259
|
endpoints separately when needed:
|
|
@@ -252,17 +262,18 @@ endpoints separately when needed:
|
|
|
252
262
|
bridge = ERPC::MayanSwiftV2BridgeClient.new(
|
|
253
263
|
builder_endpoint: "https://tx-builder.mayan.finance",
|
|
254
264
|
explorer_endpoint: "https://explorer-api.mayan.finance/v3",
|
|
255
|
-
builder_api_key: ENV.fetch("MAYAN_BUILDER_API_KEY"),
|
|
256
265
|
http_adapter: ERPC::NetHttpAdapter.new
|
|
257
266
|
)
|
|
258
267
|
|
|
259
268
|
quotes = bridge.quote_exact_input(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
{
|
|
270
|
+
"sourceChainId" => ERPC::TokenChainIDs::ETHEREUM_MAINNET,
|
|
271
|
+
"destinationChainId" => ERPC::TokenChainIDs::SOLANA_MAINNET,
|
|
272
|
+
"sourceTokenDeploymentId" => "deployment-0011",
|
|
273
|
+
"destinationTokenDeploymentId" => "deployment-0013",
|
|
274
|
+
"amountIn" => "100000000",
|
|
275
|
+
"slippageBps" => 50
|
|
276
|
+
}
|
|
266
277
|
)
|
|
267
278
|
```
|
|
268
279
|
|
|
@@ -271,12 +282,104 @@ Builds return unsigned, structurally checked provider transactions and an
|
|
|
271
282
|
Ethereum allowance description; the SDK does not approve, sign, broadcast,
|
|
272
283
|
submit, cancel, refund, or claim settlement verification. Provider source
|
|
273
284
|
swaps use Mayan's disclosed internal USDC path (and Jupiter v6 for Solana
|
|
274
|
-
source orders),
|
|
275
|
-
|
|
285
|
+
source EURC orders), while native USDC uses direct forwarding with no source
|
|
286
|
+
swap or Jupiter dependency. This optional adapter is separate from the SDK's configured
|
|
287
|
+
RPC-only swap helpers. Native USDC Ethereum builds use the reviewed
|
|
288
|
+
`0xe4269fc4` selector. The defaults are `https://tx-builder.mayan.finance` for
|
|
276
289
|
quote/build and `https://explorer-api.mayan.finance/v3` for indexed status; set
|
|
277
290
|
`builder_endpoint` and `explorer_endpoint` to customize them. The
|
|
278
|
-
`builder_api_key` is
|
|
279
|
-
|
|
291
|
+
`builder_api_key` is build-only and is never sent to quote or Explorer. The
|
|
292
|
+
local default guard can be bypassed with `allow_unauthenticated_build: true` at
|
|
293
|
+
any configured endpoint, including the default endpoint; this only permits a
|
|
294
|
+
request and does not change provider authentication. It is never an eRPC
|
|
295
|
+
credential.
|
|
296
|
+
`BridgeError#code` provides stable secret-free errors.
|
|
297
|
+
|
|
298
|
+
Select native USDC with its exact deployment IDs:
|
|
299
|
+
|
|
300
|
+
```ruby
|
|
301
|
+
quotes = bridge.quote_exact_input(
|
|
302
|
+
{
|
|
303
|
+
"sourceChainId" => ERPC::TokenChainIDs::ETHEREUM_MAINNET,
|
|
304
|
+
"destinationChainId" => ERPC::TokenChainIDs::SOLANA_MAINNET,
|
|
305
|
+
"sourceTokenDeploymentId" => "deployment-0008",
|
|
306
|
+
"destinationTokenDeploymentId" => "deployment-0010",
|
|
307
|
+
"amountIn" => "100000000",
|
|
308
|
+
"slippageBps" => 50
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The public `0.9.0` gem supports the EURC bridge, native USDC, and local-builder
|
|
314
|
+
support. The `0.9.1` package carries these APIs as the source/release cohort target.
|
|
315
|
+
|
|
316
|
+
### Local unsigned Mayan construction
|
|
317
|
+
|
|
318
|
+
The source checkout also exposes explicit keyless local construction for the
|
|
319
|
+
four reviewed native EURC and USDC routes. It keeps the hosted quote unchanged,
|
|
320
|
+
fetches the EURC source-swap instructions when required, reads only the
|
|
321
|
+
matching caller-configured source RPC, and returns an unsigned EVM or Solana
|
|
322
|
+
transaction. It never loads keys, signs, approves, submits, or falls back to
|
|
323
|
+
the hosted `/build` endpoint.
|
|
324
|
+
|
|
325
|
+
```ruby
|
|
326
|
+
bridge = ERPC::MayanSwiftV2BridgeClient.new(
|
|
327
|
+
local_build: {
|
|
328
|
+
source_swap_endpoint: "https://price-api.mayan.finance/v3",
|
|
329
|
+
ethereum_rpc: ERPC::RpcEndpointConfig.new(
|
|
330
|
+
http_url: "https://ethereum.example/rpc",
|
|
331
|
+
headers: { "authorization" => "Bearer node-token" }
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
context = {
|
|
337
|
+
"quote" => quote,
|
|
338
|
+
"swapperAddress" => "0x1111111111111111111111111111111111111111",
|
|
339
|
+
"destinationAddress" => "HQhyrHjgq5ftgsibxdUwLvDZ5HT4c9bNuBWJMmZvTd5b",
|
|
340
|
+
"orderNonce" => "0x00112233445566778899aabbccddeeff"
|
|
341
|
+
}
|
|
342
|
+
plan = bridge.prepare_source_swap(context)
|
|
343
|
+
unsigned = bridge.build_local_unsigned(context.merge("sourceSwapPlan" => plan))
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
`orderNonce` is caller-supplied public entropy and must be a fresh lowercase
|
|
347
|
+
`0x` plus 32 hexadecimal digits. A local build requires the configured RPC for
|
|
348
|
+
the source chain; RPC headers stay on that RPC request and are never forwarded
|
|
349
|
+
to Mayan. The returned validation fields describe structural construction and
|
|
350
|
+
do not claim provider-signature verification, signing, or settlement.
|
|
351
|
+
|
|
352
|
+
## Wallets, signing, and Mayan authentication
|
|
353
|
+
|
|
354
|
+
The Ruby SDK does not load wallet or private-key material and does not sign
|
|
355
|
+
transactions. `sender`, `from`, `swapperAddress`, and `feePayer` are public
|
|
356
|
+
addresses; ERPC API keys, direct-RPC headers, and Mayan service keys authenticate
|
|
357
|
+
services and are not signer keys. Swap preparation and Mayan builds return
|
|
358
|
+
unsigned data. After an application-owned wallet signs it, submit the
|
|
359
|
+
serialized bytes through the selected ERPC RPC method; the SDK performs that
|
|
360
|
+
RPC request and does not perform cryptographic signing. Approval policy, fees,
|
|
361
|
+
nonces or blockhashes, review, and confirmation remain in the caller's wallet
|
|
362
|
+
flow.
|
|
363
|
+
|
|
364
|
+
See the [common wallet and signing responsibilities](https://github.com/elsoul/erpc-sdk/blob/main/README.md#wallets-and-signing)
|
|
365
|
+
and the [TypeScript examples for signing and broadcast](https://github.com/elsoul/erpc-sdk/blob/main/packages/typescript/docs/signing-and-broadcast.md)
|
|
366
|
+
for worked external-wallet flows. The TypeScript examples are consumer
|
|
367
|
+
integrations and do not add runtime dependencies to this Ruby gem.
|
|
368
|
+
|
|
369
|
+
Mayan's [official quote API documentation](https://docs.mayan.finance/integration/quote-api#api-key)
|
|
370
|
+
and the [pinned transaction-builder authentication guidance](https://github.com/mayan-finance/tx-builder/blob/e966f16a155cd9091b02ef5d9b91c3f837c228ad/README.md#authentication)
|
|
371
|
+
describe the provider key as optional. Ruby applies a local safety guard:
|
|
372
|
+
`build_unsigned` requires a separate `builder_api_key` unless the caller
|
|
373
|
+
explicitly sets `allow_unauthenticated_build: true`. That option permits a
|
|
374
|
+
keyless request to the configured or default builder endpoint; it grants no
|
|
375
|
+
permission at the provider. The builder key is sent only to `/build`, never to
|
|
376
|
+
`/quote` or Explorer, and is never reused as an ERPC credential.
|
|
377
|
+
|
|
378
|
+
In the anonymous recheck at 2026-09-17 11:27 UTC, four EURC/USDC quotes returned
|
|
379
|
+
HTTP 200 and four hosted builder requests returned HTTP 401. This dated
|
|
380
|
+
observation records the current provider discrepancy and does not establish a
|
|
381
|
+
universal or permanent key requirement; the deployed provider revision is
|
|
382
|
+
unknown, and no authenticated build or funds evidence was collected.
|
|
280
383
|
|
|
281
384
|
## Namespaces
|
|
282
385
|
|