Skip to content

Commit

Permalink
feat: upgrade dependencies (#576)
Browse files Browse the repository at this point in the history
* Upgrade `api-kit` dependencies

* Upgrade `onramp-kit` example client dependencies

* Upgrade `onramp-kit` example server dependencies

* Upgrade `onramp-kit` dependencies

Changes on monerium client:
* remove `kind` property from order as its value is always `redeem`
* remove `currency` property from order because monerium does only support EUR for now

* Add networks to config to support `@safe-global/safe-deployments` v1.28.0

* Upgrade `relay-kit` dependencies

* Upgrade `safe-core-sdk-types` dependencies

* Upgrade dependencies in main package.json

* Cleanup yarn.lock

* Add unit test for error case

---------

Co-authored-by: Daniel <[email protected]>
  • Loading branch information
tmjssz and dasanra authored Nov 9, 2023
1 parent e277fd9 commit e0761a8
Show file tree
Hide file tree
Showing 15 changed files with 3,514 additions and 3,664 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
"author": "Safe (https://safe.global)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"@types/jest": "^29.5.7",
"@types/node": "^18.18.8",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.0",
"jest": "^29.4.3",
"lerna": "^6.6.1",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lerna": "^6.6.2",
"lint-staged": "^13.3.0",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.5",
"typescript": "^4.9.4"
"tsc-alias": "^1.8.8",
"typescript": "^4.9.5"
},
"lint-staged": {
"./packages/**/*.{js,jsx,ts,tsx}": [
Expand Down
18 changes: 9 additions & 9 deletions packages/api-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@safe-global/protocol-kit": "^1.3.0",
"@types/chai": "^4.3.5",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^10.0.1",
"@types/sinon-chai": "^3.2.9",
"@types/yargs": "^16.0.1",
"chai": "^4.3.7",
"@types/chai": "^4.3.9",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.3",
"@types/sinon-chai": "^3.2.11",
"@types/yargs": "^16.0.7",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"hardhat": "^2.16.1",
"hardhat": "^2.19.0",
"mocha": "^10.2.0",
"sinon": "^14.0.0",
"sinon": "^14.0.2",
"sinon-chai": "^3.7.0",
"ts-generator": "^0.1.1",
"tsconfig-paths": "^4.2.0",
Expand All @@ -57,6 +57,6 @@
"dependencies": {
"@ethersproject/abstract-signer": "^5.7.0",
"@safe-global/safe-core-sdk-types": "^2.3.0",
"node-fetch": "^2.6.6"
"node-fetch": "^2.7.0"
}
}
28 changes: 14 additions & 14 deletions packages/onramp-kit/example/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@monerium/sdk": "^2.5.2",
"@mui/material": "^5.14.0",
"@safe-global/api-kit": "^1.3.0",
"@safe-global/auth-kit": "^1.2.0",
"@safe-global/protocol-kit": "^1.2.0",
"@monerium/sdk": "^2.6.5",
"@mui/material": "^5.14.17",
"@safe-global/api-kit": "^1.3.1",
"@safe-global/auth-kit": "^1.2.1",
"@safe-global/protocol-kit": "^1.3.0",
"@safe-global/safe-react-components": "^2.0.5",
"@web3auth/modal": "^4.3.1",
"@web3auth/openlogin-adapter": "^4.3.0",
"ethers": "^5.7.0",
"@web3auth/modal": "^4.6.2",
"@web3auth/openlogin-adapter": "^4.6.0",
"ethers": "^5.7.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.14.0"
"react-router-dom": "^6.18.0"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@rollup/plugin-commonjs": "^24.0.1",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@rollup/plugin-commonjs": "^24.1.0",
"@types/react": "^18.2.36",
"@types/react-dom": "^18.2.14",
"@vitejs/plugin-react": "^3.1.0",
"rollup-plugin-polyfill-node": "^0.12.0",
"typescript": "^4.9.3",
"vite": "^4.1.0"
"typescript": "^4.9.5",
"vite": "^4.5.0"
}
}
661 changes: 327 additions & 334 deletions packages/onramp-kit/example/client/yarn.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions packages/onramp-kit/example/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
"test:coverage": "echo 'add tests'"
},
"dependencies": {
"axios": "^1.3.3",
"axios": "^1.6.0",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"pine": "^1.1.1",
"pino-http": "^8.3.3",
"pino-pretty": "^9.2.0"
"pino-http": "^8.5.1",
"pino-pretty": "^9.4.1"
},
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/node": "^18.13.0",
"nodemon": "^2.0.20",
"@types/cors": "^2.8.16",
"@types/express": "^4.17.21",
"@types/node": "^18.18.8",
"nodemon": "^2.0.22",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
Expand Down
71 changes: 39 additions & 32 deletions packages/onramp-kit/example/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
dependencies:
"@types/node" "*"

