Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
b03baee
deltaV2/types
andriy-shymkiv May 22, 2026
8a0e612
deltaV2/get methods
andriy-shymkiv May 22, 2026
c04277a
deltaV2/post methods
andriy-shymkiv May 22, 2026
f04482c
deltaV2/build methods
andriy-shymkiv May 22, 2026
21d82dd
deltaV2/cancel methods
andriy-shymkiv May 22, 2026
8436825
deltaV2/all handlers
andriy-shymkiv May 22, 2026
84004c6
deltaV2/export from SDK
andriy-shymkiv May 22, 2026
7201cea
deltaV2/tests
andriy-shymkiv May 22, 2026
6dc136b
deltaV2/update CLAUDE.md
andriy-shymkiv May 22, 2026
4330030
deltaV2/examples
andriy-shymkiv May 22, 2026
9ee5d89
pnpm run lint
andriy-shymkiv May 22, 2026
2ae10a7
common DeltaOrderType
andriy-shymkiv May 25, 2026
db19ae2
cancelDeltaOrderV2/drop limit from naming
andriy-shymkiv May 25, 2026
8c388c6
cancelDeltaOrdersV2/fix tests
andriy-shymkiv May 25, 2026
e01e0a4
update CLAUDE.md
andriy-shymkiv May 25, 2026
2087b9f
deltaV2/limitAmount param
andriy-shymkiv May 25, 2026
cd2e586
signDeltaOrderV2/cleanup
andriy-shymkiv May 25, 2026
dde81a6
BridgeMetadata/expectedOutputAmount
andriy-shymkiv May 25, 2026
93275e7
BridgeMetadata/better comment for outputAmount
andriy-shymkiv May 25, 2026
6942fb9
more generic submit/post delta order types (v1 and v2)
andriy-shymkiv May 25, 2026
6894500
postOrder/get rid of extra hash from fetchURL
andriy-shymkiv May 25, 2026
73ec6a2
postTWAP/consistent fetchURL without slash
andriy-shymkiv May 25, 2026
6183708
cancelDeltaOrder/fallback apiURL
andriy-shymkiv May 25, 2026
1acea76
Revert "more generic submit/post delta order types (v1 and v2)"
andriy-shymkiv May 25, 2026
03c1659
Release 9.5.4-dev.0
andriy-shymkiv May 25, 2026
3290040
add ProductiveOrder types
andriy-shymkiv May 25, 2026
264330c
Release 9.5.4-dev.1
andriy-shymkiv May 25, 2026
c517982
startStatusCheck/return unsubscriber
andriy-shymkiv May 28, 2026
4c07225
BridgeMetadata/make outputAmount optional
andriy-shymkiv May 28, 2026
3799029
DeltaAuction/better types
andriy-shymkiv May 28, 2026
5f2d69b
getBridgeProtocolsV2/better description
andriy-shymkiv May 28, 2026
91f8357
BridgeRoute/better description
andriy-shymkiv May 28, 2026
6a5bfc6
getTransactionAmounts/fix outputAmount usage
andriy-shymkiv May 28, 2026
c232a59
fix broken delta v1 test
andriy-shymkiv May 28, 2026
d55f43e
simplify migration with common DeltaV2 mapping
andriy-shymkiv May 28, 2026
50e69bf
Update src/methods/delta/helpers/types.ts
andriy-shymkiv May 28, 2026
494f747
constructSimpleSDK/simplify deltaV2 import
andriy-shymkiv May 28, 2026
033b951
update deltaV2 tests
andriy-shymkiv May 28, 2026
34bb0d5
update claude.md
andriy-shymkiv May 28, 2026
1ae4fa6
add deltaV2 to readme
andriy-shymkiv May 28, 2026
c1f7ef4
BridgeRoute/better description
andriy-shymkiv May 28, 2026
da02444
add ProductiveDeltaOrder to readme
andriy-shymkiv May 28, 2026
ca8f05e
deltaV2/getRequiredBalanceForDeltaOrders
andriy-shymkiv May 28, 2026
b7f9546
better DeltaAuction type for v2 + usage everywhere for v2
andriy-shymkiv May 29, 2026
e8e292f
run lint
andriy-shymkiv May 29, 2026
bf28f4c
BuiltDeltaOrder/tighter type
andriy-shymkiv May 29, 2026
072853b
delta v2 order helpers
andriy-shymkiv May 29, 2026
9cc1a1a
buildDeltaOrder/drop chainId param
andriy-shymkiv May 29, 2026
f0d6679
Release 9.5.4-dev.2
andriy-shymkiv May 29, 2026
3fba7a5
Merge branch 'master' of github.com:VeloraDEX/sdk into feat/delta-v2
andriy-shymkiv Jun 2, 2026
bbc6cfa
delta/drop v1, promote v2 to the sole delta API
andriy-shymkiv Jun 2, 2026
482d411
tests/migrate delta and quote suites to v2
andriy-shymkiv Jun 2, 2026
43af8f1
docs/migrate to delta v2
andriy-shymkiv Jun 2, 2026
9b3184c
rename folder
Velenir Jun 3, 2026
0edcde8
Merge pull request #241 from VeloraDEX/feat/drop-delta-v1
andriy-shymkiv Jun 3, 2026
4751229
cleanup unused imports
andriy-shymkiv Jun 3, 2026
b03e0ad
constructGetDeltaOrders/bring back generic `onChainOrderType` filter
andriy-shymkiv Jun 3, 2026
34ecdd1
delta/drop unused v1 order-build and partner-fee helpers
andriy-shymkiv Jun 3, 2026
bea748f
docs/sync delta helpers section
andriy-shymkiv Jun 3, 2026
c50a3a2
preSign/add JSDoc for constructPreSign* and their methods
andriy-shymkiv Jun 3, 2026
bdd9c19
remove LOrder stuff and rename to OTC what is left
Velenir Jun 3, 2026
2868c4f
fix methods in tests
Velenir Jun 3, 2026
912a3c6
make LOrder examples into OTC
Velenir Jun 3, 2026
0b0dd35
getAuctionAmounts/compute real minimal amounts
andriy-shymkiv Jun 3, 2026
b099c74
fix NFT Order types
Velenir Jun 3, 2026
9410967
getAuctionAmounts/explicit minimal amount
andriy-shymkiv Jun 3, 2026
2a58c16
remove NFT stuff from swap txs
Velenir Jun 3, 2026
76e527d
don't include NFT in sdk bundles and exports
Velenir Jun 3, 2026
ff2bbd8
update claude hints
Velenir Jun 3, 2026
9161158
remove NFT types from partial SDK inference
Velenir Jun 3, 2026
14bb87c
update test snapshots
Velenir Jun 3, 2026
46db721
update claude hints
Velenir Jun 3, 2026
4cdaced
some renames
Velenir Jun 3, 2026
7c6fe68
cleanup
Velenir Jun 3, 2026
ee9e5f8
lint fix
Velenir Jun 3, 2026
ff3420e
cleanup
Velenir Jun 3, 2026
a194e51
require taker in OTC Order building
Velenir Jun 3, 2026
e69c7bd
restore some NFT types
Velenir Jun 3, 2026
7476b05
lint fix
Velenir Jun 3, 2026
402843b
otc/fix approval method
Velenir Jun 3, 2026
fffd426
quote/run tests against staging API
andriy-shymkiv Jun 4, 2026
bfe7a73
add missing types (tsconfig was complaining)
Velenir Jun 5, 2026
6625df1
lint fix
Velenir Jun 5, 2026
dbefdca
getFilledPercent/calculate for completed txs only and drop special ha…
andriy-shymkiv Jun 5, 2026
eb52904
Add DeltaOrder status=Refunding
Velenir Jun 15, 2026
96c3123
add Order.refunds
Velenir Jun 15, 2026
865d2af
fix tests
Velenir Jun 15, 2026
81d8ced
delta/v2 -> v2/delta
Velenir Jun 15, 2026
0044ff2
lint fix
Velenir Jun 15, 2026
94365be
cleanup
Velenir Jun 15, 2026
24c0874
adjust comments
Velenir Jun 16, 2026
3190d91
adjust types
Velenir Jun 16, 2026
b2cafbe
OrderStatus/consider Refunding Failed
Velenir Jun 16, 2026
fc04b96
adjust comment
Velenir Jun 16, 2026
a0844a6
lint fix
Velenir Jun 16, 2026
189b6ee
Merge pull request #243 from VeloraDEX/feat/drop_legacy_LOrders
Velenir Jun 16, 2026
81790c4
Merge branch 'feat/delta-v2' into chore/order_refund_field
Velenir Jun 16, 2026
f2a295e
Merge pull request #244 from VeloraDEX/chore/order_refund_field
Velenir Jun 16, 2026
8c5ad7c
lint fix
Velenir Jun 16, 2026
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
111 changes: 72 additions & 39 deletions CLAUDE.md

