Skip to content
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

Feat: One button connector #139

Draft
wants to merge 98 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
1b4066b
feat: add new UI elements
Cussone Oct 10, 2024
6560d74
feat: add new 1 button connector WIP
Cussone Oct 10, 2024
8f7dcea
Merge branch 'refs/heads/feat/argent-one-button-connector' into feat/…
Cussone Oct 10, 2024
bf9294e
chore: install @argent/x-ui@next
Cussone Oct 23, 2024
2d26120
chore: use tailwind styles generated from x-ui
Cussone Oct 23, 2024
8ed021a
Merge pull request #138 from argentlabs/feat/argent-one-button-connec…
Cussone Oct 23, 2024
14267a7
chore: delete redundant component
Cussone Oct 29, 2024
44ce0a5
chore: inherit `color` for svg icons
Cussone Oct 29, 2024
110bbdf
chore: remove redundant component
Cussone Oct 29, 2024
1202fa3
fix: add missing tailwind's color tokens from `x-ui`
Cussone Oct 29, 2024
f743342
chore: improve button components
Cussone Oct 29, 2024
c777e5d
chore: rename component to more appropriate name
Cussone Oct 29, 2024
8612c92
chore: improve button component
Cussone Oct 29, 2024
9039438
fix: color
Cussone Oct 29, 2024
c57a8d8
feat: add component for rendering icons
Cussone Oct 29, 2024
fba46c4
chore: clean up and add missing functionality
Cussone Oct 29, 2024
6ff294e
fix: pass props and type `downloadLinks`
Cussone Oct 29, 2024
7097abc
chore: replace QR with loader, handle click
Cussone Oct 29, 2024
cc797b7
chore: pass props, adapt usage
Cussone Oct 29, 2024
bb2c00a
chore: connect buttons to handlers
Cussone Oct 29, 2024
3c43169
chore: type wallets, pass props
Cussone Oct 29, 2024
d571de8
feat: programmatically show install extension section
Cussone Oct 30, 2024
e5eecf4
chore: improve method naming
Cussone Oct 30, 2024
61ef1f0
fix: adapt type external
Cussone Oct 30, 2024
ea4008b
feat: create helpers for connectors
Cussone Oct 30, 2024
53d303e
feat: adapt modal to new features
Cussone Oct 30, 2024
015dff2
feat: create modal helpers
Cussone Oct 30, 2024
c743c6d
feat: handle new UI and only QR code approach
Cussone Oct 30, 2024
b3ecb62
chore: add todos
Cussone Oct 30, 2024
35dfa0c
chore: update `closeModal` usage according to API change
Cussone Oct 30, 2024
6903da0
chore: set `Argent` as default
Cussone Oct 30, 2024
6a166b3
chore: update logic to support standalone usage with new UI
Cussone Oct 30, 2024
c2fd50a
chore: add new types
Cussone Oct 30, 2024
50945e5
chore: add new exports
Cussone Oct 30, 2024
e187d3e
chore: handle `StarknetkitCompoundConnector`
Cussone Oct 30, 2024
9166775
chore: handle only qr code approach
Cussone Oct 30, 2024
71b7e6b
chore: add new icons for argent x, improve code
Cussone Oct 30, 2024
3fd36a7
feat: improve type StarknetkitCompoundConnector
Cussone Oct 30, 2024
966a9e7
feat: add new prop to `ConnectOptions`
Cussone Oct 30, 2024
64af087
chore: remove redundant code
Cussone Oct 30, 2024
a76c303
fix: ts error
Cussone Oct 30, 2024
902c3af
chore: update `DEFAULT_WEBWALLET_ICON`
Cussone Oct 30, 2024
0e81651
chore: rename ArgentCompound, update methods/interface, remove redundant
Cussone Oct 30, 2024
def3210
chore: adapt `connect` method to new UI approach
Cussone Oct 30, 2024
56083f4
chore: remove redundant code
Cussone Oct 30, 2024
113a1a3
chore: throw error if html nodes do not exist
Cussone Oct 31, 2024
c23616c
chore: fix ts error
Cussone Oct 31, 2024
7a44258
chore: add installed property to ModalWallet, handle install screen
Cussone Oct 31, 2024
b9acfbc
chore: fix ts error
Cussone Oct 31, 2024
6425b27
chore: improve check
Cussone Oct 31, 2024
e991747
fix: using wrong connector name/icon
Cussone Oct 31, 2024
b3f3ff4
chore: temporarily remove `files`
Cussone Oct 31, 2024
4f1f5a8
chore: fix comment
Cussone Oct 31, 2024
2eb258e
chore: fix vite build errors
Cussone Oct 31, 2024
41ab241
chore: take back `files` prop
Cussone Oct 31, 2024
7a8a75e
chore: add `beta` to push triggered branches
Cussone Oct 31, 2024
8869caa
Merge pull request #148 from argentlabs/feat/argent-one-button-connec…
Cussone Oct 31, 2024
92d522f
chore(release): 2.4.0-beta.1 [skip ci]
semantic-release-bot Oct 31, 2024
0e4aa84
feat: export `StarknetkitCompoundConnector`
Cussone Oct 31, 2024
a2d5423
chore(release): 2.4.0-beta.2 [skip ci]
semantic-release-bot Oct 31, 2024
de4cae8
fix: case when `window` is `undefined` in `getInjectedArgentX`
Cussone Nov 1, 2024
fcf264d
chore(release): 2.4.0-beta.3 [skip ci]
semantic-release-bot Nov 1, 2024
5e7cef2
fix: passing wrong theme to `DynamicIcon`
Cussone Nov 1, 2024
ff8305d
fix: logical error with modal closing
Cussone Nov 1, 2024
96c06e1
fix: ignore ts error
Cussone Nov 1, 2024
3c71667
fix: logical error, destroy modal if `resultType !== "wallet"`
Cussone Nov 1, 2024
e0669ce
chore(release): 2.4.0-beta.4 [skip ci]
semantic-release-bot Nov 1, 2024
6457371
fix: add missing `closeModalOld` for the old way of usage
Cussone Nov 6, 2024
cefa3c2
Merge pull request #152 from argentlabs/feat/argent-one-button-connec…
Cussone Nov 6, 2024
6eb7435
Merge pull request #147 from argentlabs/feat/argent-one-button-connec…
Cussone Nov 7, 2024
658fa46
chore: change `Argent` connector's constructor params
Cussone Nov 7, 2024
0245904
fix: usage of `Argent` connector
Cussone Nov 7, 2024
3cd4421
chore: implement `getLayout` function on modal
Cussone Nov 8, 2024
093f637
chore: show `failure` layout only on `connecting`/`qrCode` layouts
Cussone Nov 8, 2024
4649369
chore: delete redundant component
Cussone Nov 13, 2024
5279df0
refactor: remove redundant `Layout` prop
Cussone Nov 13, 2024
225e391
refactor: generalize `ArgentDownload` component
Cussone Nov 13, 2024
2378e18
refactor: implement changed ux, remove redundant logic
Cussone Nov 13, 2024
e8de757
Merge pull request #153 from argentlabs/refactor/improve-download-ux
Cussone Nov 13, 2024
959f42b
Merge branch 'refs/heads/develop' into feat/argent-one-button-connector
Cussone Nov 13, 2024
1b88b33
chore: add missing type
Cussone Nov 13, 2024
be04ce3
chore: use `Braavos` instead of `InjectedConnector`
Cussone Nov 13, 2024
09da0e2
refactor: add `Connector` to `ConnectOptionsWithConnectors.connectors`
Cussone Nov 13, 2024
f063b2f
refactor: add missing `Connector` after changing `connect` signature
Cussone Nov 13, 2024
010f3fc
feat: add new approval layout
Cussone Nov 13, 2024
bac6372
chore: add approval layout to modal
Cussone Nov 13, 2024
440012c
chore: rename success component
Cussone Nov 13, 2024
864d6e4
fix: missing import, missing error
Cussone Nov 13, 2024
960e17c
feat: add `approval` prop to `Layout` enum
Cussone Nov 13, 2024
94f970d
refactor: change timeout for closing modal
Cussone Nov 13, 2024
b47b23f
refactor: remove old and redundant logic, integrate new approval modal
Cussone Nov 13, 2024
3b2b33d
Merge pull request #154 from argentlabs/feat/approve-argent-mobile
Cussone Nov 13, 2024
d7bc2d4
refactor: move navigator helpers to separate file
Cussone Nov 13, 2024
752baeb
Merge branch 'refs/heads/develop' into feat/argent-one-button-connector
Cussone Nov 14, 2024
e991c89
fix: mobile connector bug
Cussone Nov 15, 2024
0844944
Merge branch 'refs/heads/develop' into feat/argent-one-button-connector
Cussone Dec 10, 2024
f383f4b
chore: run pnpm install
Cussone Dec 10, 2024
7eed317
chore: add `keplr` and `metamask` injected connector exports
Cussone Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update logic to support standalone usage with new UI
Cussone committed Oct 30, 2024
commit 6a166b35ed3268d78ada010a8cf638ed3b825aaa
27 changes: 21 additions & 6 deletions src/connectors/argent/argentMobile/index.ts
Original file line number Diff line number Diff line change
@@ -27,11 +27,12 @@ import {
type ConnectorData,
type ConnectorIcons,
} from "../../connector"
import { InjectedConnector, InjectedConnectorOptions } from "../../injected"
import { InjectedConnectorOptions } from "../../injected"
import { DEFAULT_ARGENT_MOBILE_ICON, DEFAULT_PROJECT_ID } from "./constants"
import { isInArgentMobileAppBrowser } from "../helpers"
import type { StarknetAdapter } from "./modal/starknet/adapter"
import { ArgentX } from "../../injected/argentX"
import { getModalWallet } from "../../../helpers/mapModalWallets"

