-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding examples #4
Conversation
import { | ||
ORDER_STATUS, | ||
ORDER_SIDE, | ||
// MinifiedCandleStick, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MinifiedCandleStick, |
true, | ||
Networks.TESTNET_SUI, | ||
dummyAccountKey, | ||
"ED25519" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ED25519" | |
"ED25519" // valid values ED25519 and Secp256k1 |
@@ -0,0 +1,50 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole example is redundant, already covered in post_cancel_order.ts so can be deleted
examples/8.post_order.ts
Outdated
import { | ||
ORDER_STATUS, | ||
ORDER_SIDE, | ||
// MinifiedCandleStick, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MinifiedCandleStick, |
examples/7.create_signed_order.ts
Outdated
console.log("Signed Order Created:", signedOrder); | ||
} | ||
|
||
main().then().catch(console.warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main().then().catch(console.warn); | |
main().then().catch(console.error); |
examples/2.usdc_balance.ts
Outdated
@@ -0,0 +1,23 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think we need to put any example for showing user how to query your usdc balance from usdc contract
examples/4.mint_usdc.ts
Outdated
@@ -0,0 +1,29 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users wont be able to mint usdc on our contracts anyways, so example should be removed
examples/17.initialise_readonly.ts
Outdated
@@ -0,0 +1,25 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this example with 1.initialisation example
in that show both ways of creating a client i.e. write mode and read mode
examples/18.get_user_orders.ts
Outdated
@@ -0,0 +1,37 @@ | |||
/** | |||
* Gets user open position on provided(all) markets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Gets user open position on provided(all) markets | |
* Query user orders |
examples/18.get_user_orders.ts
Outdated
import { | ||
ORDER_STATUS, | ||
ORDER_SIDE, | ||
// MinifiedCandleStick, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MinifiedCandleStick, |
examples/18.get_user_orders.ts
Outdated
); | ||
} | ||
|
||
main().then().catch(console.warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main().then().catch(console.warn); | |
main().then().catch(console.error); |
examples/5.deposit_to_margin_bank.ts
Outdated
await client.init(); | ||
console.log(await client.getPublicAddress()); | ||
|
||
// deposits 10 USDC to margin bank, uses default USDC/MarginBank Contracts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// deposits 10 USDC to margin bank, uses default USDC/MarginBank Contracts | |
// deposits 1000 USDC to Bluefin margin bank |
examples/5.deposit_to_margin_bank.ts
Outdated
@@ -0,0 +1,31 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these three examples can be merged into one
- deposit usdc to margin bank
- query usdc balance from margin bank
- withdraw usdc from margin bank
examples/16.adjust_margin.ts
Outdated
@@ -0,0 +1,44 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment out of place
examples/16.adjust_margin.ts
Outdated
import { | ||
ORDER_STATUS, | ||
ORDER_SIDE, | ||
// MinifiedCandleStick, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MinifiedCandleStick, |
examples/16.adjust_margin.ts
Outdated
); //passing isTermAccepted = true for compliance and authorizarion | ||
await client.init(); | ||
// ADD margin - will add 10 margin to ETH-PERP position | ||
console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example wont work, to adjust margin we have to have an open position. Either we mention in the comment that user has open position then can run the add/remove margin as follows
"ED25519" | ||
); //passing isTermAccepted = true for compliance and authorizarion | ||
await client.init(); | ||
let symbol = "ETH-PERP"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the purpose of example use different markets for both orders. Place on order on ETH-PERP and other on BTC-PERP
examples/11.post_cancel_order.ts
Outdated
leverage: 3, | ||
}); | ||
|
||
// posts order for cancellation on exchange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// posts order for cancellation on exchange | |
// cancel order by posted order hash |
examples/11.post_cancel_order.ts
Outdated
console.log(cancellationResponse.data); | ||
} | ||
|
||
main().then().catch(console.warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main().then().catch(console.warn); | |
main().then().catch(console.error); |
); //passing isTermAccepted = true for compliance and authorizarion | ||
await client.init(); | ||
|
||
// will use margin bank contract from contractAddresses (initialized above) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// will use margin bank contract from contractAddresses (initialized above) |
); | ||
} | ||
|
||
main().then().catch(console.warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main().then().catch(console.warn); | |
main().then().catch(console.error); |
"USDC Deposited to MarginBank: ", | ||
await client.depositToMarginBank(10) | ||
); | ||
console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a get call in between deposit and withdraw to query margin bank balance
No description provided.