WalletScriptingInterface

Description

Supported Script Types:

  • Interface Scripts
  • Client Entity Scripts
  • Avatar Scripts
The WalletScriptingInterface API provides functions related to the user's wallet and verification of certified avatar entities.

Properties

Name Type Summary
walletStatus WalletScriptingInterface.WalletStatus

The status of the user's wallet. Read-only.

limitedCommerce boolean

true if Interface is running in limited commerce mode. In limited commerce mode, certain Interface functionalities are disabled, e.g., users can't buy items that are not free from the Marketplace. The Oculus Store and Steam versions of Interface run in limited commerce mode. Read-only.

Methods

Name Return Value Summary
getWalletStatus WalletScriptingInterface.WalletStatus

Gets the current status of the user's wallet.

proveAvatarEntityOwnershipVerification None

Check that a certified avatar entity is owned by the avatar whose entity it is. The result of the check is provided via the ownershipVerificationSuccess and ownershipVerificationFailed signals.

Warning: Neither of these signals are triggered if the entity is not an avatar entity or is not certified.

refreshWalletStatus None

Checks and updates the user's wallet status.

Signals

Name Summary
limitedCommerceChanged

Triggered when the user's limited commerce status changes.

ownershipVerificationFailed

Triggered when a certified avatar entity's ownership check requested via proveAvatarEntityOwnershipVerification or ContextOverlay.requestOwnershipVerification fails.

ownershipVerificationSuccess

Triggered when a certified avatar entity's ownership check requested via proveAvatarEntityOwnershipVerification or ContextOverlay.requestOwnershipVerification succeeds.

walletNotSetup

Triggered when the user rezzes a certified entity but the user's wallet is not ready. So the certified location of the entity cannot be updated in the metaverse.

walletStatusChanged

Triggered when the user's wallet status changes.

Type Definitions

WalletStatus
Type: number

A WalletStatus may have one of the following values:

ValueMeaningDescription
0Not logged inThe user is not logged in.
1Not set upThe user's wallet has not been set up.
2Pre-existingThere is a wallet present on the server but not one locally.
3ConflictingThere is a wallet present on the server plus one present locally, and they don't match.
4Not authenticatedThere is a wallet present locally but the user hasn't logged into it.
5ReadyThe wallet is ready for use.

Wallets used to be stored locally but now they're only stored on the server. A wallet is present in both places if your computer previously stored its information locally.

Method Details

(static) getWalletStatus( ) → {WalletScriptingInterface.WalletStatus}
Returns: WalletScriptingInterface.WalletStatus

Gets the current status of the user's wallet.

Example

Use two methods to report your wallet's status.

print("Wallet status: " + WalletScriptingInterface.walletStatus);  // Same value as next line.
print("Wallet status: " + WalletScriptingInterface.getWalletStatus());
(static) proveAvatarEntityOwnershipVerification( entityID )

Check that a certified avatar entity is owned by the avatar whose entity it is. The result of the check is provided via the ownershipVerificationSuccess and ownershipVerificationFailed signals.

Warning: Neither of these signals are triggered if the entity is not an avatar entity or is not certified.

Parameters

Name Type Description
entityID Uuid

The avatar entity's ID.

Example

Check the ownership of all nearby certified avatar entities.

// Set up response handling.
function ownershipSuccess(entityID) {
    print("Ownership test succeeded for: " + entityID);
}
function ownershipFailed(entityID) {
    print("Ownership test failed for: " + entityID);
}
WalletScriptingInterface.ownershipVerificationSuccess.connect(ownershipSuccess);
WalletScriptingInterface.ownershipVerificationFailed.connect(ownershipFailed);

// Check ownership of all nearby certified avatar entities.
var entityIDs = Entities.findEntities(MyAvatar.position, 10);
var i, length;
for (i = 0, length = entityIDs.length; i < length; i++) {
    var properties = Entities.getEntityProperties(entityIDs[i], ["entityHostType", "certificateID"]);
    if (properties.entityHostType === "avatar" && properties.certificateID !== "") {
        print("Prove ownership of: " + entityIDs[i]);
        WalletScriptingInterface.proveAvatarEntityOwnershipVerification(entityIDs[i]);
    }
}

// Tidy up.
Script.scriptEnding.connect(function () {
    WalletScriptingInterface.ownershipVerificationFailed.disconnect(ownershipFailed);
    WalletScriptingInterface.ownershipVerificationSuccess.disconnect(ownershipSuccess);
});
(static) refreshWalletStatus( )

Checks and updates the user's wallet status.

Signal Details

limitedCommerceChanged( )
Returns: Signal

Triggered when the user's limited commerce status changes.

ownershipVerificationFailed( entityID )
Returns: Signal

Triggered when a certified avatar entity's ownership check requested via proveAvatarEntityOwnershipVerification or ContextOverlay.requestOwnershipVerification fails.

Parameters

Name Type Description
entityID Uuid

The ID of the avatar entity checked.

ownershipVerificationSuccess( entityID )
Returns: Signal

Triggered when a certified avatar entity's ownership check requested via proveAvatarEntityOwnershipVerification or ContextOverlay.requestOwnershipVerification succeeds.

Parameters

Name Type Description
entityID Uuid

The ID of the avatar entity checked.

walletNotSetup( )
Returns: Signal

Triggered when the user rezzes a certified entity but the user's wallet is not ready. So the certified location of the entity cannot be updated in the metaverse.

walletStatusChanged( )
Returns: Signal

Triggered when the user's wallet status changes.

Example

Report when your wallet status changes, e.g., when you log in and out.

WalletScriptingInterface.walletStatusChanged.connect(function () {
    print("Wallet status changed to: " + WalletScriptingInterface.walletStatus");
});