"@types/cors@^2.8.13":
version "2.8.13"
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.13.tgz#b8ade22ba455a1b8cb3b5d3f35910fd204f84f94"
integrity sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==
"@types/cors@^2.8.16":
version "2.8.16"
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.16.tgz#a24bf65acd216c078890ca6ceb91e672adb158e7"
integrity sha512-Trx5or1Nyg1Fq138PCuWqoApzvoSLWzZ25ORBiHMbbUT42g578lH1GT4TwYDbiUOLFuDsCkfLneT2105fsFWGg==
dependencies:
"@types/node" "*"

Expand All @@ -78,10 +78,10 @@
"@types/qs" "*"
"@types/range-parser" "*"

"@types/express@^4.17.17":
version "4.17.17"
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.17.tgz#01d5437f6ef9cfa8668e616e13c2f2ac9a491ae4"
integrity sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==
"@types/express@^4.17.21":
version "4.17.21"
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.21.tgz#c26d4a151e60efe0084b23dc3369ebc631ed192d"
integrity sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==
dependencies:
"@types/body-parser" "*"
"@types/express-serve-static-core" "^4.17.33"
Expand All @@ -93,10 +93,12 @@
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10"
integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==

"@types/node@*", "@types/node@^18.13.0":
version "18.13.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.13.0.tgz#0400d1e6ce87e9d3032c19eb6c58205b0d3f7850"
integrity sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==
"@types/node@*", "@types/node@^18.18.8":
version "18.18.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.8.tgz#2b285361f2357c8c8578ec86b5d097c7f464cfd6"
integrity sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ==
dependencies:
undici-types "~5.26.4"

"@types/qs@*":
version "6.9.7"
Expand Down Expand Up @@ -181,10 +183,10 @@ atomic-sleep@^1.0.0:
resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b"
integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==

axios@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.3.tgz#e7011384ba839b885007c9c9fae1ff23dceb295b"
integrity sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==
axios@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.0.tgz#f1e5292f26b2fd5c2e66876adc5b06cdbd7d2102"
integrity sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
Expand Down Expand Up @@ -387,10 +389,10 @@ diff@^4.0.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==

dotenv@^16.0.3:
version "16.0.3"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
dotenv@^16.3.1:
version "16.3.1"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==

[email protected]:
version "1.1.1"
Expand Down Expand Up @@ -763,10 +765,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==

nodemon@^2.0.20:
version "2.0.20"
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.20.tgz#e3537de768a492e8d74da5c5813cb0c7486fc701"
integrity sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==
nodemon@^2.0.22:
version "2.0.22"
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.22.tgz#182c45c3a78da486f673d6c1702e00728daf5258"
integrity sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==
dependencies:
chokidar "^3.5.2"
debug "^3.2.7"
Expand Down Expand Up @@ -852,20 +854,20 @@ pino-abstract-transport@^1.0.0, [email protected]:
readable-stream "^4.0.0"
split2 "^4.0.0"

pino-http@^8.3.3:
version "8.3.3"
resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-8.3.3.tgz#2b140e734bfc6babe0df272a43bb8f36f2b525c0"
integrity sha512-p4umsNIXXVu95HD2C8wie/vXH7db5iGRpc+yj1/ZQ3sRtTQLXNjoS6Be5+eI+rQbqCRxen/7k/KSN+qiZubGDw==
pino-http@^8.5.1:
version "8.5.1"
resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-8.5.1.tgz#b4afb7d40687710f463588c0659d6a931285bf46"
integrity sha512-T/3d9YHKBYpv/QHjNy73P5BNYYkRrC2/D6CxKMecG4fKFLN+B2iC6LsKYzGRTRV+Ld3fjxFC1ca4TUGbPdzk+Q==
dependencies:
get-caller-file "^2.0.5"
pino "^8.0.0"
pino-std-serializers "^6.0.0"
process-warning "^2.0.0"

pino-pretty@^9.2.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-9.2.0.tgz#4a6bcc677533f4053acd841bd9ccc9be9122c8af"
integrity sha512-7CeszmFqrUD08+JvtYcFXowNE7duFlE1XScmR41qTMbwQOhn7gijYYrRb5udH+z8xq4+A8vN8rQNYVPCTfzmGw==
pino-pretty@^9.4.1:
version "9.4.1"
resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-9.4.1.tgz#89121ef32d00a4d2e4b1c62850dcfff26f62a185"
integrity sha512-loWr5SNawVycvY//hamIzyz3Fh5OSpvkcO13MwdDW+eKIGylobPLqnVGTDwDXkdmpJd1BhEG+qhDw09h6SqJiQ==
dependencies:
colorette "^2.0.7"
dateformat "^4.6.3"
Expand Down Expand Up @@ -1182,6 +1184,11 @@ undefsafe@^2.0.5:
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c"
integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

