Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wrapper for devnet mint endpoint #458

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/packages/avnu_provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Index

- [I. Introduction](#i-introduction)
- [II. Functions](#ii-functions)
- [III. Example](#iii-example)
- [IV. How to run tests](#iv-how-to-run-tests)
- [I. Introduction](packages/avnu_provider#i-introduction)
- [II. Functions](packages/avnu_provider#ii-functions)
- [III. Example](packages/avnu_provider#iii-example)
- [IV. How to run tests](packages/avnu_provider#iv-how-to-run-tests)

AVNU Paymaster Provider is a Dart package that provides a way to interact with the AVNU paymaster service.

Expand Down Expand Up @@ -260,11 +260,10 @@ This is an example of a successful API response:

## IV. How to run tests

To run the tests, you need to set the environment variables `AVNU_RPC` and `STARKNET_RPC` with the corresponding values.
To run the tests, you need to set the environment variable for `AVNU_RPC` with the corresponding values.

```bash
export AVNU_RPC=https://sepolia.api.avnu.fi
export STARKNET_RPC=https://starknet-sepolia.public.blastapi.io/rpc/v0_7
```

Then, run the tests with the following command:
Expand Down
1 change: 1 addition & 0 deletions packages/starknet_provider/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tags:
unit:
integration:
1 change: 1 addition & 0 deletions packages/starknet_provider/lib/src/model/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export 'state_update.dart';
export 'syncing.dart';
export 'declare_transaction.dart';
export 'contract_class.dart';
export 'mint_transaction.dart';
42 changes: 42 additions & 0 deletions packages/starknet_provider/lib/src/model/mint_transaction.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'mint_transaction.freezed.dart';
part 'mint_transaction.g.dart';

/// Parameters for minting tokens
@freezed
class MintRequest with _$MintRequest {
const factory MintRequest({
required String address, // "0x6e3205f..."
required int amount, // 500000
/// Can be either "WEI" or "FRI"
required String unit, // "WEI" | "FRI"
}) = _MintRequest;

factory MintRequest.fromJson(Map<String, dynamic> json) =>
_$MintRequestFromJson(json);
}

/// Response from minting tokens
@freezed
class MintResponse with _$MintResponse {
const factory MintResponse({
required MintResult result,
}) = _MintResponse;

factory MintResponse.fromJson(Map<String, dynamic> json) =>
_$MintResponseFromJson(json);
}

/// Result data from minting tokens
@freezed
class MintResult with _$MintResult {
const factory MintResult({
@JsonKey(name: 'new_balance') required String newBalance,
required String unit,
@JsonKey(name: 'tx_hash') required String txHash,
}) = _MintResult;

factory MintResult.fromJson(Map<String, dynamic> json) =>
_$MintResultFromJson(json);
}
Loading