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: decouple from snjs #194

Merged
merged 17 commits into from
Feb 15, 2024
Merged

feat: decouple from snjs #194

merged 17 commits into from
Feb 15, 2024

Conversation

avimak
Copy link
Collaborator

@avimak avimak commented Oct 2, 2023

  1. Implemented JSON-RPC SNIP (https://community.starknet.io/t/snip-standardizing-starknet-wallet-connections-with-write-api-and-json-rpc-integration/98049)
  2. Decoupled get-starknet-core from snjs
  3. Added silent mode to wallet-window connection

avimak added 3 commits October 2, 2023 18:39
 1. Implemented JSON-RPC SNIP (https://community.starknet.io/t/snip-standardizing-starknet-wallet-connections-with-write-api-and-json-rpc-integration/98049)
 2. Decoupled get-starknet-core from snjs
 3. Added silent mode to wallet-window connection
it will be complicated for wallets to decode FELT-encoded entrypoints.
it's doable but slow, and slightly shifting from a pure RPC-schema approach
seems reasonable in this use case.
@fracek
Copy link
Collaborator

fracek commented Oct 18, 2023

I can't comment inline because there was no change, but in my experience icon should be icon: { dark: string; light: string } to support dark mode or half of the developers will ignore it.

@@ -39,11 +40,14 @@ export interface ConnectOptions extends GetWalletOptions {
storeVersion?: StoreVersion
}

const enableWithVersion = async (wallet: StarknetWindowObject | null) => {
const enableWithVersion = async (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should get rid of this method and just use connect -> sn.enable()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could u pls show with code? 🙏

@dhruvkelawala
Copy link
Collaborator

I can't comment inline because there was no change, but in my experience icon should be icon: { dark: string; light: string } to support dark mode or half of the developers will ignore it.

Maybe we can do a complex typing here like

interface IconOptions {
dark: "darkIcon",
light: "lightIcon",
}

interface IStarknetWindoObject {
// Other properties...

icon: IconOptions | string

}

If it's only a string, we apply the same icon for both dark and light mode in the Wallet connection modal.

@dhruvkelawala
Copy link
Collaborator

dhruvkelawala commented Dec 11, 2023

@avimak I think we can also get rid of baseUrl. Sequencer has been deprecated and we should only use rpcUrls now. (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3085.md#wallet_addethereumchain)

EDIT: we can also get rid of id

} from "starknet4"
export enum StarknetChainId {
SN_MAIN = "0x534e5f4d41494e",
SN_GOERLI = "0x534e5f474f45524c49",
Copy link

@PhilippeR26 PhilippeR26 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add Sepolia Testnet, as Braavos is handling it.

SN_SEPOLIA = "0x534e5f5345504f4c4941"

/**
* The class ABI, as supplied by the user declaring the class
*/
abi?: string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type string for abi is not working properly.
Only any[] is working properly.


export type AccountChangeEventHandler = (accounts: string[]) => void
type Call = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call type : This type name already exists in Starknet.js, but their definition are not the same, generating confusion when coding. My proposal is to rename in the interface Call to CallParameters.


export interface GetStarknetOptions {
windowObject: Record<string, any>
isWalletObject: (wallet: any) => boolean
Copy link

@PhilippeR26 PhilippeR26 Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For devs who would like to create their own UI, it will be useful to export for them :

  • isWalletObject
  • scanObjectForWallets

@dhruvkelawala dhruvkelawala changed the base branch from master to next February 15, 2024 13:05
@dhruvkelawala dhruvkelawala deleted the branch develop February 15, 2024 13:13
@dhruvkelawala dhruvkelawala reopened this Feb 15, 2024
@dhruvkelawala dhruvkelawala changed the base branch from next to develop February 15, 2024 13:15
@dhruvkelawala dhruvkelawala merged commit 4a0c710 into develop Feb 15, 2024
1 check failed
@dhruvkelawala dhruvkelawala deleted the feat/new-json-rpc-api branch February 15, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants