Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 5 additions & 77 deletions packages/sdk-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,84 +102,12 @@ The on-chain registry is authoritative for protocol identity and activation.
RPC URLs, explorers, icons, wallet adapters, and application capabilities stay
in the consuming application's runtime configuration.

## Reserves
## Depot-native settlement

`contracts.sysio.reserv` provides normalized reserve registry reads,
chain/token and status filters, exact reserve lookup, WIRE-side activation, and
read-only swap quotes. External-chain reserve creation and cancellation remain
in the chain SDK that owns the deployed ABI or IDL.

```ts
const reserves = new contracts.sysio.reserv.ReserveClient({ client: api })
const pending = await reserves.listReserves({
status: SysioReservReservestatus.RESERVE_STATUS_PENDING
})

await reserves.pushMatchReserve({
chainCode: "ETHEREUM",
tokenCode: "ETH",
reserveCode: "PRIMARY",
matcher: "alice",
wireAmount: pending[0].requestedWireAmount
})

// Several pending rows can be activated atomically in one signed transaction.
await reserves.pushMatchReserves({
matches: pending.map(reserve => ({
chainCode: reserve.chainCode,
tokenCode: reserve.tokenCode,
reserveCode: reserve.reserveCode,
matcher: "alice",
wireAmount: reserve.requestedWireAmount
}))
})
```

`pushMatchReserves` preserves the supplied action order and rejects an empty
match list. The Wire transaction is atomic: either every `matchreserve` action
is accepted or none is applied.

## Reserve swaps

Reserve swap integrations compose three on-chain sources instead of carrying a
parallel token or route catalog:

- `contracts.sysio.tokens.TokenRegistryClient` reads canonical token metadata
and active chain deployments.
- `contracts.sysio.reserv.ReserveClient` discovers active liquidity and returns
live `swapquote` output for external or WIRE endpoints.
- `contracts.sysio.uwrit.UnderwritingClient` reads swap lifecycle state and
submits WIRE-origin swaps into the next-epoch queue.

```ts
const tokens = new contracts.sysio.tokens.TokenRegistryClient({ client: api })
const reserves = new contracts.sysio.reserv.ReserveClient({ client: api })
const underwriting = new contracts.sysio.uwrit.UnderwritingClient({ client: api })

const assets = await tokens.listAssets()
const quote = await reserves.getSwapQuote({
from: contracts.sysio.uwrit.WIRE_SWAP_ENDPOINT,
fromAmount: 10_000_000_000n,
to: { chainCode: "SOLANA", tokenCode: "SOL", reserveCode: "PRIMARY" }
})

await underwriting.pushSwapFromWire({
user: "alice",
wireAmount: 10_000_000_000n,
destination: { chainCode: "SOLANA", tokenCode: "SOL", reserveCode: "PRIMARY" },
targetAmount: quote,
targetToleranceBps: 500,
recipientKind: SysioUwritChainkind.CHAIN_KIND_SVM,
recipientAddress: "<solana-public-key-bytes>"
})
```

External-origin swap submission remains in the chain SDK that owns the deployed
outpost ABI or IDL. A mined source transaction means the swap was submitted;
`uwreqs` remains the source of truth for relay, underwriting, settlement, and
revert status. Normalized underwriting rows expose `sourceRequestId` for
matching the outpost's `SwapDeposit` id; transaction hashes and signatures are
transport receipts rather than protocol correlation values.
Use generated `sysio.opreg`, `sysio.synd`, `sysio.bond`, `sysio.liq` and
`sysio.swap` proxies for collateral, syndicated envelopes, bond resolution,
shadow LIQ and native pools. `TokenRegistryClient` supplies canonical asset
metadata. The external reserve and swap-underwriter clients have been removed.

## Install

Expand Down
5 changes: 0 additions & 5 deletions packages/sdk-core/src/contracts/sysio/Codecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
MsigPropose,
MsigUnapprove
} from "./msig/Structs.js"
import { ReservMatchReserve, ReservSwapQuote } from "./reserv/Structs.js"

/** Generated action names for one system contract. */
type ActionName<Name extends SysioContractName> = Extract<
Expand Down Expand Up @@ -49,10 +48,6 @@ const ActionCodecs: SysioActionCodecMapping = {
invalidate: { serialize: data => MsigInvalidate.from(data) },
propose: { serialize: data => MsigPropose.from(data) },
unapprove: { serialize: data => MsigUnapprove.from(data) }
},
[SysioContractName.reserv]: {
matchreserve: { serialize: data => ReservMatchReserve.from(data) },
swapquote: { serialize: data => ReservSwapQuote.from(data) }
}
}

Expand Down
2 changes: 0 additions & 2 deletions packages/sdk-core/src/contracts/sysio/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export * as authex from "./authex/index.js"
export * as chains from "./chains/index.js"
export * as msig from "./msig/index.js"
export * as reserv from "./reserv/index.js"
export * as tokens from "./tokens/index.js"
export * as uwrit from "./uwrit/index.js"
export * from "./Client.js"
74 changes: 0 additions & 74 deletions packages/sdk-core/src/contracts/sysio/reserv/Actions.ts

This file was deleted.

Loading
Loading