Skip to main content

mipd

mipd react demo

效果

alt text

是不是感觉怎么多出来几个

info

注意啦,这里是代码中写入的 Provider,如果之前对接 eip6963 就会感觉非常奇怪

这个库的 demo 中,注意了一些 provider,运行后在浏览器怎么也找不到这些奇怪的东西

是为了模拟 coinbase, walletconnect 之类的插件接入就可以了

playgrounds/vite-react/src/wallet.ts
import { EIP1193Provider, announceProvider } from 'mipd';
import 'mipd/window';

announceProvider({
info: {
icon: 'data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 32 32"/>',
name: 'Example Wallet',
rdns: 'org.example',
uuid: '350670db-19fa-4704-a166-e52e178b59d1',
},
provider: '<EIP1193Provider_1>' as unknown as EIP1193Provider,
});

announceProvider({
info: {
icon: 'data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 32 32"/>',
name: 'Foo Wallet',
rdns: 'org.foo',
uuid: '350670db-19fa-4704-a166-e52e178b59d2',
},
provider: '<EIP1193Provider_2>' as unknown as EIP1193Provider,
});

await new Promise((res) => setTimeout(res, 1000));

announceProvider({
info: {
icon: 'data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 32 32"/>',
name: 'Bar Wallet',
rdns: 'io.bar',
uuid: '350670db-19fa-4704-a166-e52e178b59d3',
},
provider: '<EIP1193Provider_3>' as unknown as EIP1193Provider,
});

await new Promise((res) => setTimeout(res, 1000));

announceProvider({
info: {
icon: 'data:image/svg+xml,<svg width="32px" height="32px" viewBox="0 0 32 32"/>',
name: 'Baz Wallet',
rdns: 'com.baz',
uuid: '350670db-19fa-4704-a166-e52e178b59d4',
},
provider: '<EIP1193Provider_3>' as unknown as EIP1193Provider,
});

wagmi-demo

项目初始化

https://wagmi.sh/react/getting-started

代码

alt text

效果

alt text

wagmi 使用 mpid

alt text

wagmi doc

alt text