Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): get order #20

Merged
merged 1 commit into from
Nov 18, 2024
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
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"