Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsichury committed Nov 3, 2023
1 parent 7e3c52f commit 6b3d62b
Show file tree
Hide file tree
Showing 53 changed files with 3,451 additions and 3,037 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"bench": "node benchmarking/bench.js",
"date": "node benchmarking/generateDateInRange.js",
"lint": "eslint src",
"prettier": "prettier src --write",
"prepare": "husky install"
},
"type": "module",
Expand Down
334 changes: 166 additions & 168 deletions src/Fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,168 +1,166 @@
import { IndexedOrder, OrderResponse, FullOrder } from '@airswap/types';
import { FullOrderERC20 } from '@airswap/types';
import { AddressZero } from '@ethersproject/constants';
import { DbOrderERC20, DbOrder } from './model/DbOrderTypes.js';
import { JsonRpcResponse } from '@airswap/libraries';

export function forgeIndexedOrderERC20(expectedAddedDate: number, expiryDate: number, hash = 'hash'): IndexedOrder<DbOrderERC20> {
return { order: forgeDbOrderERC20(expiryDate), addedOn: expectedAddedDate, hash };
}

export function forgeIndexedOrder(expectedAddedDate: number, expiryDate: number, hash = 'hash'): IndexedOrder<DbOrder> {
return { order: forgeDbOrder(expiryDate), addedOn: expectedAddedDate, hash };
}

export function forgeIndexedOrderResponseERC20(expectedAddedDate: number, expiryDate: number, hash = 'hash'): IndexedOrder<FullOrderERC20> {
return {
hash,
addedOn: expectedAddedDate,
order: forgeFullOrderERC20(expiryDate)
}
}
export function forgeIndexedOrderResponse(expectedAddedDate: number, expiryDate: number, hash = 'hash'): IndexedOrder<FullOrder> {
return {
hash,
addedOn: expectedAddedDate,
order: forgeFullOrder(expiryDate)
}
}

export function forgeDbOrderERC20(expiryDate: number): DbOrderERC20 {
return {
nonce: "123",
expiry: expiryDate / 1000,
signerWallet: AddressZero,
signerToken: AddressZero,
signerAmount: "5",
senderToken: AddressZero,
senderAmount: "10",
protocolFee: "4",
senderWallet: AddressZero,
approximatedSignerAmount: BigInt(5),
approximatedSenderAmount: BigInt(10),
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero
};
}

export function forgeDbOrder(expiryDate: number): DbOrder {
return {
nonce: "123",
expiry: expiryDate / 1000,
protocolFee: "100",
signer: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100",
approximatedAmount: BigInt("100")
},
sender: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100",
approximatedAmount: BigInt("100")
},
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero,
affiliateWallet: AddressZero,
affiliateAmount: "13"
};
}



export function forgeFullOrderERC20(expiryDate: number): FullOrderERC20 {
return {
nonce: "123",
expiry: `${expiryDate / 1000}`,
signerWallet: AddressZero,
signerToken: AddressZero,
signerAmount: "5",
senderToken: AddressZero,
senderAmount: "10",
protocolFee: "4",
senderWallet: AddressZero,
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero
};
}

export function forgeFullOrder(expiryDate: number): FullOrder {
return {
nonce: "123",
expiry: String(expiryDate / 1000),
protocolFee: "100",
signer: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100"
},
sender: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100"
},
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero,
affiliateWallet: AddressZero,
affiliateAmount: "13"
};
}

export function forgeOrderERC20Response(): OrderResponse<FullOrderERC20> {
return {
orders: {
aze: {
addedOn: 1653900784696,
hash: "hash",
order: forgeFullOrderERC20(1653900784706),
},
},
pagination: {
limit: 10,
offset: 0,
total:1
}
}
}

export function forgeOrderResponse(): OrderResponse<FullOrder> {
return {
orders: {
aze: {
addedOn: 1653900784696,
hash: "hash",
order: forgeFullOrder(1653900784706),
},
},
pagination: {
limit: 10,
offset: 0,
total:1
}
}
}

export function forgeJsonRpcResponse(id: string, response: OrderResponse<FullOrderERC20 | FullOrder>): JsonRpcResponse<FullOrderERC20 | FullOrder> {
return new JsonRpcResponse(id, response);
}
import { IndexedOrder, OrderResponse, FullOrder } from "@airswap/types";
import { FullOrderERC20 } from "@airswap/types";
import { AddressZero } from "@ethersproject/constants";
import { DbOrderERC20, DbOrder } from "./model/DbOrderTypes.js";
import { JsonRpcResponse } from "@airswap/libraries";

