-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add getTransactionsVerbose method and operations
- Loading branch information
1 parent
1310a8b
commit b53e444
Showing
7 changed files
with
329 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../common/evmUtils/src/operations/transaction/getWalletTransactionsVerboseOperation.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import MoralisCore from '@moralisweb3/common-core'; | ||
import { EvmAddress, EvmChain } from '../../dataTypes'; | ||
import { | ||
getWalletTransactionsVerboseOperation, | ||
GetWalletTransactionsVerboseRequest, | ||
} from './getWalletTransactionsVerboseOperation'; | ||
|
||
describe('getWalletVerboseTransactionsOperation', () => { | ||
let core: MoralisCore; | ||
|
||
beforeAll(() => { | ||
core = MoralisCore.create(); | ||
}); | ||
|
||
it('serializeRequest() serializes correctly and deserializeRequest() deserializes correctly', () => { | ||
const address = '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'; | ||
const chain = '0x10'; | ||
const fromDate = '2021-01-01T00:00:00.000Z'; | ||
const toDate = '2021-01-01T00:00:00.000Z'; | ||
|
||
const request: Required<GetWalletTransactionsVerboseRequest> = { | ||
address: EvmAddress.create(address, core), | ||
chain: EvmChain.create(chain, core), | ||
fromBlock: 10, | ||
toBlock: 20, | ||
fromDate: new Date(fromDate), | ||
toDate: new Date(toDate), | ||
subdomain: 'test.com', | ||
cursor: 'CURSOR1', | ||
limit: 333, | ||
}; | ||
|
||
const serializedRequest = getWalletTransactionsVerboseOperation.serializeRequest(request, core); | ||
|
||
expect(serializedRequest.address).toBe(address); | ||
expect(serializedRequest.chain).toBe(chain); | ||
expect(serializedRequest.fromBlock).toBe(request.fromBlock); | ||
expect(serializedRequest.toBlock).toBe(request.toBlock); | ||
expect(serializedRequest.fromDate).toBe(request.fromDate); | ||
expect(serializedRequest.toDate).toBe(request.toDate); | ||
expect(serializedRequest.subdomain).toBe(request.subdomain); | ||
expect(serializedRequest.cursor).toBe(request.cursor); | ||
expect(serializedRequest.limit).toBe(request.limit); | ||
|
||
const deserializedRequest = getWalletTransactionsVerboseOperation.deserializeRequest(serializedRequest, core); | ||
|
||
expect((deserializedRequest.address as EvmAddress).checksum).toBe(address); | ||
expect((deserializedRequest.chain as EvmChain).apiHex).toBe(chain); | ||
expect(deserializedRequest.fromBlock).toBe(request.fromBlock); | ||
expect(deserializedRequest.toBlock).toBe(request.toBlock); | ||
expect(deserializedRequest.fromDate).toBe(request.fromDate); | ||
expect(deserializedRequest.toDate).toBe(request.toDate); | ||
expect(deserializedRequest.subdomain).toBe(request.subdomain); | ||
expect(deserializedRequest.cursor).toBe(request.cursor); | ||
expect(deserializedRequest.limit).toBe(request.limit); | ||
}); | ||
}); |
Oops, something went wrong.