TRS

1.1

Get the abbreviation list of supported token

  • GET the list of token

Request URL

  • index.ts / getBoinNamesList

Parameters

Null

Return example

[
	'BTC','ETH','SOL','BNB',....
]
 

Return parameter description

string

Note

  • Returns a list of supported token abbreviations


1.2

Get the token price address

  • Get the price address by Token abbreviation

Requst URL

  • index.ts / getSelectBoinPubKeyByName

Parameters

Name
Required
Type
Explain

boinName

YES

string

Token abbreviation

Return example

 7VJsBtJzgTftYzEeooSDYyjKXvYRWJHdwvbwfBvTg9k

Return parameter description

Token address(string)

Note

  • The returned token address is string. It may need to be converted to PublicKey in future use. let publicKey = new PublicKey('7VJs....');


1.3

Get token abbreviation

  • Get token abbreviation from price address

Request URL

  • index.ts / getBoinNameByPublicKey

Parameters

Name
Required
Type
Explain

boinPublickey

Yes

string

Token price address

Return example

SOL

Return parameter explain

Token name

Note

  • Token price address is string, PublickKey and string conversion, PublicKey uses toString()


### 1.4 ##### Add product

  • Launch token-pair products

Request URL

  • index.ts / addProduct

Parameters

Name
Required
Type
Expalin

solanaProvider

YES

Object

solana wallet provider

connection

YES

Connection

solana connection

token_a_name

YES

string

a token name

token_b_name

YES

string

b token name

period

YES

number

Period (day)

raise_time

YES

number

Raise time( Accurate to seconds)

found_time

YES

number

Found time( Accurate to seconds)

price

YES

number

Unit price(u)

token_share

YES

number

Share

Return example

	55p9eb2Rfs2SbQYGbz7hcrKZXsZshHP6trHtvDvRECrouYKaQfZHw7K7wFA5V9sGb1H7mi9JLvq6QMezLF96eMYW
 

Return result description

Return transaction sequence number of TransactionSignature successfully.

Failure will have an exception that can be caught by try catch

### 1.5 ##### Buy products

  • User Buy Products

Request URL

  • index.ts / buyTrs

Parameters

Name
Required
Type
Expalin

solanaProvider

YES

Object

solana wallet provider

connection

YES

Connection

solana Connection

usdcPayPubKey

YES

PublicKey

usdc address

buyTokenName

YES

string

token name

buyShare

YES

number

share

productPubKey

YES

PublicKey

product address

Return example

	55p9eb2Rfs2SbQYGbz7hcrKZXsZshHP6trHtvDvRECrouYKaQfZHw7K7wFA5V9sGb1H7mi9JLvq6QMezLF96eMYW
 

Return result description

Return transaction sequence number of TransactionSignature successfully.

Failure will have an exception that can be caught by try catch.

Note

  • usdcPayPubKey的owner should be wallet address, otherwise the signature will fail.


### 1.6 ##### Apply for settlement

  • After product clearing, users can apply for settlement

Request URL

  • index.ts / settleApply

Parameters

Name
Required
Type
Expalin

solanaProvider

yes

Object

solana wallet provider

connection

yes

Connection

solana connection

productPubKey

yes

PublicKey

product address of purchase

orderPubKey

yes

PublicKey

order address

Return example

	55p9eb2Rfs2SbQYGbz7hcrKZXsZshHP6trHtvDvRECrouYKaQfZHw7K7wFA5V9sGb1H7mi9JLvq6QMezLF96eMYW
 

Return result description

Return transaction sequence number of TransactionSignature successfully.

Failure will have an exception that can be caught by try catch.

Note

  • productPubKey Product address must be the product purchased in orderPubKey order


### 1.7 ##### Get the product list

  • You can filter products by status. If the status is not transmitted, all products are queried by defaulte.

  • status 0:Raising and available for purchase 1:Established 2:Expired 3:Settled 4:Closed

Request URL

  • index.ts / getProductList

Parameters

Name
Required
Type
Expalin

connection

yes

Connection

solana connection

status

No

number

Product Status

Return example

[
	product1,product2,product3,....
]
 

Return parameter description

Product array of object 

Note

  • Product Object see the Product field table in appendix.


### 1.8 ##### Get order list - Orders can be screened according to product address and user address - If only all orders of users are checked, pass the product address as an empty string ''. - If only checking all orders of products, pass user address as empty string ''

Request URL

  • index.ts / getOrderList

Parameters

Name
Required
Type
Expalin

connection

yes

Connection

solana connection

productPublickey

yes

string

products address pubkey into base58

userPublickey

yes

string

user address pubkey into base58

Return example

[
	order1,order2,order3,....
]
 

Return example description

Order object array

Note

-Order object see the Order field table in appendix


### 1.9 ##### Get account details

  • Returns account details based on the account address.

Request URL

  • index.ts / getAccountByKey

Parameters

Name
Requeired
Type
Expalin

connection

yes

Connection

solana connection

accountKey

yes

PublicKey

account address

type

number

Type: 1product 2order 3basic account information

Return example

[
	obj1,obj2,obj3,....
]
 

Return parameter description

Object array

Note

-Type1 Returns an array of product objects; 2 Returns an array of order objects. 3 Returns an array of basic account information

  • Type 1 returns array of Product objects. 2 Returns array of Order objects. 3 Returns array of BaseData


### Appendix ##### Account structure information

Product

Name
Type
Explain

owner

string

owner address of product

token_a

string

tokan_a address

token_b

string

tokan_b address

period

number

product expiry

raise_time

number

raise time

found_time

number

establish time

due_time

number

expiry time

price

number

unit price (u )

fee

number

product total service fee (u/10^6)

token_a_share

number

share of a

token_b_share

number

share of b

buy_token_a_share

number

a raised shares

buy_token_b_share

number

b raised shares

clear_token_a_share

number

a settlement shares

clear_token_b_share

number

b settlement shares

found_token_a_price

number

a found unit price u

found_token_b_price

number

b found unit price u

due_token_a_price

number

a market price of expiry u

due_token_b_price

number

a market price of expiry u

exercise_a_price

number

a exercise price u

exercise_b_price

number

b exercise price u

status

number

status,0 initial state,waiting for investment or investing, 1 founded,2expired 3 settled 4 closed

product_pubkey

string

product address

Order

Name
Type
Explain

pro_pubkey

string

product address of purches

owner

string

owner address of order

pay_token_pubkey

string

users pay usdc address

buy_token

string

token address of product purchased

share

number

buy share

price

number

buy unit price u

token_price

number

payment amount u

token_fee

number

service fee of purchase u/10^6

buy_time

number

buy time

status

number

status 1 did not apply for settlement 2 has applied for settlement 3 settled

order_pubkey

string

order address

BaseData

Name
Type
Explain

owner

string

program owner address

raise_fund_pubkey

string

fund pubkey address

fee_account_pubkey

string

address of receive account of service fee

rate

number

fee rate rate/10000

basedata_pubkey

string

basic account address


Last updated