export function forgeIndexedOrderERC20(expectedAddedDate: number, expiryDate: number, hash = "hash"): IndexedOrder<DbOrderERC20> {
return { order: forgeDbOrderERC20(expiryDate), addedOn: expectedAddedDate, hash };
}

export function forgeIndexedOrder(expectedAddedDate: number, expiryDate: number, hash = "hash"): IndexedOrder<DbOrder> {
return { order: forgeDbOrder(expiryDate), addedOn: expectedAddedDate, hash };
}

export function forgeIndexedOrderResponseERC20(expectedAddedDate: number, expiryDate: number, hash = "hash"): IndexedOrder<FullOrderERC20> {
return {
hash,
addedOn: expectedAddedDate,
order: forgeFullOrderERC20(expiryDate)
};
}
export function forgeIndexedOrderResponse(expectedAddedDate: number, expiryDate: number, hash = "hash"): IndexedOrder<FullOrder> {
return {
hash,
addedOn: expectedAddedDate,
order: forgeFullOrder(expiryDate)
};
}

export function forgeDbOrderERC20(expiryDate: number): DbOrderERC20 {
return {
nonce: "123",
expiry: expiryDate / 1000,
signerWallet: AddressZero,
signerToken: AddressZero,
signerAmount: "5",
senderToken: AddressZero,
senderAmount: "10",
protocolFee: "4",
senderWallet: AddressZero,
approximatedSignerAmount: BigInt(5),
approximatedSenderAmount: BigInt(10),
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero
};
}

export function forgeDbOrder(expiryDate: number): DbOrder {
return {
nonce: "123",
expiry: expiryDate / 1000,
protocolFee: "100",
signer: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100",
approximatedAmount: BigInt("100")
},
sender: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100",
approximatedAmount: BigInt("100")
},
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero,
affiliateWallet: AddressZero,
affiliateAmount: "13"
};
}

export function forgeFullOrderERC20(expiryDate: number): FullOrderERC20 {
return {
nonce: "123",
expiry: `${expiryDate / 1000}`,
signerWallet: AddressZero,
signerToken: AddressZero,
signerAmount: "5",
senderToken: AddressZero,
senderAmount: "10",
protocolFee: "4",
senderWallet: AddressZero,
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero
};
}

export function forgeFullOrder(expiryDate: number): FullOrder {
return {
nonce: "123",
expiry: String(expiryDate / 1000),
protocolFee: "100",
signer: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100"
},
sender: {
wallet: AddressZero,
token: AddressZero,
kind: "akind",
id: "aid",
amount: "100"
},
r: "0x3e1010e70f178443d0e3437464db2f910be150259cfcbe8916a6267247bea0f7",
s: "0x5a12fdf12c2b966a98d238916a670bdfd83e207e54a9c7d0af923839582de79f",
v: "28",
chainId: 5,
swapContract: AddressZero,
affiliateWallet: AddressZero,
affiliateAmount: "13"
};
}

export function forgeOrderERC20Response(): OrderResponse<FullOrderERC20> {
return {
orders: {
aze: {
addedOn: 1653900784696,
hash: "hash",
order: forgeFullOrderERC20(1653900784706)
}
},
pagination: {
limit: 10,
offset: 0,
total: 1
}
};
}

export function forgeOrderResponse(): OrderResponse<FullOrder> {
return {
orders: {
aze: {
addedOn: 1653900784696,
hash: "hash",
order: forgeFullOrder(1653900784706)
}
},
pagination: {
limit: 10,
offset: 0,
total: 1
}
};
}

export function forgeJsonRpcResponse(id: string, response: OrderResponse<FullOrderERC20 | FullOrder>): JsonRpcResponse<FullOrderERC20 | FullOrder> {
return new JsonRpcResponse(id, response);
}
5 changes: 2 additions & 3 deletions src/client/BroadcastClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from 'axios';
import axios from "axios";
export class BroadcastClient {
async broadcastTo(method: string, url: string, data?: any) {
console.log("S--->", method, url, data);
Expand All @@ -17,5 +17,4 @@ export class BroadcastClient {
console.log("Client did not answer !", method, url, data, e);
}
}

}
}
Loading

0 comments on commit 6b3d62b

Please sign in to comment.