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: CAIP Multichain (New) #27782

Draft
wants to merge 426 commits into
base: caip25-permission-migration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
426 commits
Select commit Hold shift + click to select a range
9df3320
Merge branch 'develop' into caip-multichain
jiexi Aug 20, 2024
d6d8f2d
Merge branch 'develop' into caip-multichain
jiexi Aug 21, 2024
07f83d5
Merge branch 'develop' into caip-multichain
jiexi Aug 21, 2024
684f45e
Merge branch 'develop' into caip-multichain
jiexi Aug 22, 2024
4887166
Merge branch 'develop' into caip-multichain
jiexi Aug 22, 2024
ba828e6
Merge branch 'develop' into caip-multichain
jiexi Aug 22, 2024
2ba1522
Merge branch 'develop' into caip-multichain
jiexi Aug 23, 2024
1fda368
Merge branch 'develop' into caip-multichain
jiexi Aug 26, 2024
773e11c
Merge branch 'develop' into caip-multichain
jiexi Aug 26, 2024
d46d3bb
Fix caip25 permission spec type
jiexi Aug 26, 2024
bbbf8e5
WIP
jiexi Aug 26, 2024
f323cb4
Merge branch 'develop' into caip-multichain
jiexi Aug 27, 2024
b575fb4
lavamoat
jiexi Aug 27, 2024
db362d9
Merge remote-tracking branch 'origin/jl/caip-multichain/type-cleanups…
jiexi Aug 27, 2024
4bd882c
Merge branch 'develop' into caip-multichain
jiexi Aug 27, 2024
a71c617
Revert "Fix caip25 permission spec type"
jiexi Aug 27, 2024
dcb3094
Revert "WIP"
jiexi Aug 27, 2024
d893751
Merge branch 'develop' into caip-multichain
jiexi Aug 27, 2024
f3692d9
Merge branch 'develop' into caip-multichain
jiexi Aug 28, 2024
958f864
Update LavaMoat policies
metamaskbot Aug 28, 2024
a260e5e
Merge branch 'develop' into caip-multichain
jiexi Aug 28, 2024
9fb5fed
Jl/caip multichain/misc cleanup (#26724)
jiexi Aug 28, 2024
a9e92c5
Jl/caip multichain/provider authorize metrics (#26699)
jiexi Aug 28, 2024
9eef5fe
Merge branch 'develop' into caip-multichain
jiexi Aug 29, 2024
8baf1a5
Merge branch 'develop' into caip-multichain
jiexi Aug 29, 2024
26b4aa2
Jl/caip multichain/test cleanups (#26698)
jiexi Aug 29, 2024
2d6ccff
Merge branch 'develop' into caip-multichain
jiexi Aug 29, 2024
704e52e
Merge branch 'develop' into caip-multichain
jiexi Aug 29, 2024
3b16fbd
Merge branch 'develop' into caip-multichain
jiexi Aug 30, 2024
7ddc677
Merge branch 'develop' into caip-multichain
jiexi Aug 30, 2024
f838a96
Merge branch 'develop' into caip-multichain
jiexi Aug 30, 2024
f9e30ff
Merge branch 'develop' into caip-multichain
jiexi Sep 3, 2024
aa92005
Jl/caip multichain/replace known caip namespace with metamask utils (…
jiexi Sep 3, 2024
58106a5
Jl/caip multichain/migrate permission eth accounts to caip25 (#26483)
jiexi Sep 3, 2024
e7a9d2d
Sj/caip multichain api specs test (#26643)
shanejonas Sep 3, 2024
7331f50
Jl/caip multichain/namespaced methods (#26732)
jiexi Sep 3, 2024
41ea73b
Remove prepopulated methods and notifications (#26877)
jiexi Sep 3, 2024
bea1e18
Merge branch 'develop' into caip-multichain
jiexi Sep 4, 2024
bca508e
Merge branch 'develop' into caip-multichain
jiexi Sep 4, 2024
191b717
Merge branch 'develop' into caip-multichain
jiexi Sep 4, 2024
93ed08e
Jl/mmp 3048/caip multichain error handling cleanup (#26825)
jiexi Sep 4, 2024
5c048ff
Merge branch 'develop' into caip-multichain
jiexi Sep 4, 2024
995b386
Fix provider_authorize missing hooks (#26926)
jiexi Sep 4, 2024
577f337
Jl/mmp 3037/caip multichain rename methods (#26928)
jiexi Sep 5, 2024
e54be4b
Merge branch 'develop' into caip-multichain
jiexi Sep 5, 2024
370dfd1
yarn dedupe
jiexi Sep 5, 2024
70a2cdc
Jl/caip multichain/remove 5301 error (#26915)
jiexi Sep 5, 2024
781aeb8
Merge branch 'develop' into caip-multichain
jiexi Sep 5, 2024
dfacc49
remove wallet_watchAsset from wallet:eip155 (#26954)
jiexi Sep 6, 2024
c5370c7
Merge branch 'develop' into caip-multichain
jiexi Sep 6, 2024
2dfdbc3
Jl/caip multichain/type cleanups (#26690)
jiexi Sep 6, 2024
615da54
fix: added initial provider authorize error rule (#26828)
shanejonas Sep 11, 2024
76cd526
Merge branch 'develop' into caip-multichain
jiexi Sep 17, 2024
d24fc2a
Jl/caip multichain/fix wallet namespace validation and invoke (#27223)
jiexi Sep 17, 2024
dec03c3
Merge branch 'develop' into caip-multichain
jiexi Sep 24, 2024
eb5805d
fix missing updateNetwork
jiexi Sep 24, 2024
450ec01
Merge branch 'develop' into caip-multichain
jiexi Sep 25, 2024
fec21c4
Replace `ScopeObject.scopes` with `ScopeObject.references` (#27403)
jiexi Sep 25, 2024
dd02132
Caip multichain caip 27 api spec tests (#27229)
shanejonas Sep 25, 2024
d1cb468
Sj/caip multichain api spec tests ci (#27317)
shanejonas Sep 26, 2024
f67f115
Merge branch 'develop' into caip-multichain
jiexi Sep 26, 2024
f6412c5
Merge branch 'develop' into caip-multichain
jiexi Sep 27, 2024
33ff65c
Merge branch 'develop' into caip-multichain
jiexi Sep 27, 2024
da73c69
Merge branch 'develop' into caip-multichain
jiexi Sep 27, 2024
ef39570
bump queued-request-controller version
adonesky1 Sep 30, 2024
4c1a75b
Merge branch 'develop' into caip-multichain
jiexi Sep 30, 2024
baffa1c
Merge branch 'develop' into caip-multichain
jiexi Sep 30, 2024
d165506
Ignore sessionId. Remove hardcoded sessionId (#27510)
jiexi Sep 30, 2024
15f622a
Merge branch 'develop' into caip-multichain
jiexi Oct 1, 2024
b6ca49a
Merge branch 'develop' into caip-multichain
jiexi Oct 1, 2024
68db523
Do not assert unsupported required scopes (#27520)
jiexi Oct 2, 2024
4126dd3
Jl/caip multichain/fix connection flow for permitted chains (#27471)
jiexi Oct 3, 2024
1101102
Handle getCaveat missing permission throws properly (#27549)
jiexi Oct 3, 2024
a92853a
CAIP Multichain: deep clone flattened scopeObjects (#27404)
jiexi Oct 4, 2024
9ffa4b5
Merge branch 'develop' into caip-multichain
jiexi Oct 4, 2024
a392615
fix: bump api-specs on caip-multichain feature branch (#27585)
shanejonas Oct 7, 2024
a213b7e
Merge branch 'develop' into caip-multichain
jiexi Oct 7, 2024
91eef62
Merge branch 'develop' into caip-multichain
jiexi Oct 7, 2024
bd91fb0
Merge branch 'develop' into caip-multichain
jiexi Oct 7, 2024
8bcc777
Get session revoke session should not throw (#27677)
jiexi Oct 8, 2024
c6242ee
Merge branch 'develop' into caip-multichain
jiexi Oct 8, 2024
2852118
Merge branch 'develop' into caip-multichain
jiexi Oct 8, 2024
db8c573
Merge branch 'develop' into caip-multichain
jiexi Oct 9, 2024
2456465
fix: fix api spec multichain bump issues (#27669)
shanejonas Oct 9, 2024
48d19e2
Merge branch 'develop' into caip-multichain
jiexi Oct 9, 2024
a19cf08
fix: get wallet_getSession/revokeSession passing (#27741)
shanejonas Oct 9, 2024
6c3bc39
Multichain: Lint (#27745)
jiexi Oct 9, 2024
42a1c8b
Merge branch 'develop' into caip-multichain
jiexi Oct 10, 2024
c3b7e52
Merge branch 'develop' into caip-multichain
jiexi Oct 10, 2024
7221bb6
Move sign methods back into eip155:x (#27771)
jiexi Oct 10, 2024
947dcd7
Jl/caip multichain/fix wallet eip155 eth account assignment (#27769)
jiexi Oct 10, 2024
0f9ba64
Multichain: Fix Subscriptions (#27682)
jiexi Oct 10, 2024
14de6d2
Assign eth accounts to wallets (#27777)
jiexi Oct 10, 2024
50ec84a
initial pass
jiexi Oct 10, 2024
2e06555
Merge branch 'develop' into caip-multichain
jiexi Oct 11, 2024
f4e0bb2
Merge branch 'develop' into caip-multichain
jiexi Oct 11, 2024
200a1ba
Import attempt
jiexi Oct 11, 2024
4f8014e
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 11, 2024
8f5c024
use barrel exported package
jiexi Oct 14, 2024
146f093
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
33a559f
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
a4b2600
Update LavaMoat policies
metamaskbot Oct 14, 2024
26dc532
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
7ca1867
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
e4e5793
working preview
jiexi Oct 14, 2024
28ba445
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
cd52a18
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
cd1861d
Multichain: Fix snaps connection (#27803)
jiexi Oct 14, 2024
f66a26b
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
10fb361
upsert empty wallet:eip155 on add (#27845)
jiexi Oct 14, 2024
ccb56c5
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
6adb2e4
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
bf0f1f8
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
521b278
move processScopedProperties validateScopedPropertyEip3085 into creat…
jiexi Oct 14, 2024
884c830
lint
jiexi Oct 14, 2024
70ce992
Fix caipPermissionAdapterMiddleware import casing
jiexi Oct 14, 2024
df11376
Merge branch 'develop' into caip-multichain
jiexi Oct 14, 2024
aa5ed57
Merge branch 'caip-multichain' into jl/caip-multichain-migrate-core
jiexi Oct 14, 2024
aa03836
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 15, 2024
ed4c253
Update app/scripts/lib/rpc-method-middleware/handlers/wallet-createSe…
jiexi Oct 15, 2024
4e1df34
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
1be3e41
revert back to 597e8377
jiexi Oct 16, 2024
093e5a4
Fix createSession helper import
jiexi Oct 16, 2024
e0623f5
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
245c47e
Use most recent preview build
jiexi Oct 16, 2024
73dd95a
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
ea0aba4
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
542f8d5
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
ae5e1a5
Remove TODO about verifying switchChain permissioning flow
jiexi Oct 16, 2024
4db8a0d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
85c9fb0
Revert "Remove selectors intended for multichain API"
jiexi Oct 16, 2024
45b5269
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
bbc90fa
fix wallet_createSession for renamed core helpers
jiexi Oct 16, 2024
0a6faca
remove old js tests
jiexi Oct 16, 2024
a5907f5
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 16, 2024
1efe6e9
fix: add method middleware maker and use multichain handlers (#27882)
shanejonas Oct 16, 2024
6ff8102
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 17, 2024
aca50f8
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 17, 2024
f53b91e
fix: remove html-report-caip27 (#27940)
shanejonas Oct 17, 2024
33f3a0c
bring in preview build from new core pr
jiexi Oct 17, 2024
21701e7
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Oct 17, 2024
47a08e3
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 17, 2024
a0a54e2
Update LavaMoat policies
metamaskbot Oct 17, 2024
f3b68be
update wallet_createSession handler comment about listAccounts()
jiexi Oct 17, 2024
a75a9fa
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Oct 17, 2024
3cd8e7d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 17, 2024
db6c055
bring in new preview build for validator listAccount()
jiexi Oct 17, 2024
e5b7290
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 17, 2024
d3d76eb
fix yarn.lock
jiexi Oct 17, 2024
61becd8
use new preview build
jiexi Oct 21, 2024
7a68e3c
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 21, 2024
52cad8e
lint
jiexi Oct 21, 2024
4cc9915
Update LavaMoat policies
metamaskbot Oct 21, 2024
5fae714
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Oct 21, 2024
83f737c
yarn dedupe
jiexi Oct 21, 2024
37f23fc
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 22, 2024
3132108
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 22, 2024
13f3907
Bring in updated core package for types
jiexi Oct 22, 2024
bcddb19
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 22, 2024
5b0db4d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 22, 2024
b2c52f2
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 22, 2024
049493e
Jl/caip mutlichain migrate core convert create session ts (#28020)
jiexi Oct 22, 2024
28bdb3c
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 23, 2024
0b4c431
Filter wallet notifications by api type for connection
jiexi Oct 23, 2024
2d20ca8
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 23, 2024
d1d754e
Fix chainChanged still being sent for over Multichain
jiexi Oct 23, 2024
4945ab1
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 30, 2024
e4b4c6b
Update LavaMoat policies
metamaskbot Oct 30, 2024
7f9135f
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Oct 30, 2024
99e35c6
Send chainChanged events as before
jiexi Oct 31, 2024
3b4210d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 21, 2024
af9339c
use preview build 0d167a3d (multichain + permission refactor)
jiexi Nov 21, 2024
096d6f8
Update LavaMoat policies
metamaskbot Nov 21, 2024
2c3788a
use preview build c58e3946 (getInternalScopesObject))
jiexi Nov 21, 2024
927e0c6
Fix wallet_createSession
jiexi Nov 21, 2024
63695ef
fix mergeScopes usage
jiexi Nov 21, 2024
57630e6
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 21, 2024
a1d338a
use preview build 62975b62 (missing permission adapter middleware)
jiexi Nov 21, 2024
036110b
yarn dedupe
jiexi Nov 22, 2024
1bbc3c6
Fix wallet_createSession test
jiexi Nov 22, 2024
0a24b11
cleanup wallet_createSession test
jiexi Nov 22, 2024
73d1db7
Fix types
jiexi Nov 22, 2024
988891c
fix types
jiexi Nov 22, 2024
efa1804
lint
jiexi Nov 22, 2024
426f481
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 22, 2024
eae656b
use preview build 439ef9ba (filter out ignored 1193 methods)
jiexi Nov 22, 2024
06fcee2
use preview build 6732cd9a (loosen 1193 method enforcement)
jiexi Nov 22, 2024
f1dbda7
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 22, 2024
dc848dd
fix subscription not ending when removed from authorization
jiexi Nov 22, 2024
7b917ec
Update LavaMoat policies
metamaskbot Nov 22, 2024
e9f1038
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 25, 2024
f21c126
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 26, 2024
5b1bfc5
move sessionChanged notif constant to Multichain PR
jiexi Nov 26, 2024
b6d484a
use latest preview builds
adonesky1 Nov 26, 2024
d00ce1e
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 26, 2024
c85442b
use preview build 944be534 (multichain + caveat mutator fix)
jiexi Nov 26, 2024
c960727
cleanup caip-stream.test.ts
jiexi Nov 26, 2024
3c8d5af
Fix engine middleware cleanup for CAIP
jiexi Nov 26, 2024
fb53aba
add setupUntrustedCommunicationCaip spec. Cleanup setupUntrustedCommu…
jiexi Nov 26, 2024
90aca27
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 26, 2024
7e2afa9
update wallet_createSession handler comment about persisting sessionP…
jiexi Nov 26, 2024
5e9c995
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 27, 2024
23b918e
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Nov 27, 2024
34e89cc
Merge branch 'main' into jl/caip-multichain-migrate-core
jiexi Dec 2, 2024
3ce6eff
yarn
jiexi Dec 2, 2024
1234247
Update LavaMoat policies
metamaskbot Dec 2, 2024
21b2181
Jl/caip multichain/cleanup middleware destroy (#28751)
jiexi Dec 2, 2024
88d618e
use preview build 9cfbf21f (latest multichain core after cleanup)
jiexi Dec 5, 2024
604c138
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 5, 2024
966721e
yarn dedupe
jiexi Dec 5, 2024
3fdcd36
Fix remove network in MMC
jiexi Dec 6, 2024
66db33e
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 6, 2024
2e492c2
fix wallet_createSession spec
jiexi Dec 6, 2024
2fa9ec3
Jl/caip multichain/filter unsupported methods notifications (#29001)
jiexi Dec 6, 2024
f79b22d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 9, 2024
66f98cd
Update LavaMoat policies
metamaskbot Dec 9, 2024
038e490
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 9, 2024
cd4011e
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 10, 2024
db816ce
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 11, 2024
e554460
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 11, 2024
bf32e15
restore app/scripts/controllers/permissions/selectors.test.js
jiexi Dec 11, 2024
9c33415
Implement Wallet Discovery For Multichain API #2970 (#29111)
ffmcgee725 Dec 13, 2024
c6ab79e
Jl/caip multichain/flask (#29003)
jiexi Dec 13, 2024
82aab64
dedupe
adonesky1 Dec 13, 2024
886ec3c
fix flask build
adonesky1 Dec 13, 2024
6573d05
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 16, 2024
73e026a
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Dec 16, 2024
e389bc2
dedupe
jiexi Dec 16, 2024
32c380d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 16, 2024
f4845a7
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 16, 2024
b75e6de
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 16, 2024
ce9e79b
chore: bump @metamask/providers
ffmcgee725 Dec 17, 2024
543c24d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 17, 2024
3d173a3
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Dec 17, 2024
953c127
fix connectAccount public address usage from upstream
jiexi Dec 17, 2024
d20da17
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 17, 2024
76ba552
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 17, 2024
09b84e6
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 17, 2024
8e5831e
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 18, 2024
f98f807
Update LavaMoat policies
metamaskbot Dec 18, 2024
3222176
dedupe
adonesky1 Dec 18, 2024
6662dd3
Update app/scripts/metamask-controller.js
jiexi Dec 19, 2024
0ede8b6
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 19, 2024
08178b5
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Dec 19, 2024
ca85516
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 19, 2024
069a8a7
Merge remote-tracking branch 'origin/jl/caip-multichain-migrate-core'…
jiexi Dec 19, 2024
0048c4d
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 20, 2024
f478911
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 20, 2024
fc4a801
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 20, 2024
a44b9e7
Merge branch 'caip25-permission-migration' into jl/caip-multichain-mi…
jiexi Dec 20, 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
36 changes: 35 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ workflows:
- test-api-specs:
requires:
- prep-build-test
- test-api-specs-multichain:
requires:
- prep-build-test
- test-e2e-chrome-multiple-providers:
requires:
- prep-build-test
Expand Down Expand Up @@ -870,7 +873,7 @@ jobs:
at: .
- run:
name: Build extension for testing
command: yarn build:test
command: CHAIN_PERMISSIONS=1 BARAD_DUR=1 yarn build:test
jiexi marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Move test build to 'dist-test' to avoid conflict with production build
command: mv ./dist ./dist-test
Expand Down Expand Up @@ -1091,6 +1094,37 @@ jobs:
- store_test_results:
path: test/test-results/e2e

test-api-specs-multichain:
executor: node-browsers-medium-plus
steps:
- run: *shallow-git-clone-and-enable-vnc
- run: sudo corepack enable
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test ./dist
- run:
name: Move test zips to builds
command: mv ./builds-test ./builds
- gh/install
- run:
name: test:api-specs-multichain
command: .circleci/scripts/test-run-e2e.sh yarn test:api-specs-multichain
no_output_timeout: 5m
- run:
name: Comment on PR
command: |
if [ -f html-report-multichain/index.html ]; then
gh pr comment "${CIRCLE_PR_NUMBER}" --body ":x: Multichain API Spec Test Failed. View the report [here](https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/${CIRCLE_NODE_INDEX}/html-report-multichain/index.html)."
else
echo "Multichain API Spec Report not found!"
fi
when: on_fail
- store_artifacts:
path: html-report-multichain
destination: html-report-multichain

test-api-specs:
executor: node-browsers-medium-plus
steps:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ lavamoat/**/policy-debug.json
# Attributions
licenseInfos.json

# Branding
/app/images/branding

# API Spec tests
html-report/
html-report-multichain/

/app/images/branding
/changed-files
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export const createEthAccountsMethodMiddleware = makeMethodMiddlewareMaker([
ethAccountsHandler,
]);

// The primary home of RPC method implementations for the MultiChain API.
export const createMultichainMethodMiddleware =
makeMethodMiddlewareMaker(localHandlers);

/**
* Creates a method middleware factory function given a set of method handlers.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import {
createEip1193MethodMiddleware,
createEthAccountsMethodMiddleware,
createMultichainMethodMiddleware,
} from '.';

const getHandler = () => ({
Expand Down Expand Up @@ -60,6 +61,7 @@ jest.mock('./handlers', () => ({
describe.each([
['createEip1193MethodMiddleware', createEip1193MethodMiddleware],
['createEthAccountsMethodMiddleware', createEthAccountsMethodMiddleware],
['createMultichainMethodMiddleware', createMultichainMethodMiddleware],
])('%s', (_name, createMiddleware) => {
const method1 = 'method1';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ describe('createUnsupportedMethodMiddleware', () => {
});
const getMockResponse = () => ({ jsonrpc: jsonrpc2, id: 'foo' });

it('forwards requests whose methods are not on the list of unsupported methods', () => {
const middleware = createUnsupportedMethodMiddleware();
it('forwards requests whose methods are not in the list of unsupported methods', () => {
const middleware = createUnsupportedMethodMiddleware([]);
const nextMock = jest.fn();
const endMock = jest.fn();

Expand All @@ -22,10 +22,12 @@ describe('createUnsupportedMethodMiddleware', () => {
});

// @ts-expect-error This function is missing from the Mocha type definitions
it.each([...UNSUPPORTED_RPC_METHODS.keys()])(
'ends requests for methods that are on the list of unsupported methods: %s',
it.each(UNSUPPORTED_RPC_METHODS)(
'ends requests for methods that are in the list of unsupported methods: %s',
(method: string) => {
const middleware = createUnsupportedMethodMiddleware();
const middleware = createUnsupportedMethodMiddleware(
UNSUPPORTED_RPC_METHODS,
);
const nextMock = jest.fn();
const endMock = jest.fn();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ethErrors } from 'eth-rpc-errors';
import type { JsonRpcMiddleware } from 'json-rpc-engine';
import { UNSUPPORTED_RPC_METHODS } from '../../../../shared/constants/network';

/**
* Creates a middleware that rejects explicitly unsupported RPC methods with the
* appropriate error.
*
* @param methods
*/
export function createUnsupportedMethodMiddleware(): JsonRpcMiddleware<
unknown,
void
> {
export function createUnsupportedMethodMiddleware(
methods: string[],
): JsonRpcMiddleware<unknown, void> {
return async function unsupportedMethodMiddleware(req, _res, next, end) {
if ((UNSUPPORTED_RPC_METHODS as Set<string>).has(req.method)) {
if (methods.includes(req.method)) {
return end(ethErrors.rpc.methodNotSupported());
}
return next();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import ethereumAccounts from './eth-accounts';

const baseRequest = {
origin: 'http://test.com',
};

const createMockedHandler = () => {
const next = jest.fn();
const end = jest.fn();
const getAccounts = jest.fn().mockResolvedValue(['0xdead', '0xbeef']);
const response = {};
const handler = (request) =>
ethereumAccounts.implementation(request, response, next, end, {
getAccounts,
});

return {
response,
next,
end,
getAccounts,
handler,
};
};

describe('ethAccountsHandler', () => {
it('gets sorted eth accounts from the CAIP-25 permission via the getAccounts hook', async () => {
const { handler, getAccounts } = createMockedHandler();

await handler(baseRequest);
expect(getAccounts).toHaveBeenCalled();
});

it('returns the accounts', async () => {
const { handler, response } = createMockedHandler();

await handler(baseRequest);
expect(response.result).toStrictEqual(['0xdead', '0xbeef']);
});
});
Loading
Loading