Skip to content

@collectivtech/alana-sdk-js


@collectivtech/alana-sdk-js / resources/server/business / CoinContractClass

Class: CoinContractClass ​

Defined in: src/resources/server/business.ts:372

Base class for an API resource object.

This is an abstract class. You shouldn't create objects from it directly, but instead use one of the defined subclasses, which handle the needed conversion to and from raw JSON.

All resource classes hold a reference to a context object, and this may be a shared object to allow for state tracking.

Extends ​

Constructors ​

Constructor ​

new CoinContractClass(apiResponse, context): CoinContractClass

Defined in: src/resources/server/business.ts:423

Create a new resource for a class of Coin Contracts.

Parameters ​

apiResponse ​

any

context ​

ApiContext

The API context used for this resource.

Returns ​

CoinContractClass

Overrides ​

ApiResource.constructor

Properties ​

_context ​

protected _context: ApiContext

Defined in: src/resource.ts:148

The API context for this resource.

Inherited from ​

ApiResource._context


coin ​

coin: ServerCoin

Defined in: src/resources/server/business.ts:392

The Coin this contract class represents.


description? ​

optional description?: string

Defined in: src/resources/server/business.ts:387

A freeform description of Coin Contracts of this class.


id ​

id: number

Defined in: src/resources/server/business.ts:376

The internal ID for this Coin Contract class.


interestRate ​

interestRate: number

Defined in: src/resources/server/business.ts:404

The annual interest rate of the Coin Contract class. Coin Contracts will earn an appropriate amount of Alana Coins based on this rate.


lockPeriod? ​

optional lockPeriod?: number

Defined in: src/resources/server/business.ts:398

The minimum length of time, in months, that a user must hold this Coin Contract before being allowed to cash it in for Coins.


maximum? ​

optional maximum?: number

Defined in: src/resources/server/business.ts:416

The maximum number of Coins that may be purchased in a Coin Contract of this class.


minimum? ​

optional minimum?: number

Defined in: src/resources/server/business.ts:410

The minimum number of Coins that must be purchased in a Coin Contract of this class.


name ​

name: string

Defined in: src/resources/server/business.ts:382

The name of the class, which is also the default name for all Coin Contracts created from it.

Methods ​

checkout() ​

checkout(data, successUrl, cancelUrl): Promise<CoinContractCheckout>

Defined in: src/resources/server/business.ts:503

Create a checkout session for the active user purchasing a Coin Contract based on this Coin Contract class. The result of calling this method is an object with a url string property. The caller MUST redirect the user to this URL to complete the checkout process.

Note that the checkout URL is hosted by Stripe.

Parameters ​

data ​

CoinContractCheckoutOptions

The data needed for checkout, including quantity and an optional business account (if a business, rather than a user, is purchasing the contract)

successUrl ​

string

The URL to redirect to after successfully completing checkout

cancelUrl ​

string

The URL to redirect to if the checkout is canceled

Returns ​

Promise<CoinContractCheckout>

A URL and session ID


delete() ​

delete(): Promise<boolean>

Defined in: src/resources/server/business.ts:475

Delete this Coin Contract class from the ALANA Platform. This will not affect any Coin Contracts created from it, but will prevent new contracts from being created using it as a template.

Returns ​

Promise<boolean>

true if the operation succeeded


update() ​

update(): Promise<CoinContractClass>

Defined in: src/resources/server/business.ts:443

Update this Coin Contract class using the current values in this resource.

Note that the Coin a contract class is created for cannot be changed.

Returns ​

Promise<CoinContractClass>

An updated Coin Contract class resource

ALANA™, ALANA Platform™, ALANA Guide™, and ALANA Partner™ are trademarks of Collectiv Technologies Inc.