-
Notifications
You must be signed in to change notification settings - Fork 7
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
add SEP6 deposit and withdrawal #77
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { Wallet } from "../src"; | ||
import axios from "axios"; | ||
|
||
let wallet; | ||
let anchor; | ||
let sep6; | ||
let accountKp; | ||
|
||
describe("SEP-6", () => { | ||
beforeAll(async () => { | ||
wallet = Wallet.TestNet(); | ||
anchor = wallet.anchor({ homeDomain: "testanchor.stellar.org" }); | ||
sep6 = anchor.sep6(); | ||
|
||
accountKp = wallet.stellar().account().createKeypair(); | ||
await axios.get( | ||
"https://friendbot.stellar.org/?addr=" + accountKp.publicKey, | ||
); | ||
}, 10000); | ||
it("should get anchor info", async () => { | ||
const wallet = Wallet.TestNet(); | ||
const anchor = wallet.anchor({ homeDomain: "testanchor.stellar.org" }); | ||
const sep6 = anchor.sep6(); | ||
const resp = await sep6.info(); | ||
expect(resp.deposit).toBeTruthy(); | ||
expect(resp.withdraw).toBeTruthy(); | ||
|
@@ -13,4 +26,71 @@ describe("SEP-6", () => { | |
expect(refreshed.deposit).toBeTruthy(); | ||
expect(refreshed.withdraw).toBeTruthy(); | ||
}); | ||
it("should deposit", async () => { | ||
const auth = await anchor.sep10(); | ||
const authToken = await auth.authenticate({ accountKp }); | ||
|
||
const sep12 = await anchor.sep12(authToken); | ||
|
||
// Make first call with missing KYC info | ||
let resp = await sep6.deposit({ | ||
authToken, | ||
params: { | ||
asset_code: "SRT", | ||
account: accountKp.publicKey, | ||
type: "bank_account", | ||
}, | ||
}); | ||
expect(resp.type).toBe("non_interactive_customer_info_needed"); | ||
|
||
// Add the missing KYC info | ||
await sep12.add({ | ||
sep9Info: { | ||
first_name: "john", | ||
last_name: "smith", | ||
email_address: "[email protected]", | ||
bank_number: "12345", | ||
bank_account_number: "12345", | ||
}, | ||
}); | ||
|
||
// Make deposit call again with all info uploaded | ||
resp = await sep6.deposit({ | ||
authToken, | ||
params: { | ||
asset_code: "SRT", | ||
account: accountKp.publicKey, | ||
type: "bank_account", | ||
}, | ||
}); | ||
expect(resp.id).toBeTruthy(); | ||
}); | ||
it("should withdraw", async () => { | ||
const auth = await anchor.sep10(); | ||
const authToken = await auth.authenticate({ accountKp }); | ||
|
||
const sep12 = await anchor.sep12(authToken); | ||
|
||
await sep12.add({ | ||
sep9Info: { | ||
first_name: "john", | ||
last_name: "smith", | ||
email_address: "[email protected]", | ||
bank_number: "12345", | ||
bank_account_number: "12345", | ||
}, | ||
}); | ||
|
||
const resp = await sep6.withdraw({ | ||
authToken, | ||
params: { | ||
asset_code: "SRT", | ||
account: accountKp.publicKey, | ||
type: "bank_account", | ||
dest: "123", | ||
dest_extra: "12345", | ||
}, | ||
}); | ||
expect(resp.id).toBeTruthy(); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What about exchange endoints, are they out of scope?
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.
ya I thought that's what this ticket is for right?
https://stellarorg.atlassian.net/browse/WAL-1060?atlOrigin=eyJpIjoiNjYzZmI4ZWExYjI3NGVmMjljYTgwYmI4MjIwMjUzZWQiLCJwIjoiaiJ9