TorqueOffersModule
@torque-labs/sdk / TorqueOffersModule
Class: TorqueOffersModule
Defined in: sdk/src/modules/offers.ts:40
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?): TorqueOffersModuleDefined in: sdk/src/modules/offers.ts:48
Parameters
Returns
TorqueOffersModule
Properties
_publicKey
undefined | string
_token
undefined | string
_transactions
actions
baseUrl
string
Accessors
publicKey
Set Signature
set publicKey(value): voidDefined in: sdk/src/modules/offers.ts:67
Set private public key for the offers module
Parameters
value
undefined | string
Returns
void
token
Set Signature
set token(value): voidDefined in: sdk/src/modules/offers.ts:59
Set private token for the offers module
Parameters
value
undefined | string
Returns
void
Methods
addDistributor()
addDistributor(offerid, distributor): Promise<DistributorResponse>Defined in: sdk/src/modules/offers.ts:223
Adds a reward distributor to an offer
Parameters
offerId
string
The offerId of the offer to add the distributor to
Returns
Promise<DistributorResponse>
The created distributor object
chooseAsymmetricRewardWinner()
chooseAsymmetricRewardWinner(distributorid): Promise<{
publicKey: string;
winner: string;
}>Defined in: sdk/src/modules/offers.ts:358
Choose asymmetric reward winner
Parameters
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()
closeDistributor(offerid, distributorid): Promise<{
signature: string;
}>Defined in: sdk/src/modules/offers.ts:326
Closes the distributor for the given offer and distributor IDs
Parameters
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()
createOffer(offer): Promise<OfferResponse>Defined in: sdk/src/modules/offers.ts:119
Create an offer
Parameters
Returns
Promise<OfferResponse>
The created offer object
createProject()
createProject(projectdata): Promise<ProjectResponse>Defined in: sdk/src/modules/offers.ts:394
Create a project
Parameters
Returns
Promise<ProjectResponse>
The created project object
deployDistributor()
deployDistributor(offerid, distributorid): Promise<{
signature: string;
}>Defined in: sdk/src/modules/offers.ts:286
Gets the Solana action for deploying a distributor
Parameters
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()
getAsymmetricRewardEntries(distributorid): Promise<Record<string, number>>Defined in: sdk/src/modules/offers.ts:343
Get the asymmetric reward entries for a distributor
Parameters
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()
getLeaderboard(projectid, offchainrewardid): Promise<LeaderboardResponse>Defined in: sdk/src/modules/offers.ts:373
Fetch a leaderboard for the specific off-chain reward
Parameters
projectId
string
-
offchainRewardId
string
The id of the off-chain reward to get the leaderboard for
Returns
Promise<LeaderboardResponse>
getOfferById()
getOfferById(id): Promise<OfferResponse>Defined in: sdk/src/modules/offers.ts:83
Fetch a single offer
Parameters
id
string
The offerId of the offer to get
Returns
Promise<OfferResponse>
a single offer
getOffers()
getOffers(
status,
userId?,
projectId?): Promise<OfferResponse[]>Defined in: sdk/src/modules/offers.ts:99
Fetch the offers with optional filters for status and userId
Parameters
userId?
string
(optional) The userId or public key of the offer creator
projectId?
string
-
Returns
Promise<OfferResponse[]>
a list of offers
getProject()
getProject(projectid, includeoffers?): Promise<ProjectResponse>Defined in: sdk/src/modules/offers.ts:419
Get a project
Parameters
projectId
string
The project ID
includeOffers?
boolean
(optional) Whether to include offers in the project response
Returns
Promise<ProjectResponse>
The project object
getProjects()
getProjects(includeoffers?): Promise<ProjectResponse[]>Defined in: sdk/src/modules/offers.ts:442
Get projects
Parameters
includeOffers?
boolean
(optional) Whether to include offers in the project response
Returns
Promise<ProjectResponse[]>
A list of project objects
getUserJourneys()
getUserJourneys(
offerId,
userPubkey?,
status?): Promise<OfferJourneyReturn[]>Defined in: sdk/src/modules/offers.ts:201
Get user journeys on the offer
Parameters
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
Returns
Promise<OfferJourneyReturn[]>
startOffer()
startOffer(offerid, referrer?): Promise<void>Defined in: sdk/src/modules/offers.ts:174
Accept/start an offer for a user
Parameters
offerId
string
The offerId of the offer to accept for the user
referrer?
string
-
Returns
Promise<void>
updateDistributor()
updateDistributor(
offerId,
distributorId,
distributor): Promise<DistributorResponse>Defined in: sdk/src/modules/offers.ts:253
Update a distributor
Parameters
offerId
string
The ID of the offer that contains the distributor
distributorId
string
The ID of the distributor to update
Returns
Promise<DistributorResponse>
The updated distributor object
updateOffer()
updateOffer(offerid, offer): Promise<OfferResponse>Defined in: sdk/src/modules/offers.ts:148
Update an offer
Parameters
offerId
string
The ID of the offer to update
Returns
Promise<OfferResponse>
The updated offer object
Last updated
