Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into ted/relay-5951-unverified-token-modal
  • Loading branch information
ted-palmer committed Oct 29, 2024
2 parents e90be15 + 7f8066a commit fc0feeb
Show file tree
Hide file tree
Showing 35 changed files with 392 additions and 151 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-islands-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-kit-ui': patch
---

Display pending balance when bitcoin tx is inflight
106 changes: 55 additions & 51 deletions demo/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,52 +108,60 @@ const AppWrapper: FC<AppWrapperProps> = ({ children }) => {
// }
// ]
}}
theme={{
// primaryColor: 'red',
// anchor: {
// color: 'red'
// }
// focusColor: 'green',
// subtleBorderColor: 'green',
// text: {
// default: 'red',
// subtle: 'purple'
// },
// input: {
// background: 'red'
// },
// buttons: {
// tertiary: {
// background: 'orange',
// color: 'red',
// hover: {
// color: 'blue',
// background: 'purple'
// }
// },
// disabled: {
// background: 'green',
// color: 'red'
// }
// },
widget: {
// boxShadow:
// '0px 0px 30px 0px #0000000D, inset 0px 0px 30px 0px #0000000D'
// background: 'pink',
// borderRadius: '0px',
// border: '2px solid orange',
// card: {
// background: 'pink'
// }
}
// modal: {
// background: 'orange'
// },
// dropdown: {
// background: 'red',
// borderRadius: '0px'
// }
}}
// theme={
// {
// primaryColor: 'red',
// anchor: {
// color: 'red'
// }
// focusColor: 'green',
// subtleBorderColor: 'green',
// text: {
// default: 'red',
// subtle: 'purple'
// },
// input: {
// background: 'red'
// },
// buttons: {
// tertiary: {
// background: 'orange',
// color: 'red',
// hover: {
// color: 'blue',
// background: 'purple'
// }
// },
// disabled: {
// background: 'green',
// color: 'red'
// }
// },
// widget: {
// boxShadow:
// '0px 0px 30px 0px #0000000D, inset 0px 0px 30px 0px #0000000D'
// background: 'pink',
// borderRadius: '0px',
// border: '2px solid orange',
// card: {
// background: 'pink'
// }
// selector: {
// background: 'red',
// hover: {
// background: 'green'
// }
// }
// }
// modal: {
// background: 'orange'
// },
// dropdown: {
// background: 'red',
// borderRadius: '0px'
// }
// }
// }
>
<DynamicContextProvider
settings={{
Expand All @@ -169,11 +177,7 @@ const AppWrapper: FC<AppWrapperProps> = ({ children }) => {
display: none;
}
`,
walletsFilter: walletFilter
? pipe(FilterChain(walletFilter)).pipe(
RemoveWallets(['okxwalletbtc', 'xverse'])
)
: pipe(RemoveWallets(['okxwalletbtc', 'xverse'])),
walletsFilter: walletFilter ? FilterChain(walletFilter) : undefined,
overrides: {
evmNetworks: () => {
return chains
Expand Down
13 changes: 13 additions & 0 deletions packages/hooks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @reservoir0x/relay-kit-hooks

## 1.4.2

### Patch Changes

- f18951c: Fetch price and quote in parallel to improve price accuracy in SwapWidget

## 1.4.1

### Patch Changes

- Updated dependencies [6237949]
- @reservoir0x/relay-sdk@1.4.1

## 1.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-kit-hooks",
"version": "1.4.0",
"version": "1.4.2",
"type": "module",
"main": "./_cjs/src/index.js",
"module": "./_esm/src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/src/hooks/useQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ export default function (
...response,
data: response.error ? undefined : response.data,
executeQuote
} as Omit<ReturnType<QueryType>, 'data'> & {
}) as Omit<ReturnType<QueryType>, 'data'> & {
data?: QuoteResponse
executeQuote: (onProgress: onProgress) => Promise<Execute> | undefined
}),
},
[
response.data,
response.error,
Expand Down
7 changes: 7 additions & 0 deletions packages/relay-bitcoin-wallet-adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @reservoir0x/relay-bitcoin-wallet-adapter

## 1.0.1

### Patch Changes

- Updated dependencies [6237949]
- @reservoir0x/relay-sdk@1.4.1

## 1.0.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/relay-bitcoin-wallet-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-bitcoin-wallet-adapter",
"version": "1.0.0",
"version": "1.0.1",
"description": "A Bitcoin adapter for use in @reservoir0x/relay-sdk",
"type": "module",
"source": "./src/index.ts",
Expand Down
7 changes: 7 additions & 0 deletions packages/relay-ethers-wallet-adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @reservoir0x/relay-ethers-wallet-adapter

## 13.0.1

### Patch Changes

- Updated dependencies [6237949]
- @reservoir0x/relay-sdk@1.4.1

## 13.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/relay-ethers-wallet-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-ethers-wallet-adapter",
"version": "13.0.0",
"version": "13.0.1",
"description": "An adapter used to convert an ethersjs signer to an Adapted Wallet for use in the @reservoir0x/relay-sdk",
"type": "module",
"source": "./src/index.ts",
Expand Down
7 changes: 7 additions & 0 deletions packages/relay-solana-wallet-adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @reservoir0x/relay-solana-wallet-adapter

## 2.0.1

### Patch Changes

- Updated dependencies [6237949]
- @reservoir0x/relay-sdk@1.4.1

## 2.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/relay-solana-wallet-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-solana-wallet-adapter",
"version": "2.0.0",
"version": "2.0.1",
"description": "A Solana adapter for use in @reservoir0x/relay-sdk",
"type": "module",
"source": "./src/index.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @reservoir0x/relay-sdk

## 1.4.1

### Patch Changes

- 6237949: Fix bugs with bitcoin implementation

## 1.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-sdk",
"version": "1.4.0",
"version": "1.4.1",
"type": "module",
"main": "./_cjs/src/index.js",
"module": "./_esm/src/index.js",
Expand Down
28 changes: 20 additions & 8 deletions packages/sdk/src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,31 @@ export async function sendTransactionSafely(
}
}

//If the time estimate of the tx is greater than the maximum attempts we should skip polling confirmation
const timeEstimateMs =
((details?.timeEstimate ?? 0) + (chainId === 8253038 ? 600 : 0)) * 1000
const maximumWaitTimeInMs = maximumAttempts * pollingInterval

if (timeEstimateMs > maximumWaitTimeInMs) {
//If the origin chain is bitcoin, skip polling for confirmation, because the deposit will take too long
if (chainId === 8253038) {
return true
}

//Sequence internal functions
if (step.id === 'approve') {
// We want synchronous execution in the following cases:
// - Approval Signature step required first
// - Bitcoin is the destination
// - Canonical route used
if (
step.id === 'approve' ||
details?.currencyOut?.currency?.chainId === 8253038 ||
request?.data?.useExternalLiquidity
) {
await waitForTransaction().promise
await pollForConfirmation()
//In the following cases we want to skip polling for confirmation:
// - Bitcoin destination chain, we want to skip polling for confirmation as the block times are lengthy
// - Canonical route, also lengthy fill time
if (
details?.currencyOut?.currency?.chainId !== 8253038 &&
!request?.data?.useExternalLiquidity
) {
await pollForConfirmation()
}
} else {
const { promise: receiptPromise, controller: receiptController } =
waitForTransaction()
Expand Down
56 changes: 56 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# @reservoir0x/relay-kit-ui

## 2.2.8

### Patch Changes

- 742a49a: Double time estimate for bitcoin

## 2.2.7

### Patch Changes

- 87b0bca: Make selector theme optional

## 2.2.6

### Patch Changes

- a1e9418: Add disclaimer messaging in confirmation modal with long canonical relays
- bd1ec82: Add widget selector theme variable
- b68e6c1: Fix 0 price impact

## 2.2.5

### Patch Changes

- 47c6c04: Fix parallel quoting when quote returns errror but price does not
- fc902d3: Remove stroke from route selector when focused

## 2.2.4

### Patch Changes

- 321a64e: Fix double route ui issue where price error shows up alongside valid quote data

## 2.2.3

### Patch Changes

- 104fe18: Expand bitcoin address validation to taproot and base58

## 2.2.2

### Patch Changes

- f18951c: Fetch price and quote in parallel to improve price accuracy in SwapWidget
- Updated dependencies [f18951c]
- @reservoir0x/relay-kit-hooks@1.4.2

## 2.2.1

### Patch Changes

- 6237949: Fix bugs with bitcoin implementation
- Updated dependencies [6237949]
- @reservoir0x/relay-sdk@1.4.1
- @reservoir0x/relay-kit-hooks@1.4.1

## 2.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reservoir0x/relay-kit-ui",
"version": "2.2.0",
"version": "2.2.8",
"type": "module",
"main": "./_cjs/src/index.js",
"module": "./_esm/src/index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/panda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ export default defineConfig({
value: { base: 'white', _dark: '{colors.gray.1}' }
},
'widget-card-background': { value: { base: '{colors.gray.1}' } },
'widget-selector-background': { value: { base: '{colors.gray.2}' } },
'widget-selector-hover-background': {
value: { base: '{colors.gray.3}' }
},
'widget-swap-currency-button-border-color': {
value: { base: '{colors.primary3}' }
},
Expand Down
Loading

0 comments on commit fc0feeb

Please sign in to comment.