-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.ts
69 lines (60 loc) · 1.59 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { SupportedChainId, OrderKind, postSwapOrder, postLimitOrder } from '../../../src'
const privateKey = 'xxx'
// Swap
;(async function () {
return
postSwapOrder({
appCode: 'cow-sdk-example',
signer: privateKey,
chainId: SupportedChainId.SEPOLIA,
kind: OrderKind.SELL,
sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
sellTokenDecimals: 18,
buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59',
buyTokenDecimals: 18,
amount: '120000000000000000',
})
})()
// Limit order
;(async function () {
return
postLimitOrder({
appCode: 'cow-sdk-example',
signer: privateKey,
chainId: SupportedChainId.SEPOLIA,
kind: OrderKind.BUY,
sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
sellTokenDecimals: 18,
buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59',
buyTokenDecimals: 18,
sellAmount: '120000000000000000',
buyAmount: '66600000000000000000',
networkCostsAmount: '0',
})
})()
// Swap with partner fee
;(async function () {
postSwapOrder(
{
appCode: 'cow-sdk-example',
signer: privateKey,
chainId: SupportedChainId.SEPOLIA,
kind: OrderKind.SELL,
sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
sellTokenDecimals: 18,
buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59',
buyTokenDecimals: 18,
amount: '120000000000000000',
},
{
appData: {
metadata: {
partnerFee: {
bps: 100,
recipient: '0xfb3c7eb936cAA12B5A884d612393969A557d4307',
},
},
},
}
)
})()