Skip to content

Commit

Permalink
fix: pending incoming stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Nov 16, 2023
1 parent 4ccd831 commit 2269f19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions bats/core/api/onchain-receive.bats
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ setup_file() {
--arg address "$on_chain_address_created_1" \
'{"address": $address}'
)
exec_graphql 'alice' 'pending-transactions-by-address' "$address_1_pending_txns_variables"
exec_graphql 'alice' 'pending-incoming-transactions-by-address' "$address_1_pending_txns_variables"
pending_txns_for_address_1=$(
graphql_output '
.data.me.defaultAccount.wallets[]
| select(.__typename == "BTCWallet")
.pendingTransactionsByAddress'
.pendingIncomingTransactionsByAddress'
)
pending_txns_for_address_1_length="$(echo $pending_txns_for_address_1 | jq -r 'length')"
[[ "$pending_txns_for_address_1_length" == "1" ]] || exit 1
Expand All @@ -101,23 +101,23 @@ setup_file() {
--arg address "$on_chain_address_created_2" \
'{"address": $address}'
)
exec_graphql 'alice' 'pending-transactions-by-address' "$address_2_pending_txns_variables"
exec_graphql 'alice' 'pending-incoming-transactions-by-address' "$address_2_pending_txns_variables"
pending_txns_for_address_2=$(
graphql_output '
.data.me.defaultAccount.wallets[]
| select(.__typename == "BTCWallet")
.pendingTransactionsByAddress'
.pendingIncomingTransactionsByAddress'
)
pending_txns_for_address_2_length="$(echo $pending_txns_for_address_2 | jq -r 'length')"
[[ "$pending_txns_for_address_2_length" == "1" ]] || exit 1
address_2_from_pending_txns="$(echo $pending_txns_for_address_2 | jq -r '.[0].initiationVia.address')"
[[ "$address_2_from_pending_txns" == "$on_chain_address_created_2" ]]

# Check pending transactions for account
exec_graphql 'alice' 'pending-transactions'
exec_graphql 'alice' 'pending-incoming-transactions'
pending_txns_for_account=$(
graphql_output '
.data.me.defaultAccount.pendingTransactions'
.data.me.defaultAccount.pendingIncomingTransactions'
)
pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')"
[[ "$pending_txns_for_account_length" == "2" ]] || exit 1
Expand Down Expand Up @@ -169,7 +169,7 @@ setup_file() {
exec_graphql 'alice' 'pending-transactions'
pending_txns_for_account=$(
graphql_output '
.data.me.defaultAccount.pendingTransactions'
.data.me.defaultAccount.pendingIncomingTransactions'
)
pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')"
[[ "$pending_txns_for_account_length" == "0" ]] || exit 1
Expand Down Expand Up @@ -232,23 +232,23 @@ setup_file() {
--arg address "$on_chain_address_created" \
'{"address": $address}'
)
exec_graphql 'alice' 'pending-transactions-by-address' "$address_pending_txns_variables"
exec_graphql 'alice' 'pending-incoming-transactions-by-address' "$address_pending_txns_variables"
pending_txns_for_address=$(
graphql_output '
.data.me.defaultAccount.wallets[]
| select(.__typename == "UsdWallet")
.pendingTransactionsByAddress'
.pendingIncomingTransactionsByAddress'
)
pending_txns_for_address_length="$(echo $pending_txns_for_address | jq -r 'length')"
[[ "$pending_txns_for_address_length" == "1" ]] || exit 1
address_from_pending_txns="$(echo $pending_txns_for_address | jq -r '.[0].initiationVia.address')"
[[ "$address_from_pending_txns" == "$on_chain_address_created" ]]

# Check pending transactions for account
exec_graphql 'alice' 'pending-transactions'
exec_graphql 'alice' 'pending-incoming-transactions'
pending_txns_for_account=$(
graphql_output '
.data.me.defaultAccount.pendingTransactions'
.data.me.defaultAccount.pendingIncomingTransactions'
)
pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')"
[[ "$pending_txns_for_account_length" == "1" ]] || exit 1
Expand All @@ -257,10 +257,10 @@ setup_file() {
retry 15 1 check_for_onchain_initiated_settled 'alice' "$on_chain_address_created" 1

# Ensure no pending transactions for account
exec_graphql 'alice' 'pending-transactions'
exec_graphql 'alice' 'pending-incoming-transactions'
pending_txns_for_account=$(
graphql_output '
.data.me.defaultAccount.pendingTransactions'
.data.me.defaultAccount.pendingIncomingTransactions'
)
pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')"
[[ "$pending_txns_for_account_length" == "0" ]] || exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
query pendingTransactionsByAddress($address: OnChainAddress!) {
query pendingIncomingTransactionsByAddress($address: OnChainAddress!) {
me {
defaultAccount {
displayCurrency
wallets {
__typename
id
walletCurrency
pendingTransactionsByAddress(address: $address) {
pendingIncomingTransactionsByAddress(address: $address) {
__typename
id
status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
query pendingTransactions {
query pendingIncomingTransactions {
me {
defaultAccount {
displayCurrency
pendingTransactions {
pendingIncomingTransactions {
__typename
id
status
Expand Down

0 comments on commit 2269f19

Please sign in to comment.