2.5.0 • Published 6 days ago

@stardust-gg/stardust-custodial-sdk v2.5.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 days ago

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.4.0 05/03/2024

Features

  • Aptos support

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:

  • support@stardust.gg
2.5.0

6 days ago

2.4.1

15 days ago

2.4.0

19 days ago

2.3.1

1 month ago

2.3.0

1 month ago

2.2.0

3 months ago

2.1.0

5 months ago

2.0.2

5 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago