-
Notifications
You must be signed in to change notification settings - Fork 43
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
Feature/sep 6 deposit #163
Conversation
I will not be merging this until we develop a release strategy for v1.2.0 |
description: `Start SEP-6 withdrawal of ${balance.assetCode}?`, | ||
callback: () => handleSep24Withdraw(balance), | ||
}; | ||
break; |
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 PR covers SEP-6 deposit of a trusted asset. A follow up PR will cover untrusted assets using claimable balances
src/components/Sep6Send.tsx
Outdated
if (sep6DepositAsset.status === ActionStatus.NEEDS_INPUT) { | ||
setFormData({ | ||
depositType: { | ||
type: sep6DepositAsset.data.depositTypes.type.choices[0], |
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.
default formData to the first choice
as some assets (like SRT) will only have one
Preview is available here: |
Preview is available here: |
AnyObject, | ||
} from "types/types.d"; | ||
|
||
export const initiateSendAction = createAsyncThunk< |
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 is following the general pattern of SEP-24
Preview is available here: |
payload = { | ||
...payload, | ||
fields: { ...payload.fields, ...sep12Fields }, | ||
}; |
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.
add any required fields found in /customer
endpoint
const { data } = sep6DepositSelector(getState()); | ||
const { kycServer, token } = data; | ||
|
||
if (Object.keys(fields).length) { |
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.
if we have any customer info fields, submit them. Otherwise, just record the deposit type that the user selected
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.
Are we doing anything with submitted fields or the response?
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.
We're not - it looks like we just care about it not throwing an error. This request does respond with a generated id
, but we don't appear to have a use for it, nor the fields that we submitted, as long as the response is a 200
Preview is available here: |
@@ -0,0 +1,31 @@ | |||
import { get } from "lodash"; |
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 didn't touch much code outside of SEP-6 flow, but I did combine the checkInfo
methods for SEP-6 and SEP-24 as they are doing the same thing and expect the same payload
@@ -0,0 +1,54 @@ | |||
import { log } from "helpers/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.
I also moved the SEP-12 methods into their own folder so SEP-6 and SEP-31 could both use them
Preview is available here: |
|
||
log.response({ title: "GET `/customer`", body: resultJson }); | ||
|
||
if (isNewCustomer && resultJson.status !== "NEEDS_INFO") { |
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.
one small change to this code: I added this isNewCustomer
boolean as SEP-31 wants this method to throw error if it doesn't need more info. SEP-6, however, should continue working if no add'l info is needed
Preview is available here: |
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.
Looks great, just left a few minor comments/questions. 🙌
src/components/Sep6Send.tsx
Outdated
const { sep6DepositAsset } = useRedux("sep6DepositAsset"); | ||
const { depositResponse } = sep6DepositAsset; | ||
|
||
const [formData, setFormData] = useState<any>({ |
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.
Maybe we could be more specific about the type here.
src/components/Sep6Send.tsx
Outdated
<label>{input.description}</label> | ||
<Select id={id} key={id} onChange={handleDepositTypeChange}> |
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.
<Select>
has a label
prop, can't we use it here?
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.
Ah, missed that! Yes, I should use the label prop
const { data } = sep6DepositSelector(getState()); | ||
const { kycServer, token } = data; | ||
|
||
if (Object.keys(fields).length) { |
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.
Are we doing anything with submitted fields or the response?
src/ducks/sep6DepositAsset.ts
Outdated
} from "types/types.d"; | ||
|
||
export const initiateSendAction = createAsyncThunk< | ||
{ fields: {}; status: ActionStatus }, |
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.
We could use AnyObject
type for fields
.
Preview is available here: |
…sep-6-deposit # Conflicts: # src/components/BalanceRow.tsx
…sep-6-deposit # Conflicts: # src/components/BalanceRow.tsx
Preview is available here: |
1 similar comment
Preview is available here: |
* add Sep-6 deposit flow * fix typo * adding bad input handling for deposit choice * reorder import * rm unneeded eslint disable * memoize depositTypes choices * PR comments
* add Sep-6 deposit flow * fix typo * adding bad input handling for deposit choice * reorder import * rm unneeded eslint disable * memoize depositTypes choices * PR comments
No description provided.