Skip to content

Commit 94148f8

Browse files
committed
add fetchTransaction
1 parent 4f3ffd5 commit 94148f8

File tree

8 files changed

+66
-36
lines changed

8 files changed

+66
-36
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Simple WalletConnect v2 integration package for Vue3 apps.
1515
- [Connect wallet button](#connect-wallet-button)
1616
- [FetchGasPrice](#fetchgasprice)
1717
- [FetchBlockNumber](#fetchblocknumber)
18+
- [FetchTransaction](#fetchtransaction)
1819
- [Multicall](#multicall)
1920
- [FetchBalance](#fetchbalance)
2021
- [FetchToken](#fetchtoken)
@@ -112,6 +113,15 @@ let data = await fetchBlockNumber()
112113
*/
113114
```
114115

116+
## FetchTransaction
117+
```js
118+
import {fetchTransaction} from '@kolirt/vue-web3-auth'
119+
120+
let txn = await fetchTransaction({
121+
hash: '0x7ed8dc64f54ae43f4d53173e95aa929c52de44ec5cea8c28246989914ed7f4fb'
122+
})
123+
```
124+
115125
## Multicall
116126
```ts
117127
import {multicallABI, multicall, chain} from '@kolirt/vue-web3-auth'

lib/actions/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export {
2+
fetchBalance
3+
} from './balance'
4+
5+
export {
6+
fetchBlockNumber
7+
} from './block'
8+
9+
export {
10+
readContract,
11+
writeContract,
12+
estimateWriteContractGas
13+
} from './contract'
14+
15+
export {
16+
fetchGasPrice
17+
} from './gas'
18+
19+
export {
20+
multicall
21+
} from './multicall'
22+
23+
export {
24+
fetchToken
25+
} from './token'
26+
27+
export {
28+
fetchTransaction
29+
} from './transaction'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {MulticallArgs} from './types'
1+
import type {MulticallArgs} from '../types'
22
import {multicall as masterMulticall} from '@wagmi/core'
33

44
export async function multicall(params: MulticallArgs) {

lib/actions/transaction.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type {FetchTransaction} from '../types'
2+
import {fetchTransaction as masterFetchTransaction} from '@wagmi/core'
3+
import {chain} from '../chain'
4+
5+
export function fetchTransaction(data: FetchTransaction) {
6+
return masterFetchTransaction({
7+
chainId: data.chainId || chain.value.id,
8+
hash: data.hash
9+
})
10+
}

lib/index.ts

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import * as Chains from '@wagmi/core/chains'
22

3-
export type {Chain, Options} from './types'
4-
5-
export {createWeb3Auth} from './plugin'
3+
export * from './actions'
64

7-
export {
8-
$on,
9-
$off
10-
} from './event'
5+
export * from './utils/abi'
116

127
export {
138
connect,
@@ -25,37 +20,18 @@ export {
2520
} from './chain'
2621

2722
export {
28-
fetchBalance
29-
} from './actions/balance'
30-
31-
export {
32-
fetchBlockNumber
33-
} from './actions/block'
34-
35-
export {
36-
fetchToken
37-
} from './actions/token'
38-
39-
export {
40-
readContract,
41-
writeContract,
42-
estimateWriteContractGas
43-
} from './actions/contract'
23+
Events
24+
} from './enums'
4425

4526
export {
46-
fetchGasPrice
47-
} from './actions/gas'
27+
$on,
28+
$off
29+
} from './event'
4830

49-
export {
50-
multicall
51-
} from './multicall'
31+
export {createWeb3Auth} from './plugin'
5232

53-
export {
54-
Events
55-
} from './enums'
33+
export type {Chain, Options} from './types'
5634

5735
export {
5836
Chains
5937
}
60-
61-
export * from './utils/abi'

lib/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,9 @@ export type FetchFeeData = {
105105

106106
export type FetchBlockNumber = {
107107
chainId?: number
108+
}
109+
110+
export type FetchTransaction = {
111+
chainId?: number
112+
hash: `0x${string}`
108113
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
4040
// "strictNullChecks": true, /* Enable strict null checks. */
4141
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
42-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on actions. */
42+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
4343
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
4444
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
4545
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

tsconfig.lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
4040
// "strictNullChecks": true, /* Enable strict null checks. */
4141
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
42-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on actions. */
42+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
4343
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
4444
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
4545
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

0 commit comments

Comments
 (0)