Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
yeager-eren committed Nov 27, 2024
2 parents e2aa477 + 9d9f1b6 commit 111ae52
Show file tree
Hide file tree
Showing 155 changed files with 1,597 additions and 676 deletions.
31 changes: 31 additions & 0 deletions docs/code-splitting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Code Splitting

As explained in [this link](https://legacy.reactjs.org/docs/code-splitting.html), Code-Splitting is a feature supported by some bundlers that allows the creation of multiple bundles that can be loaded dynamically at runtime. This technique enables us to "lazily-load" only the necessary components for the user's current needs, significantly enhancing the performance of the application.


## What we did

- Splitting Signers from initial bundle


## What we are going to do

Currently, we've achieved a good initial bundle size based on analyses conducted using tools like `lighthouse`. Some potential future works that could contribute to the journey ahead are listed below:

- Implement retry mechanisms for dynamic imports to address issues with failing to import certain chunks.
- Maintain the applied changes to prevent future modifications from undoing the achieved results.
- Identify potential areas that can be dynamically imported.
- Attempt to enhance clients that have integrated widgets (like dapp) to improve overall performance.


## Technical Consideration

- Avoid small chunks, they don't add any value to user. they will have network overhead as well.
- Chunks will be built using esbuild's [splitting](https://esbuild.github.io/api/#splitting) option.
- Code splitting for libraries is off by default. To enable the option, add the "--splitting" parameter to the "build" script of that package.


## Notes

The `@rango-dev/signer-solana` package is not dynamically imported because it has a major dependency ("@solana/web3.js") that is also a dependency in `@solflare-wallet/sdk`, which is used in `provider-solflare`. This dependency cannot be dynamically imported, so importing `@rango-dev/signer-solana` dynamically would only result in a very small reduction in the bundle size.

10 changes: 5 additions & 5 deletions examples/queue-manager-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"rango-sdk": "^0.1.57"
},
"dependencies": {
"@rango-dev/provider-all": "^0.39.0",
"@rango-dev/provider-xdefi": "^0.39.0",
"@rango-dev/queue-manager-rango-preset": "^0.39.0",
"@rango-dev/provider-all": "^0.39.1-next.2",
"@rango-dev/provider-xdefi": "^0.39.1-next.2",
"@rango-dev/queue-manager-rango-preset": "^0.39.1-next.0",
"@rango-dev/queue-manager-react": "^0.27.0",
"@rango-dev/wallets-react": "^0.25.0",
"@rango-dev/wallets-shared": "^0.39.0",
"@rango-dev/wallets-react": "^0.25.1-next.0",
"@rango-dev/wallets-shared": "^0.39.1-next.0",
"bignumber.js": "^9.1.1",
"ethers": "^6.13.2",
"rango-sdk-basic": "^0.1.57",
Expand Down
3 changes: 2 additions & 1 deletion examples/queue-manager-demo/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const TREZOR_MANIFEST = {
appUrl: 'https://widget.rango.exchange/',
email: '[email protected]',
};

export const TON_CONNECT_MANIFEST_URL =
'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json';
let configs: Configs = {
API_KEY: RANGO_PUBLIC_API_KEY,
};
Expand Down
7 changes: 6 additions & 1 deletion examples/queue-manager-demo/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import React, { useEffect, useState } from 'react';
import { createRoot } from 'react-dom/client';

import { App } from './App';
import { TREZOR_MANIFEST, WC_PROJECT_ID } from './configs';
import {
TON_CONNECT_MANIFEST_URL,
TREZOR_MANIFEST,
WC_PROJECT_ID,
} from './configs';

const providers = allProviders({
walletconnect2: {
WC_PROJECT_ID: WC_PROJECT_ID,
},
trezorManifest: TREZOR_MANIFEST,
tonconnect: { manifestUrl: TON_CONNECT_MANIFEST_URL },
});

function AppContainer() {
Expand Down
4 changes: 2 additions & 2 deletions examples/wallets-adapter-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"clean": "rimraf .parcel-cache && rimraf dist"
},
"dependencies": {
"@rango-dev/provider-all": "^0.39.0",
"@rango-dev/wallets-adapter": "^0.35.0",
"@rango-dev/provider-all": "^0.39.1-next.2",
"@rango-dev/wallets-adapter": "^0.35.1-next.2",
"rango-sdk": "^0.1.57",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
7 changes: 6 additions & 1 deletion examples/wallets-adapter-demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import { RangoClient } from 'rango-sdk';
import React, { useEffect, useState } from 'react';

import WalletsModal from './components/WalletsModal';
import { TREZOR_MANIFEST, WC_PROJECT_ID } from './constants';
import {
TON_CONNECT_MANIFEST_URL,
TREZOR_MANIFEST,
WC_PROJECT_ID,
} from './constants';

const providers = allProviders({
walletconnect2: {
WC_PROJECT_ID: WC_PROJECT_ID,
},
trezorManifest: TREZOR_MANIFEST,
tonconnect: { manifestUrl: TON_CONNECT_MANIFEST_URL },
});

export function App() {
Expand Down
2 changes: 2 additions & 0 deletions examples/wallets-adapter-demo/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export const TREZOR_MANIFEST = {
appUrl: 'https://widget.rango.exchange/',
email: '[email protected]',
};
export const TON_CONNECT_MANIFEST_URL =
'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json';
8 changes: 4 additions & 4 deletions examples/wallets-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"clean": "rimraf .parcel-cache && rimraf dist"
},
"dependencies": {
"@rango-dev/provider-all": "^0.39.0",
"@rango-dev/ui": "^0.41.0",
"@rango-dev/wallets-react": "^0.25.0",
"@rango-dev/wallets-shared": "^0.39.0",
"@rango-dev/provider-all": "^0.39.1-next.2",
"@rango-dev/ui": "^0.41.1-next.0",
"@rango-dev/wallets-react": "^0.25.1-next.0",
"@rango-dev/wallets-shared": "^0.39.1-next.0",
"rango-sdk": "^0.1.57",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
7 changes: 6 additions & 1 deletion examples/wallets-demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import { RangoClient } from 'rango-sdk';
import React, { useEffect, useState } from 'react';

import List from './components/List';
import { TREZOR_MANIFEST, WC_PROJECT_ID } from './constants';
import {
TON_CONNECT_MANIFEST_URL,
TREZOR_MANIFEST,
WC_PROJECT_ID,
} from './constants';

const providers = allProviders({
walletconnect2: {
WC_PROJECT_ID: WC_PROJECT_ID,
},
trezorManifest: TREZOR_MANIFEST,
tonconnect: { manifestUrl: TON_CONNECT_MANIFEST_URL },
});

export function App() {
Expand Down
7 changes: 6 additions & 1 deletion examples/wallets-demo/src/components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { useWallets } from '@rango-dev/wallets-react';
import { sortWalletsBasedOnState } from '@rango-dev/wallets-shared';
import React from 'react';

import { TREZOR_MANIFEST, WC_PROJECT_ID } from '../../constants';
import {
TON_CONNECT_MANIFEST_URL,
TREZOR_MANIFEST,
WC_PROJECT_ID,
} from '../../constants';

import Item from './Item';

Expand All @@ -17,6 +21,7 @@ function List({ tokens }: { tokens: Token[] }) {
const providerTypes = allProviders({
walletconnect2: { WC_PROJECT_ID: WC_PROJECT_ID },
trezorManifest: TREZOR_MANIFEST,
tonconnect: { manifestUrl: TON_CONNECT_MANIFEST_URL },
}).map((p) => p.config.type);
const allWallets = sortWalletsBasedOnState(
providerTypes.map((type) => {
Expand Down
2 changes: 2 additions & 0 deletions examples/wallets-demo/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export const TREZOR_MANIFEST = {
appUrl: 'https://widget.rango.exchange/',
email: '[email protected]',
};
export const TON_CONNECT_MANIFEST_URL =
'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json';

export const swaps = {
EVM: {
Expand Down
2 changes: 1 addition & 1 deletion queue-manager/rango-preset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rango-dev/queue-manager-rango-preset",
"version": "0.39.0",
"version": "0.39.1-next.0",
"license": "MIT",
"type": "module",
"source": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion signers/signer-solana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rango-dev/signer-solana",
"version": "0.34.0",
"version": "0.34.1-next.0",
"license": "MIT",
"type": "module",
"source": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion signers/signer-solana/src/utils/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const SEND_OPTIONS = {
skipPreflight: true,
};
const TIME_OUT = 2_000;
const CONFIRMATION_TIME_OUT = 30_000;
const CONFIRMATION_TIME_OUT = 60_000;

// https://github.com/jup-ag/jupiter-quote-api-node/blob/main/example/utils/transactionSender.ts
export async function transactionSenderAndConfirmationWaiter({
Expand Down
6 changes: 5 additions & 1 deletion signers/signer-ton/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rango-dev/signer-ton",
"version": "0.17.0",
"version": "0.17.1-next.0",
"license": "MIT",
"type": "module",
"source": "./src/index.ts",
Expand All @@ -23,6 +23,10 @@
"dependencies": {
"rango-types": "^0.1.74"
},
"peerDependencies": {
"@ton/core": ">=0.59.0",
"@ton/crypto": ">=3.3.0"
},
"publishConfig": {
"access": "public"
}
Expand Down
11 changes: 5 additions & 6 deletions signers/signer-ton/src/signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { GenericSigner, TonTransaction } from 'rango-types';

import { Cell } from '@ton/core';
import { SignerError } from 'rango-types';

export class DefaultTonSigner implements GenericSigner<TonTransaction> {
Expand All @@ -15,14 +16,12 @@ export class DefaultTonSigner implements GenericSigner<TonTransaction> {
async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {
const { type, blockChain, ...transactionObjectForSign } = tx;

await this.provider.send({
const { result } = await this.provider.send({
method: 'sendTransaction',
params: [JSON.stringify(transactionObjectForSign)],
});
/*
*No hash is returned when signing a Ton transaction.
*Returns a string for API consistency
*/
return { hash: 'xxxxxxxx' };

const hash = Cell.fromBase64(result).hash().toString('hex');
return { hash };
}
}
32 changes: 21 additions & 11 deletions translations/af.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Language: af\n"
"Project-Id-Version: rango\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-11-04 09:42\n"
"PO-Revision-Date: 2024-11-27 15:57\n"
"Last-Translator: \n"
"Language-Team: Afrikaans\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
Expand All @@ -18,6 +18,16 @@ msgstr ""
"X-Crowdin-File: en.po\n"
"X-Crowdin-File-ID: 30\n"

#. js-lingui-explicit-id
#: widget/embedded/src/components/SameTokensWarning/SameTokensWarning.tsx:21
msgid "No Routes Found"
msgstr "Geen roetes gevind nie"

#. js-lingui-explicit-id
#: widget/embedded/src/components/SameTokensWarning/SameTokensWarning.tsx:25
msgid "You cannot use the same token for From and To."
msgstr "Jy kan nie dieselfde teken vir Van en To gebruik nie."

#. js-lingui-explicit-id
#: widget/embedded/src/components/BlockchainList/BlockchainList.tsx:41
#: widget/embedded/src/components/TokenList/TokenList.tsx:286
Expand Down Expand Up @@ -150,7 +160,7 @@ msgstr "Status"

#. js-lingui-explicit-id
#: widget/embedded/src/components/FilterSelector/FilterSelectorContent.tsx:33
#: widget/embedded/src/components/NoResult/NoResult.helpers.ts:40
#: widget/embedded/src/components/NoResult/NoResult.helpers.ts:37
#: widget/embedded/src/pages/SettingsPage.tsx:55
msgid "Reset"
msgstr "Stel terug"
Expand Down Expand Up @@ -205,7 +215,7 @@ msgid "Swaps steps"
msgstr "Ruil trappe om"

#. js-lingui-explicit-id
#: widget/embedded/src/components/NoResult/NoResult.helpers.ts:28
#: widget/embedded/src/components/NoResult/NoResult.helpers.ts:25
#: widget/embedded/src/pages/AddCustomTokenPage.tsx:191
msgid "Retry"
msgstr "Probeer weer"
Expand Down Expand Up @@ -791,7 +801,7 @@ msgstr "Bevestig USD-prys onbekend"

#. js-lingui-explicit-id
#: widget/embedded/src/constants/messages.ts:6
#: widget/embedded/src/pages/Home.tsx:161
#: widget/embedded/src/pages/Home.tsx:163
msgid "Swap"
msgstr "Ruil"

Expand Down Expand Up @@ -1161,37 +1171,37 @@ msgid "Required: < {max} {symbol}"
msgstr "Vereis: < {max} {symbol}"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:604
#: widget/embedded/src/utils/swap.ts:601
msgid " for network fee"
msgstr " vir netwerkfooi"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:607
#: widget/embedded/src/utils/swap.ts:604
msgid " for swap"
msgstr " vir ruil"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:610
#: widget/embedded/src/utils/swap.ts:607
msgid " for input and network fee"
msgstr " vir insette en netwerkfooi"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:612
#: widget/embedded/src/utils/swap.ts:609
msgid "Needs ≈ {requiredAmount} {symbol}{reason}, but you have {currentAmount} {symbol} in your {blockchain} wallet."
msgstr "Benodig ≈ {requiredAmount} {symbol}{reason}, maar jy het {currentAmount} {symbol} in jou {blockchain} beursie."

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:672
#: widget/embedded/src/utils/swap.ts:669
msgid "Waiting for connecting wallet"
msgstr "Wag vir koppel beursie"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:676
#: widget/embedded/src/utils/swap.ts:673
msgid "Waiting for other running tasks to be finished"
msgstr "Wag vir ander lopende take om klaar te wees"

#. js-lingui-explicit-id
#: widget/embedded/src/utils/swap.ts:679
#: widget/embedded/src/utils/swap.ts:676
msgid "Waiting for changing wallet network"
msgstr "Wag vir verandering van beursienetwerk"

Expand Down
Loading

0 comments on commit 111ae52

Please sign in to comment.