Skip to content

Commit 17aef92

Browse files
committed
@thepowereco/tssdk ^1.15.33 => ^1.15.34, fixed send token submit function
1 parent 634f1ce commit 17aef92

7 files changed

Lines changed: 39 additions & 27 deletions

File tree

1.15.34

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@thepowereco/tssdk 1.15.33 =, fixed send token submit function

config-overrides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ function myOverrides(config, env) {
2828
return config;
2929
}
3030

31-
module.exports = customizeСra.override(myOverrides, customizeСra.addExternalBabelPlugin(['@babel/plugin-syntax-import-attributes', { deprecatedAssertSyntax: true }]));
31+
module.exports = customizeСra.override(myOverrides, customizeСra.addExternalBabelPlugin(['@babel/plugin-syntax-import-attributes', { deprecatedAssertSyntax: true }]));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@mui/styles": "^5.6.2",
3232
"@reduxjs/toolkit": "^1.8.6",
3333
"@thepowereco/msgpack": "^1.5.3",
34-
"@thepowereco/tssdk": "^1.15.33",
34+
"@thepowereco/tssdk": "^1.15.34",
3535
"@types/classnames": "^2.3.1",
3636
"@types/date-fns": "^2.6.0",
3737
"@types/file-saver": "^2.0.5",

src/myAssets/sagas/tokens.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ export function* addTokenSaga({ payload: address }: ReturnType<typeof addTokenTr
4545
const walletAddress: string = yield* select(getWalletAddress);
4646

4747
const name: string = yield contract.getName();
48+
4849
const symbol: string = yield contract.getSymbol();
50+
4951
const decimalsBigint: bigint = yield contract.getDecimals();
5052
const decimals = decimalsBigint.toString();
53+
5154
const balanceBigint: bigint = yield contract.getBalance(walletAddress);
5255
const balance = balanceBigint.toString();
56+
5357
yield put(addToken({
5458
name, symbol, address, decimals, type: 'erc20', amount: balance, isShow: true,
5559
}));

src/send/components/Send.tsx

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,28 +118,13 @@ class Send extends React.Component<SendProps, SendState> {
118118

119119
handleClose = () => this.setState({ openModal: false });
120120

121-
handleSubmit = ({ address }: FormValues, formikHelpers: FormikHelpers<FormValues>) => {
122-
if (!AddressApi.isTextAddressValid(address!)) {
123-
formikHelpers.setFieldError('address', this.props.t('invalidAddress')!);
124-
} else {
125-
this.setState({ openModal: true });
126-
}
127-
};
128-
129-
onSubmit = async (values: FormValues, password: string) => {
121+
send = async ({ values, decryptedWif }: { values: FormValues, decryptedWif: string }) => {
130122
const {
131123
sendTrxTrigger,
132124
sendTokenTrxTrigger,
133125
} = this.props;
134126

135-
const { address, wif, token } = this.props;
136-
let decryptedWif;
137-
138-
try {
139-
decryptedWif = await CryptoApi.decryptWif(wif, '');
140-
} catch (error) {
141-
decryptedWif = await CryptoApi.decryptWif(wif, password);
142-
}
127+
const { address, token } = this.props;
143128

144129
if (!token) {
145130
sendTrxTrigger({
@@ -161,6 +146,29 @@ class Send extends React.Component<SendProps, SendState> {
161146
}
162147
};
163148

149+
handleSubmit = async (values: FormValues, formikHelpers: FormikHelpers<FormValues>) => {
150+
if (!AddressApi.isTextAddressValid(values.address!)) {
151+
formikHelpers.setFieldError('address', this.props.t('invalidAddress')!);
152+
} else {
153+
try {
154+
const { wif } = this.props;
155+
const decryptedWif = await CryptoApi.decryptWif(wif, '');
156+
157+
await this.send({ values, decryptedWif });
158+
} catch (error) {
159+
this.setState({ openModal: true });
160+
}
161+
}
162+
};
163+
164+
onSubmit = async (values: FormValues, password: string) => {
165+
const { wif } = this.props;
166+
167+
const decryptedWif = await CryptoApi.decryptWif(wif, password);
168+
169+
await this.send({ values, decryptedWif });
170+
};
171+
164172
renderForm = (formikProps: FormikProps<typeof initialValues>) => {
165173
const {
166174
isNativeToken, props, onSubmit, handleClose,
@@ -174,7 +182,6 @@ class Send extends React.Component<SendProps, SendState> {
174182
onClose={handleClose}
175183
token={token}
176184
onSubmit={onSubmit}
177-
178185
/>
179186
<Form className={styles.form}>
180187
<div className={styles.fields}>

src/send/sagas/sendSagas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function* sendTrxSaga({
4949

5050
yield loadBalanceSaga();
5151
} catch (error: any) {
52-
toast.error(`${i18n.t('anErrorOccurredAsset')} ${error?.code}`);
52+
toast.error(`${i18n.t('anErrorOccurredAsset')} ${error}`);
5353
}
5454
}
5555

@@ -83,7 +83,7 @@ export function* sendTokenTrxSaga({
8383
yield updateTokenAmountSaga({ address });
8484
} catch (error: any) {
8585
console.error(error);
86-
toast.error(`${i18n.t('anErrorOccurredAsset')} ${error?.code}`);
86+
toast.error(`${i18n.t('anErrorOccurredAsset')} ${error}`);
8787
}
8888
}
8989

@@ -144,6 +144,6 @@ export function* singAndSendTrxSaga({
144144
} catch (error: any) {
145145
additionalActionOnError?.(error?.message);
146146
console.error('singAndSendTrxSaga', error);
147-
toast.error(`${i18n.t('somethingWentWrongTransaction')} ${error?.code || error?.message}`);
147+
toast.error(`${i18n.t('somethingWentWrongTransaction')} ${error}`);
148148
}
149149
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,10 +2443,10 @@
24432443
int64-buffer "^0.1.9"
24442444
isarray "^1.0.0"
24452445

2446-
"@thepowereco/tssdk@^1.15.33":
2447-
version "1.15.33"
2448-
resolved "https://registry.yarnpkg.com/@thepowereco/tssdk/-/tssdk-1.15.33.tgz#619c79c6d83f6c4da33cdd743428201169db1472"
2449-
integrity sha512-0YTX2js3+2c6CfsIayKMjDYILhHy7JoxMx+SkYG6dD5Y0LxbMAfLaXbItaMP/x+R4WJmrKZxNmugQLmKnTnHAg==
2446+
"@thepowereco/tssdk@^1.15.34":
2447+
version "1.15.34"
2448+
resolved "https://registry.yarnpkg.com/@thepowereco/tssdk/-/tssdk-1.15.34.tgz#72502d00d183b117345c4e3e52aba19eaafd9cdb"
2449+
integrity sha512-qDoltFrQD9XR4C7X2vOErsJewGeBanDrutMJfvrb8Rr9cotIZVXutbvhROjWNgLjWA1ASF+VvUjmPGoyzD0xsg==
24502450
dependencies:
24512451
"@ethereumjs/common" "^4.1.0"
24522452
"@ethereumjs/tx" "^5.1.0"

0 commit comments

Comments
 (0)