Skip to content

Commit e04e2f2

Browse files
committed
Get getWalletBalance back to the way it was
CTL updates caused it to throw a bigger error than it was before. Unsure how it wasn't throwing a bigger error before, the way we were providing the function didn't make any sense
1 parent ad0b0c7 commit e04e2f2

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function callMarketPlaceListNft(config: Config):
1010
export function callMarketPlaceFetchNft(config: Config, args: FetchNftArgs):
1111
Promise<NftListing?>
1212
export function connectWallet(): Promise<any>
13-
export function getWalletBalance(): Promise<any>
13+
export function getWalletBalance(config: Config): Promise<any>
1414

1515
export type NetworkId
1616
= 0 // Testnet

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ exports.callMarketPlaceFetchNft = async (config, args) => {
3636
/**
3737
* Returns a promise containing the connected wallet's balance.
3838
*/
39-
exports.getWalletBalance = async () => {
39+
exports.getWalletBalance = async (config) => {
4040
const sb = await seabug;
41-
return sb.getWalletBalance();
41+
return sb.callGetWalletBalance(config);
4242
};
4343

4444
// Uncomment this for manually minting new tokens (see README)

src/Seabug/CallContract.purs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Seabug.CallContract
2-
( callMarketPlaceBuy
2+
( callGetWalletBalance
3+
, callMarketPlaceBuy
34
, callMarketPlaceFetchNft
45
, callMarketPlaceListNft
56
, callMint
@@ -17,6 +18,7 @@ import Contract.Transaction
1718
, TransactionOutput(TransactionOutput)
1819
, awaitTxConfirmed
1920
)
21+
import Contract.Utxos (getWalletBalance)
2022
import Contract.Value
2123
( CurrencySymbol
2224
, TokenName
@@ -33,7 +35,7 @@ import Control.Promise as Promise
3335
import Data.BigInt (BigInt)
3436
import Data.BigInt as BigInt
3537
import Data.Log.Level (LogLevel(..))
36-
import Data.Nullable (Nullable, notNull, null)
38+
import Data.Nullable (Nullable, notNull, null, toNullable)
3739
import Data.Tuple.Nested ((/\))
3840
import Data.UInt as UInt
3941
import Effect (Effect)
@@ -70,6 +72,12 @@ import Types.Natural as Nat
7072
liftBuilder :: forall a. Either Error a -> Aff a
7173
liftBuilder = liftEffect <<< liftEither
7274

75+
callGetWalletBalance
76+
:: ContractConfiguration -> Effect (Promise (Nullable Value))
77+
callGetWalletBalance cfg = Promise.fromAff do
78+
contractConfig <- liftBuilder $ buildContractConfig cfg
79+
toNullable <$> runContract contractConfig getWalletBalance
80+
7381
callMint :: ContractConfiguration -> MintArgs -> Effect (Promise Unit)
7482
callMint cfg args = Promise.fromAff do
7583
contractConfig <- liftBuilder $ buildContractConfig cfg

src/Seabug/Seabug.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
module Seabug
22
( module Seabug.CallContract
3-
, module QueryM.Utxos
43
, mint
54
) where
65

76
import Contract.Prelude
87

98
import Control.Promise (Promise)
109
import Data.BigInt as BigInt
11-
import QueryM.Utxos (getWalletBalance)
1210
import Seabug.CallContract
1311
( callMarketPlaceBuy
1412
, callMarketPlaceListNft
1513
, callMarketPlaceFetchNft
1614
, callMint
15+
, callGetWalletBalance
1716
)
1817

1918
mint :: Effect (Promise Unit)

0 commit comments

Comments
 (0)