From e088ca6221c9ed9b04ced22476f6fed22181e20f Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:33:43 +0900 Subject: [PATCH] feat: add support for starknet account to offchain actions (#383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add setAlias to starknet eth sign * fix: use starknet-sig instead of ethereum-sig * fix: fix signature schema * fix: update type to include optional properties * fix: more robust starknet wallet detection * fix: enable back follow button for starknet wallet * fix: fix typing * feat: add support for starknet signature for offchain `send` * fix: use string type to allow starknet address * fix: enable space following/unfollowing for starknet wallets * fix: enable user profile edition for starknet users * fix: use formatted address in alias from * fix: always use padded starknet address * fix: sign sn createAlias on the correct chainId * chore: fix tests * fix: avoid loading votes from incompatible networks * fix: add types and domain to starknet envelope * Update apps/ui/src/composables/useActions.ts Co-authored-by: Chaitanya * fix: revert unrelated change * chore: removed unused import * chore: add comments about confusing extra starknet params on evm envelope * chore: fix import order * fix: sign alias with first available starknet network * chore: lint fix * chore: add changesets * revert: revert back ot use correct starknet chaind ID * fix: finish revert * fix: fix leftover from merge * refactor: simplify starknetNetworkId lookup --------- Co-authored-by: Chaitanya Co-authored-by: Wiktor TkaczyƄski --- .changeset/calm-deers-sort.md | 5 + .changeset/funny-candles-glow.md | 5 + .changeset/red-mayflies-yell.md | 5 + .changeset/wild-news-shave.md | 5 + apps/ui/src/components/ButtonFollow.vue | 3 - apps/ui/src/composables/useActions.ts | 22 +- apps/ui/src/networks/index.ts | 1 + apps/ui/src/networks/starknet/actions.ts | 7 +- apps/ui/src/stores/followedSpaces.ts | 5 +- apps/ui/src/views/User.vue | 5 +- .../clients/offchain/ethereum-sig/index.ts | 9 +- .../clients/offchain/ethereum-sig/types.ts | 6 +- packages/sx.js/src/clients/offchain/types.ts | 14 +- .../clients/starknet/starknet-sig/index.ts | 45 +++- .../clients/starknet/starknet-sig/types.ts | 9 + packages/sx.js/src/types/index.ts | 22 +- .../__snapshots__/index.test.ts.snap | 212 +++++++++++++++++- 17 files changed, 339 insertions(+), 41 deletions(-) create mode 100644 .changeset/calm-deers-sort.md create mode 100644 .changeset/funny-candles-glow.md create mode 100644 .changeset/red-mayflies-yell.md create mode 100644 .changeset/wild-news-shave.md diff --git a/.changeset/calm-deers-sort.md b/.changeset/calm-deers-sort.md new file mode 100644 index 000000000..ff80323b9 --- /dev/null +++ b/.changeset/calm-deers-sort.md @@ -0,0 +1,5 @@ +--- +"@snapshot-labs/sx": patch +--- + +add domain and types to starknet/starknet-sig envelope diff --git a/.changeset/funny-candles-glow.md b/.changeset/funny-candles-glow.md new file mode 100644 index 000000000..02f724193 --- /dev/null +++ b/.changeset/funny-candles-glow.md @@ -0,0 +1,5 @@ +--- +"@snapshot-labs/sx": patch +--- + +always return padded addresses in starknet/starknet-sig envelope diff --git a/.changeset/red-mayflies-yell.md b/.changeset/red-mayflies-yell.md new file mode 100644 index 000000000..19526d86c --- /dev/null +++ b/.changeset/red-mayflies-yell.md @@ -0,0 +1,5 @@ +--- +"@snapshot-labs/sx": patch +--- + +add support for sending starknet signed message to offchain/ethereum-sig diff --git a/.changeset/wild-news-shave.md b/.changeset/wild-news-shave.md new file mode 100644 index 000000000..a229f245e --- /dev/null +++ b/.changeset/wild-news-shave.md @@ -0,0 +1,5 @@ +--- +"@snapshot-labs/sx": patch +--- + +add setAlias to starknet/starknet-sig diff --git a/apps/ui/src/components/ButtonFollow.vue b/apps/ui/src/components/ButtonFollow.vue index 9258a6f32..d9374d878 100644 --- a/apps/ui/src/components/ButtonFollow.vue +++ b/apps/ui/src/components/ButtonFollow.vue @@ -12,12 +12,10 @@ const { isSafeWallet } = useSafeWallet( props.space.snapshot_chain_id ); const followedSpacesStore = useFollowedSpacesStore(); -const { web3 } = useWeb3(); const spaceFollowed = computed(() => followedSpacesStore.isFollowed(spaceIdComposite) ); -const hidden = computed(() => web3.value?.type === 'argentx'); const loading = computed( () => @@ -28,7 +26,6 @@ const loading = computed(