Large diffs are not rendered by default.

285 changes: 146 additions & 139 deletions README.md

Large diffs are not rendered by default.

140 changes: 43 additions & 97 deletions docs/DELTA.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**Velora Delta** is an intent-based protocol that enables a Velora user to make gasless swaps where multiple agents compete to execute the trade at the best price possible.
This way the user doesn't need to make a transaction themselves but only to sign a Delta Order.
The easiest way to make use of the Delta Order is to use the SDK following these steps:

In Delta v2 the Order is **built by the server** from the route returned in the price response — you sign the returned typed data and post it. The easiest way to make use of the Delta Order is to use the SDK following these steps:

### 1. Construct an SDK object

Expand Down Expand Up @@ -32,6 +33,8 @@ const deltaPrice = await deltaSDK.getDeltaPrice({
destDecimals: 6,
// partner: "..." // if available
});

// deltaPrice.route is the recommended route; deltaPrice.alternatives holds the rest
```


Expand All @@ -56,68 +59,42 @@ See more on accepted Permit variants in [Velora documentation](https://developer

### 4. Sign and submit a Delta Order

```ts
// calculate acceptable destAmount
const slippagePercent = 0.5;
const destAmountAfterSlippage = (
+deltaPrice.destAmount *
(1 - slippagePercent / 100)
).toString(10);
Order building is server-side: pass the quoted `route` + `side` and your acceptable `slippage` — the server computes the amounts. `submitDeltaOrder` bundles build → sign → post.

