References

This document features the method references for now.gg Gaming Wallet.

1. NowGGWalletSdkManager

The NowGGWalletSdkManager provides the public methods for your game (dapp) to interact with the now.gg wallet.

Property:

Instance – Returns the instance of the class.

Methods:

1. Initialize

This method is used to Initialize the Wallet SDK with provided arguments.
Returns – void.

Argument  Summary
string apiKey API key provided by now.gg.
string appId Your game-specific app id.
NowGGWalletDelegate walletDelegate Delegate implementation for receiving events in your game.
VoidCallback OnDone Callback for successful initialization.
StringCallback OnFailed Callback for initialization failure.

2. Connect

This method is used to request a connection with now.gg Wallet.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
  • SocketNotConnectedException
    This exception is thrown if the connection state is not available.
Argument Summary
caipChainId Chain agnostic improvement proposal’s chain id. (CAIP).
voidCallback onPairingInvoked Called when pairing is invoked.
stringCallback onError Called in case of an error.

3. SendTransaction

This method is used to request transaction approval with the connected now.gg Wallet.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
  • SocketNotConnectedException
    This exception is thrown if the connection state is not available.
Argument Summary
string toAddress The wallet address where the transaction value should be sent.
string value Value to be sent.
string data The data to be sent along with the request.
string caipChainId Chain agnostic improvement proposal’s chain id. ()
string extra Extra information to be passed for a transaction.

4. BuyToken

This method requests the wallet to initiate the buying token procedure.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
  • SocketNotConnectedException
    This exception is thrown if the connection state is not available.
Argument Summary
string coinContractAddress ERC20 contract address of token which needs to be bought.
string value The value of the token to be bought.
string caipChainId Chain agnostic improvement proposal’s chain id. (CAIP)
string extra Extra information to be passed for a transaction.

5. GetNfts

This method requests the list of NFTs for the current user.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
Argument Summary
string caipChainId Chain agnostic improvement proposal’s chain id. (CAIP)
string address The wallet address of the current user.
OnNftsReceived onNftsReceived Callback when the result is available for NFTs.
stringCallback onError Called in case of an error.

6. GetTokenBalance

This method is used to retrieve the token balance for the current user.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
Argument Summary
string coinContractAddess ERC20 contract address of token whose balance needs to be retrieved.
string caipChainId The caipChainId for which balance is requested in (CAIP).
string address The wallet address of the current user.
stringCallback onSuccess Callback when the result is available.
stringCallback onError Called in case of an error.

7. GetTransactionInfo

This method retrieves the transaction information for the provided hash.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
Argument Summary
string caipChainId caipChainId where the transaction was made.  (CAIP)
string transactionHash The transaction hash for which information is being requested.
OnTransactionsReceived onTransactionsReceived Callback when the result is available.
stringCallback onError Called in case of an error.

8. Ping

This method pings the connected wallet.

Returns – void.

Exceptions:

  • WalletSdkNotInitialisedException
    This exception is thrown if the SDK is not initialised.
Argument Summary
stringCallback onPingSuccess Callback when ping is successful.
stringCallback onPingError Called in case of an error

2. NowGGWalletDelegate

This Interface defines the contract using callbacks on interaction with the wallet.

Methods:

1. OnSessionApproved

This method is triggered when the wallet approves a session request.
Returns – void.

Argument Summary
ApprovedSession approvedSession Session details, including topic and wallet address.
User user The user information associated with the wallet holder, including:

  • Avatar
  • Name
  • Geo
  • Email Id

2. OnSessionRejected

This method is triggered when the wallet rejects a session request.
Returns – void.

Argument Summary
RejectedSession rejectedSession Information associated with a rejected session request.

3. OnSessionUpdate

This method is triggered when the information associated with a session is updated.
Returns – void.

Argument Summary
UpdatedSession updatedSession Updated session information.

4. OnSessionDelete

This method is triggered when a session is deleted.
Returns – void.

Argument Summary
DeletedSession session Information associated with a deleted session.

5. OnConnectionStateChange

This method is triggered when the connection state changes.
Returns – void.

Argument Summary
bool isAvailable A flag which tells if the connection is available.

If isAvailable is true, you can continue with your operations.

If isAvailable is false, calling the Connect, SendTransaction, or BuyToken methods of NowGGWalletSdkManager class will raise the following exceptions:

  • WalletSdkNotInitialisedException
  • SocketNotConnectedException

6. OnError

This method is triggered when there is an error.
Returns – void.

Argument Summary
string error Error Information / Error Code.

Important Information

7. OnTokenPurchaseSuccess

This method is triggered when a token purchase is successful.
Returns – void.

Argument Summary
JsonRpcResponse result Result received from the wallet.
string extra Extra data that we initially sent along with BuyToken, reverted by the wallet.

8. OnTokenPurchaseError

This method is triggered when a token purchase fails.
Returns – void.

Argument Summary
string error Error information received from the wallet.
string extra Extra data that we initially sent along with BuyToken, reverted by the wallet.

9. OnTransactionSendError

This method is triggered when an error occurs while requesting for SendTransaction operation.
Returns – void.

Argument Summary
string error Error information.
string extra Extra data that we initially sent along with SendTransaction, reverted by the wallet.

10. OnTransactionSendSuccess

This method is triggered when a request has been successfully made for a transaction to the wallet.
Returns – void.

Argument Summary
string txnHash The hash of the transaction received from the wallet.
string caipChainId Chain agnostic improvement proposal’s chain id. (CAIP)
string extra Extra data that we initially sent along with SendTransaction, reverted by the wallet.

11. OnTransactionCompletedSuccess

This method is triggered when a transaction is completed successfully.
Returns – void.

Argument Summary
TransactionInfo transaction Transaction information object
string extra Extra data that we initially sent along with SendTransaction, reverted by the wallet.

12. OnTransactionCompletedError

This method is triggered when a transaction is completed with an error post-wallet approval request.
Returns – void.

Argument Summary
string error Error information.
string extra Extra data that we initially sent along with SendTransaction, reverted by the wallet.

 


3. ErrorCodes

This class defines the list of error codes that may be raised during interaction with now.gg Wallet.

Argument Error Code Summary
String SESSION_EXPIRED sessionExpired You must reconnect to the Wallet module by calling the Connect function of the NowGGWalletSdkManager class.

 


4. Supported Blockchains

The following is the list of supported blockchains:

Blockchain
Ethereum
Binance Smart Chain
Polygon
Avalanche C-Chain
Optimism
Arbitrum
Polkadot
Solana
Tron
Algorand
Fantom
Litecoin
Cosmos
Dogecoin
Dash
DigiByte
Ethereum Classic
Zcash
XRP
Stellar
Bitcoin Cash
Bitcoin
Bitcoin Gold
EOS
TerraV2
NEAR
Kusama
Theta
NEO
×

Table of Contents

References

Table of Contents

Document Rev. 1.0

Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg