-
Notifications
You must be signed in to change notification settings - Fork 7
/
relayx_test.tsx
67 lines (47 loc) · 1.51 KB
/
relayx_test.tsx
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
import { useState, useEffect } from 'react';
import { BoostPowJob } from 'boostpow';
import { bsv } from 'scrypt-ts';
import ThreeColumnLayout from '../components/ThreeColumnLayout';
import RelayxWallet from '../wallets/relayx';
import { useRelay } from '../context/RelayContext'
export default function Home() {
const [txId, setTxid] = useState<string | null>();
const [txHex, setTxhex] = useState<string | null>();
const { relayxPaymail, relayxWallet } = useRelay()
useEffect(() => {
const wallet = relayxWallet as RelayxWallet;
wallet.createBoostTransaction([{
job: BoostPowJob.fromObject({
content: '88c9b1254c8a63aa006df09750128ae80457cc85251c31f585666066d4dfc052',
diff: 1,
tag: Buffer.from('music.house', 'utf8').toString('hex'),
}),
value: BigInt(1000),
}, {
job: BoostPowJob.fromObject({
content: '88c9b1254c8a63aa006df09750128ae80457cc85251c31f585666066d4dfc052',
diff: 1,
tag: Buffer.from('fun', 'utf8').toString('hex'),
}),
value: BigInt(1000),
}])
.then((tx: bsv.Transaction) => {
setTxid(tx.hash);
setTxhex(tx.toString());
})
.catch(console.error);
}, []);
return (
<ThreeColumnLayout>
<h1>Test Relayx Boostpow</h1>
{txId ? (
<div>
<p>txid: {txId}</p>
<p>txhex: {txHex}</p>
</div>
) : (
<p>Posting Boost of Two 1000 sat Outputs</p>
)}
</ThreeColumnLayout>
);
}