1
1
import { WalletConnectModal } from "@walletconnect/modal" ;
2
2
import { useEffect , useState , useCallback } from "react" ;
3
3
import { SAMPLES , SAMPLE_KINDS } from "./utils/samples" ;
4
- import TezosProvider , {
5
- TezosChainDataMainnet ,
6
- TezosChainDataTestnet ,
7
- } from "./utils/tezos-provider" ;
8
4
import {
5
+ TezosProvider ,
6
+ TezosChainDataTestnet ,
9
7
TezosGetAccountResponse ,
10
8
TezosSendResponse ,
11
9
TezosSignResponse ,
12
- } from "./utils /tezos-provider" ;
13
- import { ErrorObject } from ' @walletconnect/utils' ;
10
+ } from "@trili /tezos-provider" ;
11
+ import { ErrorObject } from " @walletconnect/utils" ;
14
12
15
13
const projectId = import . meta. env . VITE_PROJECT_ID ;
16
14
@@ -103,9 +101,7 @@ const App = () => {
103
101
if ( ! provider ) return ;
104
102
105
103
try {
106
- await provider . connect ( {
107
- chains : [ TezosChainDataTestnet , TezosChainDataMainnet ] ,
108
- } ) ;
104
+ await provider . connect ( { chain : TezosChainDataTestnet } ) ;
109
105
setIsConnected ( true ) ;
110
106
console . log ( "Connected to Tezos" ) ;
111
107
const balance = await provider . getBalance ( ) ;
@@ -143,26 +139,26 @@ const App = () => {
143
139
let res = null ;
144
140
switch ( kind ) {
145
141
case SAMPLE_KINDS . GET_ACCOUNTS :
146
- res = await provider . tezosGetAccounts ( ) ;
142
+ res = await provider . getAccounts ( ) ;
147
143
break ;
148
144
case SAMPLE_KINDS . SIGN :
149
- res = await provider . tezosSign ( "05010000004254" ) ;
145
+ res = await provider . sign ( "05010000004254" ) ;
150
146
break ;
151
147
case SAMPLE_KINDS . SEND_TRANSACTION :
152
- res = await provider . tezosSendTransaction (
148
+ res = await provider . sendTransaction (
153
149
SAMPLES [ SAMPLE_KINDS . SEND_TRANSACTION ] ,
154
150
) ;
155
151
break ;
156
152
case SAMPLE_KINDS . SEND_DELEGATION :
157
- res = await provider . tezosSendDelegation (
153
+ res = await provider . sendDelegation (
158
154
SAMPLES [ SAMPLE_KINDS . SEND_DELEGATION ] ,
159
155
) ;
160
156
break ;
161
157
case SAMPLE_KINDS . SEND_UNDELEGATION :
162
- res = await provider . tezosSendUndelegation ( ) ;
158
+ res = await provider . sendUndelegation ( ) ;
163
159
break ;
164
160
case SAMPLE_KINDS . SEND_ORGINATION :
165
- res = await provider . tezosSendOrigination (
161
+ res = await provider . sendOrigination (
166
162
SAMPLES [ SAMPLE_KINDS . SEND_ORGINATION ] ,
167
163
) ;
168
164
for ( let attempt = 0 ; attempt < 10 ; attempt ++ ) {
@@ -186,28 +182,26 @@ const App = () => {
186
182
}
187
183
break ;
188
184
case SAMPLE_KINDS . SEND_CONTRACT_CALL :
189
- res = await provider . tezosSendContractCall ( {
185
+ res = await provider . sendContractCall ( {
190
186
...SAMPLES [ SAMPLE_KINDS . SEND_CONTRACT_CALL ] ,
191
187
destination : contractAddress ,
192
188
} ) ;
193
189
break ;
194
190
case SAMPLE_KINDS . SEND_STAKE :
195
- res = await provider . tezosSendStake (
196
- SAMPLES [ SAMPLE_KINDS . SEND_STAKE ] ,
197
- ) ;
191
+ res = await provider . sendStake ( SAMPLES [ SAMPLE_KINDS . SEND_STAKE ] ) ;
198
192
break ;
199
193
case SAMPLE_KINDS . SEND_UNSTAKE :
200
- res = await provider . tezosSendUnstake (
194
+ res = await provider . sendUnstake (
201
195
SAMPLES [ SAMPLE_KINDS . SEND_UNSTAKE ] ,
202
196
) ;
203
197
break ;
204
198
case SAMPLE_KINDS . SEND_FINALIZE :
205
- res = await provider . tezosSendFinalizeUnstake (
199
+ res = await provider . sendFinalizeUnstake (
206
200
SAMPLES [ SAMPLE_KINDS . SEND_FINALIZE ] ,
207
201
) ;
208
202
break ;
209
203
case SAMPLE_KINDS . SEND_INCREASE_PAID_STORAGE :
210
- res = await provider . tezosSendIncreasePaidStorage ( {
204
+ res = await provider . sendIncreasePaidStorage ( {
211
205
...SAMPLES [ SAMPLE_KINDS . SEND_INCREASE_PAID_STORAGE ] ,
212
206
destination : contractAddress ,
213
207
} ) ;
@@ -253,13 +247,16 @@ const App = () => {
253
247
case SAMPLE_KINDS . SEND_STAKE :
254
248
case SAMPLE_KINDS . SEND_UNSTAKE :
255
249
case SAMPLE_KINDS . SEND_FINALIZE :
256
- setDescription ( { ...SAMPLES [ kind ] , destination : provider ?. address } ) ;
250
+ setDescription ( {
251
+ ...SAMPLES [ kind ] ,
252
+ destination : provider ?. connection ?. address ,
253
+ } ) ;
257
254
break ;
258
255
default :
259
256
setDescription ( "No description available" ) ;
260
257
}
261
258
} ,
262
- [ contractAddress , provider ?. address ] ,
259
+ [ contractAddress , provider ?. connection ?. address ] ,
263
260
) ;
264
261
265
262
const describeClear = useCallback ( ( ) => {
@@ -281,7 +278,7 @@ const App = () => {
281
278
< >
282
279
< p >
283
280
< b > Public Key: </ b >
284
- { provider ?. address ?? "No account connected" }
281
+ { provider ?. connection ?. address ?? "No account connected" }
285
282
</ p >
286
283
< p >
287
284
< b > Balance: </ b >
0 commit comments