@stardust-gg/stardust-custodial-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.6.1 • Public • Published

Stardust Custodial SDK

License standard-readme compliant

Table of Contents

Introduction

Stardust-Custodial-SDK is a server side TypeScript-based SDK specifically crafted to enable seamless integration with Stardust custodial Wallets as a Service (WaaS). This SDK is designed for developers seeking to incorporate advanced wallet management features into their TypeScript applications with minimal effort - whether they're building a new project or enhancing an existing one.

Changelog

Latest Version: 2.6.1 [05/28/2024]

Features

  • Added event emission module to profiles
  • Immediate support for two new profile events: addIp addPurchaseable
  • Added three new static social identifiers: twitch, epic, steam

Releases can be found here

For a detailed version history, see the full changelog.

Getting started

Prerequisites

This SDK is intended for use with TypeScript. Familiarity with TypeScript and modern JavaScript development practices using NodeJs is recommended.

You will need to create an application and grab your api key @ waas.stardust.gg

Install

npm i @stardust-gg/stardust-custodial-sdk

Usage

import { StardustCustodialSDK } from '@stardust-gg/stardust-custodial-sdk';

const myApiKey = '<your-api-key-here>';

// connect to the api
const sdk = new StardustCustodialSDK(myApiKey);\
Creating a profile
const profile = await sdk.createProfile();
const profileIdentifier = profile.id;

Note: Store these profile identifiers, they are unique to your players/users and are how you will manage them.

Generate Client JWTs for client side operations
const duration = 600; // 10 mins
const clientJWT = await sdk.generateProfileJWT(profileId, duration);

Note: These JWTs will allow operation over the profile, and therefore have standardized ttls that are configurable on generation up to 24 hours

Getting a Wallet
const profileId = <your-saved-profile-id>
const profile = await sdk.getProfile(walletId);
const { wallet } = profile

Common Usage

Examples

All common examples in their full form can be found under examples

If you are cloning the repo and wish to run the examples directly use yarn run-example <path-to-example>

Like so: yarn run-example examples/sui/sui-sign-personal-message

Ethers V5

const provider: JsonRpcProvider = new ethers.providers.JsonRpcProvider(<your-provider-url>)
const ethersV5Signer = await wallet.ethers.v5.getSigner().connect(provider)

Reference Ethers v5 documentation for usage of this signer.

Ethers V6

const provider: JsonRpcProvider = new ethers.JsonRpcProvider(<your-provider-url>)
const ethersV6Signer = await wallet.ethers.v6.getSigner(provider)

Reference Ethers v6 documentation for usage of this signer.

EVM

const userEVMAddress = await wallet.evm.getAddress();
const userEVMPublicKey = await wallet.evm.getPublicKey();
const rawSignedDigest = await wallet.evm.signRaw('0x010203');
const eip191signedMessage = await wallet.evm.signMessage('Hello World!');

IMX

const starkSigner = await wallet.imx.getStarkSigner();

Reference IMX-Core-SDK documentation for usage of StarkSigner

SUI

const suiStardustSigner = await wallet.sui;
const builtTx: Uint8Array = <your-tx-object>;
const signedTransactionBlock = await wallet1.sui.signTransactionBlock(builtTx);

Reference sui typescript sdk documentation for usage of Sui.

Additionally, you can reference examples of use cases for Sui.

Solana

const userSOLAddress = await wallet.sol.getAddress();
const userSOLPublicKey = await wallet.sol.getPublicKey();
const rawSignedDigest = await wallet.sol.signRaw('0x010203');
const signedMessage = await wallet.sol.signMessage('Hello World!');

Aptos

const userAptosAddress = await wallet.aptos.getAddress();
const userAptosPublicKey = await wallet.aptos.getPublicKey();
const rawSignedDigest = await wallet.aptos.signRaw('0x010203');
const signedMessage = await wallet.aptos.signMessage('Hello World!');

Please reference the example and aptos ts sdk in order to send transactions.

Contributing

Feel free to open pull requests to propose changes or additions.

License

Apache-2.0

This project uses portions of ethers.js, developed by Richard Moore (@ricmoo), under the MIT License.

Contact and Support

For support or feedback, please reach out to:

Readme

Keywords

Package Sidebar

Install

npm i @stardust-gg/stardust-custodial-sdk

Weekly Downloads

186

Version

2.6.1

License

Apache-2.0

Unpacked Size

104 kB

Total Files

84

Last publish

Collaborators

  • brandonnullwithstardust
  • j_stardust
  • aaron.hubbard-stardust
  • andrew_gutierrez_stardust
  • martinbutt
  • dhammarstedt-stardust