Skip to content

Commit

Permalink
chore(docs): get order
Browse files Browse the repository at this point in the history
  • Loading branch information
R0bi7 committed Nov 18, 2024
1 parent b4e619e commit ddbff67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,25 @@ if (isAllowanceValid.ok) {
}
```

## Get Intent Order

After the Intent order is created (`executeIntentOrder`), the resulting `txHash` can be used to query created on-chain order data.
Intent order id is assigned as a part of tx execution, thus if you want to grab an actual order id to be potentially canceled in future
you should invoke `IntentService.getOrder(..)` function.

Example get order:

```typescript
import { IntentService } from "@balanced/solver-sdk"

const evmProvider = new EvmProvider("0x601020c5797Cdd34f64476b9bf887a353150Cb9a", (window as any).ethereum)
const intentOrder: SwapOrder = await IntentService.getOrder(
"0xabcdefasdasdsafssadasdsadsadasdsadasdsadsa",
IntentService.getChainConfig("arb").intentContract,
evmProvider,
)
```

## Get Intent Status

After Intent Order is created, the resulting `task_id` can be used to query the status of the task.
Expand Down
1 change: 0 additions & 1 deletion src/services/IntentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
SuiProvider,
type GetChainProviderType,
SwapOrder,
type ChainProviderType,
type ChainProvider,
} from "../entities/index.js"
import { EvmIntentService } from "./EvmIntentService.js"
Expand Down
3 changes: 0 additions & 3 deletions src/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export * from "./IntentService.js"
export * from "./EvmIntentService.js"
export * from "./SuiIntentService.js"
export * from "./SolverApiService.js"

0 comments on commit ddbff67

Please sign in to comment.