Skip to content

Commit

Permalink
fix(auth-kit/onramp-kit): Migrate to Sepolia + various small fixes (#788
Browse files Browse the repository at this point in the history
)

* fix(onramp-kit): Use valid mock contract address to fix unit test

* Bump `@monerium/sdk` to v2.12.0 for Sepolia support

* Switch chain for onramp-kit example app from görli to sepolia

* fix(onramp-kit): Fix unit test to use sepolia instead of goerli

* feat(onramp-kit): Show loader for monerium demo only while order is pending

* docs(auth-kit): Update broken links in README
  • Loading branch information
tmjssz authored Apr 29, 2024
1 parent f03d793 commit bd782aa
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/auth-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ The Auth Kit provides a way to authenticate blockchain accounts using email addr

## Reference

- [Auth Kit integration guides](https://docs.safe.global/safe-core-aa-sdk/auth-kit)
- [Auth Kit integration guides](https://docs.safe.global/sdk/auth-kit)

- [Auth Kit reference](https://docs.safe.global/reference/auth-kit)
- [Auth Kit reference](https://docs.safe.global/sdk/auth-kit/reference)

## Example

Expand Down
3 changes: 1 addition & 2 deletions packages/auth-kit/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ To use the example properly in your local machine follow these steps:
**In the auth-kit example root folder**

3. `yarn install`
4. Configure `.env` following `.env.sample`
5. `yarn start`
4. `yarn start`
1 change: 1 addition & 0 deletions packages/onramp-kit/example/client/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ VITE_STRIPE_PUBLIC_KEY=
VITE_SAFE_STRIPE_BACKEND_BASE_URL=

# Configure the Monerium client ID. You need to get one from Monerium.
# Add the client ID for the authorization code flow here (not the one for the client credentials flow).
# More info here:
# https://monerium.dev/docs/getting-started/create-app
VITE_MONERIUM_CLIENT_ID=
2 changes: 1 addition & 1 deletion packages/onramp-kit/example/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@monerium/sdk": "^2.9.0",
"@monerium/sdk": "^2.12.0",
"@mui/material": "^5.15.15",
"@safe-global/auth-kit": "file:../../../auth-kit",
"@safe-global/onramp-kit": "file:../../",
Expand Down
2 changes: 1 addition & 1 deletion packages/onramp-kit/example/client/src/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const AuthProvider = ({ children }: AuthContextProviderProps) => {
const options: SafeAuthInitOptions = {
enableLogging: true,
showWidgetButton: false,
chainConfig: { chainId: '0x5', rpcTarget: 'https://rpc.ankr.com/eth_goerli' }
chainConfig: { chainId: '0xaa36a7', rpcTarget: 'https://rpc.ankr.com/eth_sepolia' }
}

await authPack.init(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function Connected({ authContext, orderState, safe, onLogout, onTransfer }: Conn

{isLoading ? (
<Box display="flex" alignItems="center">
<Loader color="primary" size={40} sx={{ mr: 2 }} />
{orderState && [OrderState.placed, OrderState.pending].includes(orderState) && (
<Loader color="primary" size={40} sx={{ mr: 2 }} />
)}
{orderState && (
<>
{orderState === OrderState.placed && <Alert severity="info">Order placed</Alert>}
Expand Down
2 changes: 1 addition & 1 deletion packages/onramp-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"access": "public"
},
"dependencies": {
"@monerium/sdk": "^2.9.0",
"@monerium/sdk": "^2.12.0",
"@safe-global/api-kit": "^2.3.0",
"@safe-global/protocol-kit": "3.1.0-alpha.0",
"@safe-global/safe-core-sdk-types": "^4.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('SafeMoneriumClient', () => {
jest.spyOn(protocolKitPackage, 'getSignMessageLibContract').mockResolvedValueOnce({
safeVersion: '1.3.0',
contractName: 'signMessageLibVersion',
contract: new Contract('target', []),
contract: new Contract('0x0000000000000000000000000000000000000001', []),
safeProvider: protocolKit.getSafeProvider() as protocolKitPackage.SafeProvider,
encode: jest.fn(),
contractAbi: signMessageLib_1_4_1_ContractArtifacts.abi,
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('SafeMoneriumClient', () => {
it('should map the protocol kit chainId to the Monerium Chain types', async () => {
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(1n)
expect(await safeMoneriumClient.getChain()).toBe('ethereum')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(5n)
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(11155111n)
expect(await safeMoneriumClient.getChain()).toBe('ethereum')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(100n)
expect(await safeMoneriumClient.getChain()).toBe('gnosis')
Expand All @@ -285,8 +285,8 @@ describe('SafeMoneriumClient', () => {
it('should map the protocol kit chainId to the Monerium Network types', async () => {
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(1n)
expect(await safeMoneriumClient.getNetwork()).toBe('mainnet')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(5n)
expect(await safeMoneriumClient.getNetwork()).toBe('goerli')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(11155111n)
expect(await safeMoneriumClient.getNetwork()).toBe('sepolia')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(100n)
expect(await safeMoneriumClient.getNetwork()).toBe('mainnet')
protocolKit.getChainId = jest.fn().mockResolvedValueOnce(10200n)
Expand Down

0 comments on commit bd782aa

Please sign in to comment.