Skip to content

Commit 459daa6

Browse files
SunZhiCgitbook-bot
authored andcommitted
GITBOOK-841: change request with no subject merged in GitBook
1 parent 38bda94 commit 459daa6

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

developers/auth-service/sdks/flutter.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,117 @@ static void openWebWallet() {
429429
ParticleAuth.openWebWallet();
430430
}
431431
```
432+
433+
## EVM Service
434+
435+
### Write Contract
436+
437+
Get a write contract transaction
438+
439+
```dart
440+
String publicAddress = "your public address";
441+
String contractAddress = "your contract address";
442+
String methodName = "mint"; // this is your contract method name, like balanceOf, mint.
443+
List<Object> params = <Object>["1"]; // this is the method params.
444+
445+
// abi json string, you can get it from your contract developer.
446+
// such as
447+
// [{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]
448+
const abiJsonString = null;
449+
450+
final result = EvmService.writeContract(publicAddress, contractAddress, methodName, params, abiJsonString, true);
451+
452+
```
453+
454+
### Read contract
455+
456+
Read conrtact data from blockchain
457+
458+
```dart
459+
String publicAddress = "your public address";
460+
String contractAddress = "your contract address";
461+
String methodName ="mint"; // this is your contract method name, like balanceOf, mint.
462+
List<Object> parameters = <Object>["1"]; // this is the method params.
463+
464+
// abi json string, you can get it from your contract developer.
465+
// such as
466+
// [{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]
467+
const abiJsonString = null;
468+
469+
final result = await EvmService.readContract(publicAddress, contractAddress, methodName, parameters, abiJsonString);Cr
470+
```
471+
472+
### Estimate gas
473+
474+
Return estimated gas
475+
476+
```dart
477+
final result = await EvmService.evmEstimateGas(from, to, value, data);
478+
```
479+
480+
### Get suggested gas fees
481+
482+
Return gas fee json object.
483+
484+
```dart
485+
final result = await EvmService.suggestedGasFees();
486+
```
487+
488+
### Get tokens and NFTs
489+
490+
Return all tokens, NFTs and native amount at this address.
491+
492+
```dart
493+
final result = await EvmService.getTokensAndNFTs(publicAddress);
494+
```
495+
496+
### Get tokens
497+
498+
Return all tokens and native amount at this address.
499+
500+
```dart
501+
final result = await EvmService.getTokens(publicAddress);
502+
```
503+
504+
### Get NFTs
505+
506+
Return all NFTs at this address.
507+
508+
```dart
509+
final result = await EvmService.getNFTs(publicAddress);
510+
```
511+
512+
### Get token by token addresses
513+
514+
Return the balance of the token specified below this address
515+
516+
```dart
517+
final result = await EvmService.getTokenByTokenAddresses(publicAddress, tokenAddresses);
518+
```
519+
520+
### Get transactions by address
521+
522+
Return all transaction at this address
523+
524+
```dart
525+
final result = await EvmService.getTransactionsByAddress(publicAddress);
526+
```
527+
528+
### Get price
529+
530+
Return token price
531+
532+
```dart
533+
final result = await EvmService.getPrice(tokenAddresses, currencies);
534+
```
535+
536+
### Get smart account
537+
538+
Require add particle\_biconomy and enable Biconomy.
539+
540+
Return smart account json object
541+
542+
```dart
543+
final result = await EvmService.getSmartAccount(eoaAddresses, version);
544+
```
545+

0 commit comments

Comments
 (0)