Class: TorqueAdminClient
@torque-labs/torque-ts-sdk • Docs
@torque-labs/torque-ts-sdk / TorqueAdminClient
Class: TorqueAdminClient
The TorqueAdminClient class is used to manage admin actions in the Torque API.
Example
Constructors
new TorqueAdminClient()
Create a new instance of the TorqueAdminClient class with the provided API key.
Parameters
options
The options for the TorqueAdminClient.
Returns
Defined in
Properties
client
connection
Connection
userClient
tokenList
Methods
createCampaign()
Create a new campaign with the provided data.
Parameters
data
object
The data for the campaign to create.
data.asymmetricRewards
?
{ amount
: string
; participants
: null
| RaffleParticipants
; payoutTx
: null
| string
; tokenAddress
: string
; userPubKey
: null
| string
; }[]
-
data.audience
?
null
| string
-
data.blinkOnly
?
null
| boolean
-
data.campaignContent
?
null
| string
-
data.campaignDescription
?
null
| string
-
data.campaignImage
?
null
| string
-
data.campaignName
string
-
data.campaignType
CampaignType
-
data.conversionAudience
?
object
-
data.conversionAudience.campaignIds
string
[]
-
data.conversionAudience.operation
ConversionAudienceOperation
-
data.conversionCount
?
null
| number
-
data.endTime
number
-
data.eventConfig
( | { requirement
: { antiSybilFee
: number
; requireSignature
: boolean
; targetUrl
: string
; }; type
: CLICK
; } | { requirement
: { description
: null
| string
; eventName
: string
; fields
: ({ description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "string"
; validation
: { match
: ... | ... | ...; required
: ... | ... | ... | ...; }; } | { description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "number"
; validation
: { max
: ... | ... | ...; min
: ... | ... | ...; }; } | { description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "boolean"
; validation
: { match
: ... | ... | ... | ...; }; })[]; formEnabled
: boolean
; targetUrl
: null
| string
; }; type
: CUSTOM_EVENT
; } | { requirement
: { marketIndex
: number
; shares
: number
; }; type
: DRIFT_BET
; } | { requirement
: { minAmount
: number
; tokenAddress
: string
; }; type
: DRIFT_DEPOSIT
; } | { requirement
: { antiSybilFee
: number
; fields
: { label
: string
; name
: string
; options
: { label
: string
; value
: string
; }[]; required
: null
| boolean
; type
: FormFieldType
; }[]; }; type
: FORM_SUBMISSION
; } | { requirement
: { amount
: number
; tokenAddress
: string
; }; type
: KAMINO_LEND
; } | { requirement
: { amount
: number
; tokenAddress
: string
; }; type
: MARGINFI_LEND
; } | { requirement
: { fields
: ({ description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "string"
; validation
: { match
: ... | ... | ...; required
: ... | ... | ... | ...; }; } | { description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "number"
; validation
: { max
: ... | ... | ...; min
: ... | ... | ...; }; } | { description
: null
| string
; image
: null
| string
; label
: null
| string
; name
: string
; } & { type
: "boolean"
; validation
: { match
: ... | ... | ... | ...; }; })[]; }; type
: MEMO
; } | { requirement
: { minAmount
: number
; mint
: string
; }; type
: NFT_BUY_BID
; } | { requirement
: { collectionAddress
: string
; tradeType
: NftCollectionTradeType
; }; type
: NFT_COLLECTION_TRADE
; } | { requirement
: { customProgramId
: string
; daoPubKey
: string
; proposalPubKey
: string
; }; type
: REALMS_VOTE
; } | { requirement
: { amount
: number
; epochs
: number
; validator
: string
; }; type
: STAKE_SOL
; } | { requirement
: { inAmount
: null
| number
; inToken
: null
| string
; outAmount
: null
| number
; outToken
: null
| string
; usdcValue
: null
| number
; }; timeConfig
: { duration
: number
; requirement
: { amount
: number
; token
: string
; tokenStandard
: string
; }; type
: TOKEN_HOLDING
; }; type
: SWAP
; } | { requirement
: { collectionIds
: string
[]; }; type
: TENSOR_BID
; } | { requirement
: { collectionIds
: string
[]; }; type
: TENSOR_BUY
; })[]
-
data.landingPage
string
-
data.lootBoxRewards
{ enabled
: true
; rewards
: { amount
: number
; users
: number
; }[]; tokenAddress
: string
; } | { enabled
: false
; }
-
data.offerBgImage
?
null
| string
-
data.offerTheme
OfferTheme
-
data.publisherPayoutPerConversion
number
-
data.publisherRewardType
RewardType
-
data.publisherTokenAddress
?
string
-
data.startTime
number
-
data.userPayoutPerConversion
?
number
-
data.userRewardType
?
RewardType
-
data.userTokenAddress
?
string
-
Returns
Promise
<SignatureField
>
A promise that resolves with the signature of the transaction.
Defined in
deleteAudience()
Delete an existing audience.
Parameters
id
string
The ID of the audience to delete.
Returns
Promise
<{ audienceId
: string
; }>
A promise that resolves to the deleted audience.
audienceId
string
Throws
If the client is not initialized or if there was an error deleting the audience.
Defined in
endCampaign()
End a campaign using the provided campaign ID.
Parameters
data
object
The ID of the campaign to end.
data.campaignId
string
-
Returns
Promise
<SignatureField
>
A promise that resolves to the signature of the transaction.
Throws
Throws an error if the client is not initialized or if there is an error ending the campaign.
Defined in
getActiveCampaigns()
Get a list of all currently active campaigns.
Parameters
params
?
object
params.advertiserPubKey
?
string
params.limit
?
number
params.page
?
number
params.status
?
string
Returns
Promise
<{ campaigns
: ApiCampaign
[]; }>
A promise that resolves to an array of ApiCampaign objects.
campaigns
Throws
If the client is not initialized or there was an error getting the list of campaigns.
Defined in
getAudience()
Get an audience by ID.
Parameters
id
string
The ID of the audience to fetch.
Returns
Promise
<ApiAudience
>
A promise that resolves to an array of Audiences.
Throws
If the client is not initialized or there was an error getting the audience.
Defined in
getAudiences()
Get a list of the user's saved audiences.
Returns
Promise
<{ audiences
: ApiAudience
[]; }>
A promise that resolves to an array of Audiences.
audiences
Throws
If the client is not initialized or there was an error getting the audiences.
Defined in
getCampaign()
Get the details of a specific campaign.
Parameters
campaignId
string
The ID of the campaign to retrieve.
Returns
Promise
<ApiCampaign
>
A Promise that resolves to the campaign data.
Throws
Throws an error if a fetching a campaign failed.
Defined in
getCampaignAnalytics()
Get the analytics data for a specific campaign.
Parameters
campaignId
string
The ID of the campaign to retrieve the analytics for.
Returns
Promise
<CampaignAnalytics
>
A Promise that resolves to the analytics data for the campaign.
Throws
Throws an error if a fetching a campaign failed.
Defined in
getCampaigns()
Parameters
params
?
object
params.advertiserPubKey
?
string
params.limit
?
number
params.page
?
number
params.status
?
string
includeHistoric
?
boolean
Returns
Promise
<{ campaigns
: ApiCampaign
[]; }>
campaigns
Defined in
getHistoricCampaigns()
Get a list of all historic campaigns.
Parameters
params
?
object
params.advertiserPubKey
?
string
params.limit
?
number
params.page
?
number
params.status
?
string
Returns
Promise
<{ campaigns
: ApiCampaign
[]; }>
A promise that resolves to an array of ApiCampaign objects.
campaigns
Throws
If the client is not initialized or there was an error getting the list of campaigns.
Defined in
getLeaderboard()
Get the leaderboard for a specific campaign.
Parameters
campaignId
string
The ID of the campaign to get the leaderboard for.
Returns
Promise
<ApiCampaignLeaderboard
>
A Promise that resolves to the leaderboard data for the campaign.
Throws
Throws an error if the client is not initialized or if there is an error getting the leaderboard.
Defined in
initPublisher()
Initialize a publisher account for the current user.
Returns
Promise
<string
>
A promise that resolves to the signature of the transaction.
Throws
Throws an error if there was an error creating the publisher.
Defined in
logout()
Returns
Promise
<void
>
Defined in
payoutPublisher()
Process a publisher payout for the current user, if eligible.
Parameters
data
object
data.amount
number
data.token
string
Returns
Promise
<string
>
A promise that resolves to the signature of the transaction.
Throws
Throws an error if there was an error paying out the publisher.
Defined in
raffleRewards()
Get the raffle rewards for a specific campaign.
Parameters
campaignId
string
The ID of the campaign to get the raffle rewards for.
Returns
Promise
<ApiRaffleRewards
>
Throws
Throws an error if the client is not initialized or if there is an error getting the raffle rewards.
Defined in
saveAudience()
Save an audience to the user's account.
Parameters
metadata
The metadata of the audience.
config
?
The configuration of the audience to save.
Returns
Promise
<{ audienceId
: string
; }>
A promise that resolves to the id of the saved audience.
audienceId
string
Throws
If the client is not initialized or there was an error saving the audience.
Defined in
updateAudience()
Update an existing audience with the provided configuration.
Parameters
id
string
The ID of the audience to update.
metadata
?
The metadata of the audience.
config
?
The configuration of the audience to update.
Returns
Promise
<{ audienceId
: string
; }>
A promise that resolves to the updated audience.
audienceId
string
Throws
If the client is not initialized or if there was an error updating the audience.
Defined in
getSafeTokenList()
Retrieves the list of safe tokens from the Jupiter ag.
Parameters
filter
?
string
An optional filter to filter the tokens by text.
apiUrl
?
string
-
Returns
Promise
<SafeToken
[]>
A promise that resolves to an array of SafeToken objects.
Throws
If the client is not initialized or there was an error fetching the safe token list.
Defined in
Last updated