Wallets
HeathenEngineering.BGSDK.API.Wallets
1
HeathenEngineering.BGSDK.API.Server.Tokens
Copied!
A wrapper around token management features.
Wallet API
Venly API

Overview

Wallets are the primary means to interact with the Blockchain assets from within your game/app at run time. The typical use case is to fetch the list of wallets owned by the current user, and use these during the execution of your game or app to fetch specifics about the items the current user owns.
Note that "minting" or creating new items (tokens) is a secure operation that cannot be performed from the game/app client. That is the program the player is running cannot itself create a new token and add it to the users wallet.
Instead you will need to use a trusted system such as a Web Server or Live Operations provider to perform these trusted operations against the Arkane Web API.
The purpose of the BGSDK integration in Unity is to simplify the use of these items in game e.g. to easily query what items a user has, and relate that to objects in Unity for gameplay/app execution purposes.

Features

Create

This methods should only be called from a server build.
1
public static IEnumerator Create(string pincode,
2
string identifier,
3
SecretType chain,
4
Action<ListWalletResult> callback);
Copied!
Creates a new White Label Wallet for the indicated user. This method is capable of creating recoverable or unrecoverable wallets as defined by Arkane.

Parameters

Type
Name
Note
string
pincode
Must be a non-empty value
The pin that will encrypt and decrypt the wallet
string
identifier
Can be null or empty
An identifier that can be used to query or group wallets
Wallet.SecretType
chain
The blockchain on which to create the wallet
Action<ListWalletResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.Create(pincode,
2
identifier,
3
SecretType.MATIC,
4
(requestState) =>
5
{
6
if (!requestState.hasError)
7
{
8
Debug.Log("Created wallet " + requestState.result[0].address);
9
}
10
}));
Copied!

List

This methods should only be called from a server build.
1
public static IEnumerator List(Action<ListWalletResult> callback);
Copied!
Returns the list of wallets owned by the authenticated user if any.

Parameters

Type
Name
Note
Action<ListWalletResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.List((requestState) =>
2
{
3
if (!requestState.hasError)
4
{
5
Debug.Log("Found " + requestState.result.Count + " wallets");
6
}
7
}));
Copied!

Get

This method is useful on both client and server builds.
1
public static IEnumerator Get(string walletId,
2
Action<ListWalletResult> callback);
Copied!
Gets a specific or group of wallets from the user queried by ID.

Parameters

Type
Name
Note
string
walletId
Must be a non-empty value
The identifier to fetch a single or group of wallets
Action<ListWalletResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.Get(walletId,
2
(requestState) =>
3
{
4
if (!requestState.hasError)
5
{
6
Debug.Log("Found " + requestState.result.Count + " wallets");
7
}
8
}));
Copied!

Balance

This method is useful on both client and server builds
You will notice two "balance" members in the Wallet API
1
public static IEnumerator Balance(...);
Copied!
and
1
public static IEnumerator TokenBalance(...);
Copied!
TheBalanceoption will return a native balance e.g. the balance of tokens native to that chain as well as the gas balance, and raw balance values.
TheTokenBalanceoption will return the list of tokens supported by BGSDK found in this wallet e.g. indicating the token address, type, etc.
1
public static IEnumerator NativeBalance(string walletId,
2
Action<BalanceResult> callback);
Copied!
Gets the balance of non fungible tokens in the users wallet.

Parameters

Type
Name
Note
string
walletId
Must be a non-empty value
The identifier to fetch a single or group of wallets
Action<BalanceResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.NativeBalance(walletId,
2
(requestState) =>
3
{
4
if (!requestState.hasError && requestState.success)
5
{
6
Debug.Log("Found " + requestState.result.Count + " token types");
7
}
8
}));
Copied!

Token Balance

This method is useful on both client and server builds
You will notice two "balance" members in the Wallet API
1
public static IEnumerator Balance(...);
Copied!
and
1
public static IEnumerator TokenBalance(...);
Copied!
TheBalanceoption will return a native balance e.g. the balance of tokens native to that chain as well as the gas balance, and raw balance values.
TheTokenBalanceoption will return the list of tokens supported by BGSDK found in this wallet e.g. indicating the token address, type, etc.
1
public static IEnumerator TokenBalance(string walletId,
2
Action<TokenBalanceResult> callback);
Copied!
Gets the balance of tokens in the users wallet.

Parameters

Type
Name
Note
string
walletId
Must be a non-empty value
The identifier to fetch a single or group of wallets
Action<TokenBalanceResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.TokeBalance(walletId,
2
(requestState) =>
3
{
4
if (!requestState.hasError && requestState.success)
5
{
6
Debug.Log("Found " + requestState.result.Count + " token types");
7
}
8
}));
Copied!

Specific Token Balance

This method is useful on both client and server builds
1
public static IEnumerator SpecificTokenBalance(string walletId,
2
string tokenAddress,
3
Action<TokenBalanceResult> callback);
Copied!
Gets the balance of non fungible tokens in the users wallet.

Parameters

Type
Name
Note
string
walletId
Must be a non-empty value
The identifier to fetch a single or group of wallets
string
tokenAddress
Must be a non-empty value
The address of the token to fetch data for
Action<TokenBalanceResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(Server.Wallets.NFTs(walletId,
2
(requestState) =>
3
{
4
if (!requestState.hasError)
5
{
6
Debug.Log("Found " + requestState.result.Count + " token types");
7
}
8
}));
Copied!

NFTs

This method is useful on both client and server builds
1
public static IEnumerator NFTs(string walletId,
2
List<string> optionalContractAddresses,
3
Action<NFTBalanceResult> callback);
Copied!
Gets the balance of non fungible tokens in the users wallet.
https://docs.arkane.network/api/api-products/wallet-api/retrieve-token-balances
docs.arkane.network

Parameters

Type
Name
Note
string
walletAddress
Must be a non-empty value
The identifier to fetch a single or group of wallets
List<string>
opttionalContractAddresses
When set, the result will only contain tokens of these NFT contract addresses.
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
For the Server API
1
StartCoroutine(Server.Wallets.NFTs(walletAddress,
2
null,
3
(requestState) =>
4
{
5
if (!requestState.hasError && requestState.success)
6
{
7
Debug.Log("Found " + requestState.result.Count + " token types");
8
}
9
}));
Copied!
For the Client API
1
StartCoroutine(Client.Wallets.NFTs(walletAddress,
2
null,
3
(requestState) =>
4
{
5
if (!requestState.hasError && requestState.success)
6
{
7
Debug.Log("Found " + requestState.result.Count + " token types");
8
}
9
}));
Copied!

Update Pincode

This methods should only be called from a trusted Web Server.
1
public static IEnumerator UpdatePincode(string walletId,
2
string currentPincode,
3
string newPincode,
4
Action<ListWalletResult> callback);
Copied!
Gets a specific or group of wallets from the user queried by ID.
https://docs.arkane.network/api/api-products/wallet-api/update-pin
docs.arkane.network

Parameters

Type
Name
Note
string
walletId
Must be a non-empty value
The identifier to fetch a single or group of wallets
string
currentPincode
Must be a non-empty value
The current pincode for the wallet
string
newPincode
Must be a non-empty value
The new pincode to be applied to the wallet
Action<ListWalletResult>
callback
A method invoked on completion of the process and containing the results of the execution.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(API.Server.Wallets.UpdatePincode(walletId,
2
currentPincode,
3
newPincode,
4
(requestState) =>
5
{
6
if (!requestState.hasError)
7
{
8
Debug.Log("Updated pin on wallet " + requestState.result[0].address);
9
}
10
}));
Copied!

Last modified 1mo ago