```ts
const deltaAuction = await deltaSDK.submitDeltaOrder({
deltaPrice,
route: deltaPrice.route, // or any deltaPrice.alternatives[i]
side: deltaPrice.side,
owner: account,
// beneficiary: anotherAccount, // if need to send destToken to another account
// permit: "0x1234...", // if signed a Permit1 or Permit2 TransferFrom for DeltaContract
srcToken: DAI_TOKEN,
destToken: USDC_TOKEN,
srcAmount: amount,
destAmount: destAmountAfterSlippage, // minimum acceptable destAmount
slippage: 50, // 50 bps = 0.5%
// partner, partnerFeeBps — forwarded to the server
});
```

For full control over signing, use `buildDeltaOrder` → `signDeltaOrder` → `postDeltaOrder` separately (see the main [README](../README.md)).

### 5. Wait for Delta Order execution

```ts
// poll if necessary
function isExecutedDeltaAuction(
auction: Omit<DeltaAuction, 'signature'>,
waitForCrosschain = true // only consider executed when destChain work is done
) {
if (auction.status !== 'EXECUTED') return false;

// crosschain Order is executed on destChain if bridgeStatus is filled
if (waitForCrosschain && auction.order.bridge.destinationChainId !== 0) {
return auction.bridgeStatus === 'filled';
}

return true;
}

function fetchOrderPeriodically(auctionId: string) {
// poll if necessary — v2 status COMPLETED already accounts for any dest-chain bridge
function startStatusCheck(auctionId: string) {
const intervalId = setInterval(async () => {
const auction = await simpleSDK.delta.getDeltaOrderById(auctionId);
console.log('checks: ', auction); // Handle or log the fetched auction as needed

if (isExecutedDeltaAuction(auction)) {
clearInterval(intervalId); // Stop interval if completed
const auction = await deltaSDK.getDeltaOrderById(auctionId);
if (auction.status === 'COMPLETED') {
clearInterval(intervalId); // stop interval once completed
console.log('Order completed');
}
}, 3000);
console.log('Order Pending');
// Return intervalId to enable clearing the interval if needed externally
return intervalId;
}

function startStatusCheck(auctionId: string) {
const intervalId = fetchOrderPeriodically(auctionId);
setTimeout(() => clearInterval(intervalId), 60000 * 5); // Stop after 5 minutes
// stop polling after 5 minutes
setTimeout(() => clearInterval(intervalId), 60000 * 5);
}

startStatusCheck(deltaAuction.id);
```

#### A more detailed example of Delta Order usage can be found in [examples/delta](./src/examples/delta.ts)
#### A more detailed example of Delta Order usage can be found in [examples/delta](../src/examples/delta.ts)



