-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support async faucet transactions
This adds support for asynchronous faucet transactions. This will make faucet transactions consistent with other transactions and will make them more stable, as we can poll for the status on the SDK side rather than on the server side. ``` faucet_tx = wallet.faucet faucet_tx.wait! ``` or ``` wallet.faucet.wait! ```
- Loading branch information
1 parent
86889b6
commit b61c3df
Showing
11 changed files
with
277 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
FactoryBot.define do | ||
factory :faucet_tx_model, class: Coinbase::Client::FaucetTransaction do | ||
transient do | ||
status { 'broadcasted' } | ||
network_trait { :base_sepolia } | ||
to_address_id { nil } | ||
transaction_hash { nil } | ||
end | ||
|
||
# Default traits | ||
base_sepolia | ||
pending | ||
|
||
TX_TRAITS.each do |status| | ||
trait status do | ||
status { status } | ||
end | ||
end | ||
|
||
NETWORK_TRAITS.each do |network| | ||
trait network do | ||
network_trait { network } | ||
end | ||
end | ||
|
||
after(:build) do |transfer, transients| | ||
transfer.transaction = build( | ||
:transaction_model, | ||
transients.status, | ||
transients.network_trait, | ||
{ | ||
to_address_id: transients.to_address_id, | ||
transaction_hash: transients.transaction_hash | ||
}.compact | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.