Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 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
0edcde8
Merge pull request #241 from VeloraDEX/feat/drop-delta-v1
andriy-shymkiv Jun 3, 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
109 changes: 71 additions & 38 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