Expand Down Expand Up @@ -147,12 +124,15 @@ const deltaSDK = constructSimpleSDK(

### 2. Check which tokens are available on the destination chain.

A limited list of tokens are available in Across, the service facilitating crosschain bridging
A limited list of tokens are available in Across, the service facilitating crosschain bridging.

```ts
const bridgeInfo = await deltaSDK.getBridgeInfo();
const bridgeRoutes = await deltaSDK.getBridgeRoutes();

const tokensAvailableForBridging = bridgeInfo[SRC_CHAIN_ID]?.[DEST_CHAIN_ID]
const tokensAvailableForBridging = bridgeRoutes.find(
(route) =>
route.srcChainId === SRC_CHAIN_ID && route.destChainId === DEST_CHAIN_ID
)?.tokens;
```


Expand All @@ -174,6 +154,8 @@ const deltaPrice = await deltaSDK.getDeltaPrice({
destDecimals: 6,
// partner: "..." // if available
});

// the returned deltaPrice.route already encodes the bridge step for the crosschain swap
```


Expand All @@ -198,71 +180,35 @@ See more on accepted Permit variants in [Velora documentation](https://developer

### 5. Sign and submit a Delta Order

```ts
// calculate acceptable destAmount
const slippagePercent = 0.5;
const destAmountAfterSlippage = (
+deltaPrice.destAmount *
(1 - slippagePercent / 100)
).toString(10);
The crosschain `route` (from a `getDeltaPrice` call with `destChainId`) already carries the bridge details, so submitting is the same as a same-chain order — the server builds the cross-chain Order from the route.

```ts
const deltaAuction = await deltaSDK.submitDeltaOrder({
deltaPrice,
route: deltaPrice.route, // crosschain route, includes the bridge step
side: deltaPrice.side,
owner: account,
// beneficiary: anotherAccount, // if need to send destToken to another account on destChain
// permit: "0x1234...", // if signed a Permit1 or Permit2 TransferFrom for DeltaContract
srcToken: DAI_TOKEN,
destToken: USDC_TOKEN_ON_DEST_CHAIN,
srcAmount: amount,
destAmount: destAmountAfterSlippage, // minimum acceptable destAmount
destChainId: DEST_CHAIN_ID, // required to construct a Crosschain Order
beneficiary: anotherAccount, // if need to send destToken to another account on destChain
beneficiaryType: 'EOA', // whether the beneficiary on destChain is a smart contract
// bridge, // user-constructed Bridge object for Crosschain Orders
slippage: 50, // 50 bps = 0.5%
});
```

To construct a Crosschain Delta Order it is required to either:
* provide both `beneficiary` address and `beneficiaryType` value, so that the `Order.bridge` can be constructed automatically by the SDK.
* construct Bridge object. Refer to [documentation](https://developers.velora.xyz/api/velora-api/velora-delta-api/build-a-delta-order-to-sign#sign-an-order-cross-chain) for how to do that.

This is necessary because Across, the service facilitating crosschain bridging, has [special logic when it comes to transferring ETH and WETH](https://docs.across.to/introduction/technical-faq#what-is-the-behavior-of-eth-weth-in-transfers).
Across, the service facilitating crosschain bridging, has [special logic when it comes to transferring ETH and WETH](https://docs.across.to/introduction/technical-faq#what-is-the-behavior-of-eth-weth-in-transfers). Refer to the [Velora documentation](https://developers.velora.xyz/api/velora-api/velora-delta-api/build-a-delta-order-to-sign#sign-an-order-cross-chain) for more on cross-chain orders.

### 5. Wait for Delta Order execution
### 6. Wait for Delta Order execution

```ts
// poll if necessary
function isExecutedDeltaAuction(
auction: Omit<DeltaAuction, 'signature'>,
waitForCrosschain = true // only consider executed when destChain work is done
) {
if (auction.status !== 'EXECUTED') return false;

// crosschain Order is executed on destChain if bridgeStatus is filled
if (waitForCrosschain && auction.order.bridge.destinationChainId !== 0) {
return auction.bridgeStatus === 'filled';
}

return true;
}

function fetchOrderPeriodically(auctionId: string) {
// poll if necessary — v2 status COMPLETED already accounts for the dest-chain bridge
function startStatusCheck(auctionId: string) {
const intervalId = setInterval(async () => {
const auction = await simpleSDK.delta.getDeltaOrderById(auctionId);
console.log('checks: ', auction); // Handle or log the fetched auction as needed

if (isExecutedDeltaAuction(auction)) {
clearInterval(intervalId); // Stop interval if completed
const auction = await deltaSDK.getDeltaOrderById(auctionId);
if (auction.status === 'COMPLETED') {
clearInterval(intervalId); // stop interval once completed
console.log('Order completed');
}
}, 3000);
console.log('Order Pending');
// Return intervalId to enable clearing the interval if needed externally
return intervalId;
}

function startStatusCheck(auctionId: string) {
const intervalId = fetchOrderPeriodically(auctionId);
setTimeout(() => clearInterval(intervalId), 60000 * 5); // Stop after 5 minutes
// stop polling after 5 minutes
setTimeout(() => clearInterval(intervalId), 60000 * 5);
}

startStatusCheck(deltaAuction.id);
Expand Down
Loading
Loading