Skip to content

Commit

Permalink
fix: okx tron swap referrer rewards (#6320)
Browse files Browse the repository at this point in the history
* fix: okx tron swap referrer reward

* fix: lint

* fix: serach token data error
  • Loading branch information
weatherstar authored Dec 9, 2024
1 parent fa3f06b commit 4237b4e
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 303 deletions.
217 changes: 0 additions & 217 deletions @types/tronweb.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
},
"resolutions": {
"expo-modules-core": "1.11.13",
"tronweb@^5.1.0": "5.1.0",
"tronweb@^6.0.0": "6.0.0",
"@babel/core": "7.23.5",
"@babel/code-frame": "7.23.5",
"@babel/generator": "7.23.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"near-api-js": "^2.1.4",
"ripple-keypairs": "^1.3.1",
"tonweb-mnemonic": "^1.0.1",
"tronweb": "^5.3.1",
"tronweb": "^6.0.0",
"xrpl": "^2.13.0"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/chains/tron/CoreChainSoftware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import coreTestsFixtures from '../../../@tests/fixtures/coreTestsFixtures';

import CoreChainHd from './CoreChainHd';

import type { IEncodedTxTron } from './types';

const {
hdCredential,
// password,
Expand Down Expand Up @@ -60,7 +62,7 @@ const {
},
'raw_data_hex':
'0a020a95220881a16498bf36d55740a8b7aebeb2315a67080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a15418d765ef87acee24ad4ff6f5e755f36c1ee5574241215419e9113cb852004f53b25d8d565b6a1c8c310fb6118a08d0670d1e5aabeb231',
},
} as IEncodedTxTron,
signedTx: {
'encodedTx': null,
'txid':
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/chains/tron/CoreChainSoftware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function publicKeyToAddress(publicKey: string): string {
curve,
Buffer.from(publicKey, 'hex'),
);
return TronWeb.address.fromHex(
return TronWeb.utils.address.fromHex(
`41${keccak256(uncompressed.slice(-64)).slice(-40)}`,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/chains/tron/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Transaction } from 'tronweb';
import type { Types } from 'tronweb';

export type IEncodedTxTron = Transaction;
export type IEncodedTxTron = Types.Transaction;

export type IDecodedTxExtraTron = {
energyUsage?: number;
Expand Down
8 changes: 4 additions & 4 deletions packages/kit-bg/src/providers/ProviderApiTron.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { web3Errors } from '@onekeyfe/cross-inpage-provider-errors';
import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
import { isNil } from 'lodash';
import { type SignedTransaction } from 'tronweb';
import TronWeb from 'tronweb';
import { TronWeb } from 'tronweb';

import {
backgroundClass,
Expand All @@ -24,6 +23,7 @@ import type {
IJsBridgeMessagePayload,
IJsonRpcRequest,
} from '@onekeyfe/cross-inpage-provider-types';
import type { Types } from 'tronweb';

const TRON_SCAN_REQUESTED_URL = {
main: 'https://api.trongrid.io',
Expand Down Expand Up @@ -188,7 +188,7 @@ class ProviderApiTron extends ProviderApiBase {
async tron_signTransaction(
request: IJsBridgeMessagePayload,
transaction: any,
): Promise<SignedTransaction> {
): Promise<Types.SignedTransaction> {
defaultLogger.discovery.dapp.dappRequest({ request });
console.log('tron_signTransaction', request, transaction);

Expand All @@ -207,7 +207,7 @@ class ProviderApiTron extends ProviderApiBase {

console.log('tron_signTransaction DONE', result, request, transaction);

return JSON.parse(result.rawTx) as SignedTransaction;
return JSON.parse(result.rawTx) as Types.SignedTransaction;
}

@providerApiMethod()
Expand Down
Loading

0 comments on commit 4237b4e

Please sign in to comment.