Skip to content

Commit

Permalink
feat: intent extra data payload - quote_uuid (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
R0bi7 authored Nov 15, 2024
1 parent bee0dbe commit 43ea43d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/services/EvmIntentService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Address, type Hash, parseEventLogs, type TransactionReceipt } from "viem"
import { type Address, type Hash, parseEventLogs, stringToBytes, type TransactionReceipt } from "viem"
import { erc20Abi, intentAbi } from "../abis/index.js"
import { SwapOrder, EvmProvider } from "../entities/index.js"
import type { ChainConfig, CreateIntentOrderPayload, EvmChainConfig, Result } from "../types.js"
Expand Down Expand Up @@ -101,7 +101,11 @@ export class EvmIntentService {
payload.amount,
payload.toToken,
payload.toAmount,
new Uint8Array(),
stringToBytes(
JSON.stringify({
quote_uuid: payload.quote_uuid,
}),
),
)

const isNative = payload.token.toLowerCase() == fromChainConfig.nativeToken.toLowerCase()
Expand Down
7 changes: 6 additions & 1 deletion src/services/SuiIntentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChainConfig, CreateIntentOrderPayload, Result, SuiChainConfig } fr
import { Transaction, type TransactionResult } from "@mysten/sui/transactions"
import { signAndExecuteTransaction } from "@mysten/wallet-standard"
import { SuiProvider, SwapOrder } from "../entities/index.js"
import { stringToBytes } from "viem"

export class SuiIntentService {
private constructor() {}
Expand Down Expand Up @@ -32,7 +33,11 @@ export class SuiIntentService {
payload.amount,
payload.toToken,
payload.toAmount,
new Uint8Array(),
stringToBytes(
JSON.stringify({
quote_uuid: payload.quote_uuid,
}),
),
)

const isNative = payload.token.toLowerCase() == fromChainConfig.nativeToken.toLowerCase()
Expand Down

0 comments on commit 43ea43d

Please sign in to comment.