TorqueOffersModule

@torque-labs/sdk


@torque-labs/sdk / TorqueOffersModule

Class: TorqueOffersModule

Defined in: sdk/src/modules/offers.ts:40arrow-up-right

The TorqueOffersModule class is used to interact with the offers endpoints of the Torque API.

Param

The URL of the Torque API server

Param

The auth token for the API

Constructors

new TorqueOffersModule()

new TorqueOffersModule(
   url, 
   transactions, 
   token?): TorqueOffersModule

Defined in: sdk/src/modules/offers.ts:48arrow-up-right

Parameters

Parameter
Type

url

string

token?

string

Returns

TorqueOffersModule

Properties

Property
Type

_publicKey

undefined | string

_token

undefined | string

baseUrl

string

Accessors

publicKey

Set Signature

Defined in: sdk/src/modules/offers.ts:67arrow-up-right

Set private public key for the offers module

Parameters

Parameter
Type

value

undefined | string

Returns

void


token

Set Signature

Defined in: sdk/src/modules/offers.ts:59arrow-up-right

Set private token for the offers module

Parameters

Parameter
Type

value

undefined | string

Returns

void

Methods

addDistributor()

Defined in: sdk/src/modules/offers.ts:223arrow-up-right

Adds a reward distributor to an offer

Parameters

Parameter
Type
Description

offerId

string

The offerId of the offer to add the distributor to

distributor

The distributor input parameters

Returns

Promise<DistributorResponse>

The created distributor object


chooseAsymmetricRewardWinner()

Defined in: sdk/src/modules/offers.ts:358arrow-up-right

Choose asymmetric reward winner

Parameters

Parameter
Type
Description

distributorId

string

The distributorId of the distributor to choose the winner for

Returns

Promise<{publicKey: string;winner: string; }>

The winner of the asymmetric reward


closeDistributor()

Defined in: sdk/src/modules/offers.ts:326arrow-up-right

Closes the distributor for the given offer and distributor IDs

Parameters

Parameter
Type
Description

offerId

string

The ID of the offer to close the distributor for

distributorId

string

The ID of the distributor to close

Returns

Promise<{signature: string; }>

The signature of the transaction


createOffer()

Defined in: sdk/src/modules/offers.ts:119arrow-up-right

Create an offer

Parameters

Parameter
Type
Description

offer

The offer input

Returns

Promise<OfferResponse>

The created offer object


createProject()

Defined in: sdk/src/modules/offers.ts:394arrow-up-right

Create a project

Parameters

Parameter
Type
Description

projectData

The project data

Returns

Promise<ProjectResponse>

The created project object


deployDistributor()

Defined in: sdk/src/modules/offers.ts:286arrow-up-right

Gets the Solana action for deploying a distributor

Parameters

Parameter
Type
Description

offerId

string

The offerId of the offer to add the distributor to

distributorId

string

The distributorId of the distributor to deploy

Returns

Promise<{signature: string; }>

The serialized transaction for the deploy distributor action


getAsymmetricRewardEntries()

Defined in: sdk/src/modules/offers.ts:343arrow-up-right

Get the asymmetric reward entries for a distributor

Parameters

Parameter
Type
Description

distributorId

string

The distributorId of the distributor to get the entries for

Returns

Promise<Record<string, number>>

The asymmetric reward entries for the distributor


getLeaderboard()

Defined in: sdk/src/modules/offers.ts:373arrow-up-right

Fetch a leaderboard for the specific off-chain reward

Parameters

Parameter
Type
Description

projectId

string

-

offchainRewardId

string

The id of the off-chain reward to get the leaderboard for

Returns

Promise<LeaderboardResponse>


getOfferById()

Defined in: sdk/src/modules/offers.ts:83arrow-up-right

Fetch a single offer

Parameters

Parameter
Type
Description

id

string

The offerId of the offer to get

Returns

Promise<OfferResponse>

a single offer


getOffers()

Defined in: sdk/src/modules/offers.ts:99arrow-up-right

Fetch the offers with optional filters for status and userId

Parameters

Parameter
Type
Description

status

(optional) The status of the offer. Defaults to ACTIVE.

userId?

string

(optional) The userId or public key of the offer creator

projectId?

string

-

Returns

Promise<OfferResponse[]>

a list of offers


getProject()

Defined in: sdk/src/modules/offers.ts:419arrow-up-right

Get a project

Parameters

Parameter
Type
Description

projectId

string

The project ID

includeOffers?

boolean

(optional) Whether to include offers in the project response

Returns

Promise<ProjectResponse>

The project object


getProjects()

Defined in: sdk/src/modules/offers.ts:442arrow-up-right

Get projects

Parameters

Parameter
Type
Description

includeOffers?

boolean

(optional) Whether to include offers in the project response

Returns

Promise<ProjectResponse[]>

A list of project objects


getUserJourneys()

Defined in: sdk/src/modules/offers.ts:201arrow-up-right

Get user journeys on the offer

Parameters

Parameter
Type
Description

offerId

string

The offerId of the offer to get the user journeys for

userPubkey?

string

The public key of the user to get the user journeys for

status?

The status of the user journeys to get

Returns

Promise<OfferJourneyReturn[]>


startOffer()

Defined in: sdk/src/modules/offers.ts:174arrow-up-right

Accept/start an offer for a user

Parameters

Parameter
Type
Description

offerId

string

The offerId of the offer to accept for the user

referrer?

string

-

Returns

Promise<void>


updateDistributor()

Defined in: sdk/src/modules/offers.ts:253arrow-up-right

Update a distributor

Parameters

Parameter
Type
Description

offerId

string

The ID of the offer that contains the distributor

distributorId

string

The ID of the distributor to update

distributor

The updated distributor data

Returns

Promise<DistributorResponse>

The updated distributor object


updateOffer()

Defined in: sdk/src/modules/offers.ts:148arrow-up-right

Update an offer

Parameters

Parameter
Type
Description

offerId

string

The ID of the offer to update

offer

The updated offer data

Returns

Promise<OfferResponse>

The updated offer object

Last updated