export interface ArgentMobileConnectorOptions {
dappName: string
@@ -41,7 +42,7 @@ export interface ArgentMobileConnectorOptions {
url: string
icons?: string[]
rpcUrl?: string
isCompoundConnector?: boolean
onlyQR?: boolean
}

export class ArgentMobileBaseConnector extends Connector {
@@ -78,7 +79,7 @@ export class ArgentMobileBaseConnector extends Connector {
}

get name(): string {
return this._options.isCompoundConnector ? "Argent" : "Argent (mobile)" // TODO ditch isCompoundConnector
return "Argent (mobile)"
}

get icon(): ConnectorIcons {
@@ -95,8 +96,14 @@ export class ArgentMobileBaseConnector extends Connector {
return this._wallet
}

async connect(): Promise<ConnectorData> {
await this.ensureWallet()
async connect(
props:
| {
onlyQRCode?: boolean
}
| undefined,
): Promise<ConnectorData> {
await this.ensureWallet({ onlyQRCode: props?.onlyQRCode })

if (!this._wallet) {
throw new ConnectorNotFoundError()
@@ -188,7 +195,13 @@ export class ArgentMobileBaseConnector extends Connector {
this._wallet = null
}

private async ensureWallet(): Promise<void> {
private async ensureWallet(
props:
| {
onlyQRCode?: boolean
}
| undefined,
): Promise<void> {
const { getStarknetWindowObject } = await import("./modal")
const { chainId, projectId, dappName, description, url, icons, rpcUrl } =
this._options
@@ -201,13 +214,15 @@ export class ArgentMobileBaseConnector extends Connector {
: publicRPCNode.testnet)

const options = {
onlyQRCode: props?.onlyQRCode,
chainId: chainId ?? constants.NetworkName.SN_MAIN,
name: dappName,
projectId: projectId ?? DEFAULT_PROJECT_ID,
description,
url,
icons,
rpcUrl: providerRpcUrl,
modalWallet: getModalWallet(this),
}

if (projectId === DEFAULT_PROJECT_ID) {