[email protected], unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
Expand Down
8 changes: 4 additions & 4 deletions packages/onramp-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
"@ethersproject/address": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/hash": "^5.7.0",
"@monerium/sdk": "^2.3.0",
"@safe-global/api-kit": "^1.3.0",
"@monerium/sdk": "^2.6.5",
"@safe-global/api-kit": "^1.3.1",
"@safe-global/protocol-kit": "^1.3.0",
"@safe-global/safe-core-sdk-types": "^2.3.0",
"@stripe/crypto": "^0.0.4",
"@stripe/stripe-js": "^1.52.0"
"@stripe/stripe-js": "^1.54.2"
},
"devDependencies": {
"events": "^3.3.0",
"jest-environment-jsdom": "^29.6.1"
"jest-environment-jsdom": "^29.7.0"
}
}
17 changes: 14 additions & 3 deletions packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hashMessage } from '@ethersproject/hash'
import { Currency, PaymentStandard } from '@monerium/sdk'
import { PaymentStandard } from '@monerium/sdk'
import Safe, * as protocolKit from '@safe-global/protocol-kit'
import { OperationType } from '@safe-global/safe-core-sdk-types'
import SafeApiKit from '@safe-global/api-kit'
Expand All @@ -9,7 +9,6 @@ import { MAGIC_VALUE } from './signatures'

const newOrder = {
amount: '100',
currency: Currency.eur,
counterpart: {
identifier: {
standard: 'iban' as PaymentStandard.iban,
Expand Down Expand Up @@ -68,7 +67,6 @@ describe('SafeMoneriumClient', () => {
...newOrder,
address: '0xSafeAddress',
chain: 'ethereum',
kind: 'redeem',
message: expect.stringContaining('Send EUR 100 to iban at'),
network: 'goerli',
signature: '0x',
Expand All @@ -82,6 +80,19 @@ describe('SafeMoneriumClient', () => {
)
})

it('should throw if signing message fails', async () => {
safeSdk.getAddress = jest.fn(() => Promise.resolve('0xSafeAddress'))
const placeOrderSpy = jest.spyOn(safeMoneriumClient, 'placeOrder')
const signMessageSpy = jest
.spyOn(safeMoneriumClient, 'signMessage')
.mockRejectedValueOnce(new Error('Failed to sign message'))

await expect(safeMoneriumClient.send({ ...newOrder })).rejects.toThrow('Failed to sign message')

expect(placeOrderSpy).toHaveBeenCalledTimes(1)
expect(signMessageSpy).toHaveBeenCalledTimes(1)
})

it('should allow to check if a message is signed in the smart contract', async () => {
const isMessageSigned = await safeMoneriumClient.isMessageSigned(
'0xSafeAddress',
Expand Down
4 changes: 1 addition & 3 deletions packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,9 @@ export class SafeMoneriumClient extends MoneriumClient {
*/
async #createOrder(safeAddress: string, order: SafeMoneriumOrder): Promise<NewOrder> {
return {
kind: OrderKind.redeem,
amount: order.amount,
signature: '0x',
address: safeAddress,
currency: order.currency,
counterpart: order.counterpart,
memo: order.memo,
message: this.#getSendMessage(order),
Expand All @@ -290,7 +288,7 @@ export class SafeMoneriumClient extends MoneriumClient {
#getSendMessage(order: SafeMoneriumOrder): string {
const currentDate = new Date().toISOString()

return `Send ${order.currency.toUpperCase()} ${order.amount} to ${
return `Send EUR ${order.amount} to ${
(order.counterpart.identifier as IBAN).iban
} at ${currentDate}`
}
Expand Down
3 changes: 1 addition & 2 deletions packages/onramp-kit/src/packs/monerium/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OrderMetadata, Fee, OrderState, Currency, Counterpart } from '@monerium/sdk'
import { OrderMetadata, Fee, OrderState, Counterpart } from '@monerium/sdk'
import Safe from '@safe-global/protocol-kit'

export interface MoneriumProviderConfig {
Expand All @@ -18,7 +18,6 @@ export interface MoneriumOpenOptions {

export interface SafeMoneriumOrder {
amount: string
currency: Currency
counterpart: Counterpart
memo: string
}
Expand Down
Loading

0 comments on commit e0761a8

Please sign in to comment.