From 84c0ae69cc849e111724f91fce8f41709aec289b Mon Sep 17 00:00:00 2001 From: Andrew Wahid Date: Sun, 13 Oct 2024 20:08:34 +0300 Subject: [PATCH 1/2] replace rm -rf with rimraf --- .../package.json | 7 +- .../package.json | 7 +- .../package.json | 7 +- .../package.json | 7 +- .../SocialRecovery/package.json | 7 +- .../package.json | 7 +- examples/UsingBundlerRPC/package.json | 7 +- package.json | 7 +- yarn.lock | 138 +++++++++++++++++- 9 files changed, 173 insertions(+), 21 deletions(-) diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransaction/package.json b/examples/SafeAccountExamples/CreateAccountAndSendTransaction/package.json index 0a626a0..52d99df 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransaction/package.json +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransaction/package.json @@ -4,8 +4,8 @@ "description": "create a new account and send a useroperation.", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -14,5 +14,8 @@ "dotenv": "^16.3.1", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransactionMultiSigners/package.json b/examples/SafeAccountExamples/CreateAccountAndSendTransactionMultiSigners/package.json index 0a626a0..52d99df 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransactionMultiSigners/package.json +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransactionMultiSigners/package.json @@ -4,8 +4,8 @@ "description": "create a new account and send a useroperation.", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -14,5 +14,8 @@ "dotenv": "^16.3.1", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/package.json b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/package.json index f7b8136..c58cf61 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/package.json +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/package.json @@ -4,8 +4,8 @@ "description": "create a new account and send a useroperation and pay gas with erc20 token using a paymaster.", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -15,5 +15,8 @@ "ethers": "^6.6.7", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingTokenPaymaster/package.json b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingTokenPaymaster/package.json index f7b8136..c58cf61 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingTokenPaymaster/package.json +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingTokenPaymaster/package.json @@ -4,8 +4,8 @@ "description": "create a new account and send a useroperation and pay gas with erc20 token using a paymaster.", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -15,5 +15,8 @@ "ethers": "^6.6.7", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/SafeAccountExamples/SocialRecovery/package.json b/examples/SafeAccountExamples/SocialRecovery/package.json index 83298cf..2c851d7 100644 --- a/examples/SafeAccountExamples/SocialRecovery/package.json +++ b/examples/SafeAccountExamples/SocialRecovery/package.json @@ -4,8 +4,8 @@ "description": "Add an onchain Guardian using the Social Recovery Module", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -15,5 +15,8 @@ "ethers": "^6.6.7", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/package.json b/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/package.json index 16431b3..beb59f2 100644 --- a/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/package.json +++ b/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/package.json @@ -4,8 +4,8 @@ "description": "create a new account and send a useroperation.", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts" }, @@ -16,5 +16,8 @@ "ethers": "^6.11.0", "typescript": "^5.1.6", "abstractionkit": "^0.2.0" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/examples/UsingBundlerRPC/package.json b/examples/UsingBundlerRPC/package.json index 05546c6..05dffe9 100644 --- a/examples/UsingBundlerRPC/package.json +++ b/examples/UsingBundlerRPC/package.json @@ -4,8 +4,8 @@ "description": "an example for using the toolkit with the a bundler RPC", "main": "dist/index.js", "scripts": { - "build": "rm -rf dist && tsc", - "clean": "rm -rf dist", + "build": "rimraf dist && tsc", + "clean": "rimraf dist", "format": "prettier --write .", "lint": "eslint src/**/*.ts" }, @@ -13,5 +13,8 @@ "dependencies": { "abstractionkit": "^0.1.13", "typescript": "^5.1.6" + }, + "devDependencies": { + "rimraf": "^6.0.1" } } diff --git a/package.json b/package.json index 3a76e64..e1f6775 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "unpkg": "dist/index.umd.js", "types": "dist/index.d.ts", "scripts": { - "build": "rm -rf dist && microbundle --tsconfig tsconfig.json --no-sourcemap", - "clean": "rm -rf dist", + "build": "rimraf dist && microbundle --tsconfig tsconfig.json --no-sourcemap", + "clean": "rimraf dist", "format": "prettier --write src/*.ts src/**/*.ts src/**/**/*.ts", "lint": "eslint -f unix \"src/**/*.{ts,tsx}\"", "test": "jest" @@ -52,7 +52,8 @@ "lint-staged": ">=10", "microbundle": "^0.15.1", "prettier": "3.0.0", - "typescript": "^5.1.6" + "typescript": "^5.1.6", + "rimraf": "^6.0.1" }, "lint-staged": { "*.js": "eslint --cache --fix", diff --git a/yarn.lock b/yarn.lock index f9126d0..c24d690 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1277,6 +1277,18 @@ resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz" integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1982,7 +1994,7 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -ansi-styles@^6.0.0, ansi-styles@^6.2.1: +ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: version "6.2.1" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== @@ -2467,7 +2479,7 @@ create-jest@^29.7.0: jest-util "^29.7.0" prompts "^2.0.1" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -2680,6 +2692,11 @@ duplexer@^0.1.1, duplexer@^0.1.2: resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz" integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + ejs@^3.1.6: version "3.1.9" resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz" @@ -2712,6 +2729,11 @@ emoji-regex@^8.0.0: resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + entities@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" @@ -3119,6 +3141,14 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + fraction.js@^4.3.7: version "4.3.7" resolved "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz" @@ -3232,6 +3262,18 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" +glob@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.0.tgz#6031df0d7b65eaa1ccb9b29b5ced16cea658e77e" + integrity sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g== + dependencies: + foreground-child "^3.1.0" + jackspeak "^4.0.1" + minimatch "^10.0.0" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^2.0.0" + glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" @@ -3708,6 +3750,13 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +jackspeak@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.0.2.tgz#11f9468a3730c6ff6f56823a820d7e3be9bef015" + integrity sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw== + dependencies: + "@isaacs/cliui" "^8.0.2" + jake@^10.8.5: version "10.8.7" resolved "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz" @@ -4282,6 +4331,11 @@ log-update@^6.0.0: strip-ansi "^7.1.0" wrap-ansi "^9.0.0" +lru-cache@^11.0.0: + version "11.0.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.0.1.tgz#3a732fbfedb82c5ba7bca6564ad3f42afcb6e147" + integrity sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -4422,6 +4476,13 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" +minimatch@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b" + integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" @@ -4436,6 +4497,11 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + mri@^1.1.0: version "1.2.0" resolved "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz" @@ -4639,6 +4705,11 @@ p-try@^2.0.0: resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" @@ -4681,6 +4752,14 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" + integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== + dependencies: + lru-cache "^11.0.0" + minipass "^7.1.2" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -5184,6 +5263,14 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rimraf@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e" + integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A== + dependencies: + glob "^11.0.0" + package-json-from-dist "^1.0.0" + rollup-plugin-bundle-size@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/rollup-plugin-bundle-size/-/rollup-plugin-bundle-size-1.0.3.tgz" @@ -5369,7 +5456,7 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.1.0: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -5471,6 +5558,15 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" @@ -5480,6 +5576,15 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string-width@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/string-width/-/string-width-7.0.0.tgz" @@ -5531,6 +5636,13 @@ string.prototype.trimstart@^1.0.7: define-properties "^1.2.0" es-abstract "^1.22.1" +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" @@ -5545,7 +5657,7 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.1.0: +strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== @@ -5908,6 +6020,15 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" @@ -5917,6 +6038,15 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrap-ansi@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz" From 76c753f04f89ea241efe310a135d7cd28b14d21e Mon Sep 17 00:00:00 2001 From: Andrew Wahid Date: Sun, 13 Oct 2024 20:09:36 +0300 Subject: [PATCH 2/2] support sponsorshipPolicyId context --- .../.env.example | 5 ++++- .../src/index.ts | 5 +++-- .../src/index.ts | 3 --- src/paymaster/CandidePaymaster.ts | 17 +++++++++-------- src/paymaster/types.ts | 1 + 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/.env.example b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/.env.example index 1eb3c7e..1a1b35c 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/.env.example +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/.env.example @@ -8,4 +8,7 @@ PUBLIC_ADDRESS= PRIVATE_KEY= #get early access to Candide's Paymaster sponsor policies on our Discord -PAYMASTER_RPC= \ No newline at end of file +PAYMASTER_RPC= + +#Sponsorship policy ID (leave blank if you want to get sponsored by public policies if your userop is eligible) +SPONSORSHIP_POLICY_ID= \ No newline at end of file diff --git a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/src/index.ts b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/src/index.ts index a0774d1..c1aabd3 100644 --- a/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/src/index.ts +++ b/examples/SafeAccountExamples/CreateAccountAndSendTransactionUsingSponsorPaymaster/src/index.ts @@ -18,7 +18,8 @@ async function main(): Promise { const ownerPublicAddress = process.env.PUBLIC_ADDRESS as string const ownerPrivateKey = process.env.PRIVATE_KEY as string const paymasterRPC = process.env.PAYMASTER_RPC as string; - + const sponsorshipPolicyId = process.env.SPONSORSHIP_POLICY_ID as string; + //initializeNewAccount only needed when the smart account //have not been deployed yet for its first useroperation. //You can store the accountAddress to use it to initialize @@ -73,7 +74,7 @@ async function main(): Promise { ) let [paymasterUserOperation, _sponsorMetadata] = await paymaster.createSponsorPaymasterUserOperation( - userOperation, bundlerUrl) + userOperation, bundlerUrl, sponsorshipPolicyId) // sponsorshipPolicyId will have no effect if empty userOperation = paymasterUserOperation; diff --git a/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/src/index.ts b/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/src/index.ts index f7ea40d..ee8fdbc 100644 --- a/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/src/index.ts +++ b/examples/SafeAccountExamples/WebAuthnCreateAccountAndSendTransaction/src/index.ts @@ -107,9 +107,6 @@ async function main(): Promise { let [paymasterUserOperation, _sponsorMetadata] = await paymaster.createSponsorPaymasterUserOperation( userOperation, bundlerUrl, - //{ - // verificationGasLimitPercentageMultiplier:130 - //} ) userOperation = paymasterUserOperation; diff --git a/src/paymaster/CandidePaymaster.ts b/src/paymaster/CandidePaymaster.ts index 007e385..512b63b 100644 --- a/src/paymaster/CandidePaymaster.ts +++ b/src/paymaster/CandidePaymaster.ts @@ -597,32 +597,33 @@ export class CandidePaymaster extends Paymaster { async createSponsorPaymasterUserOperation( userOperation: UserOperationV7, bundlerRpc: string, - overrides?: CreatePaymasterUserOperationOverrides, + sponsorshipPolicyId?: string, ): Promise<[UserOperationV7, SponsorMetadata | undefined]>; async createSponsorPaymasterUserOperation( userOperation: UserOperationV6, bundlerRpc: string, - overrides?: CreatePaymasterUserOperationOverrides, + sponsorshipPolicyId?: string, ): Promise<[UserOperationV6, SponsorMetadata | undefined]>; async createSponsorPaymasterUserOperation( userOperation: UserOperationV7 | UserOperationV6, bundlerRpc: string, - overrides: CreatePaymasterUserOperationOverrides = {}, + sponsorshipPolicyId?: string, ): Promise<[UserOperationV7 | UserOperationV6, SponsorMetadata | undefined]> { - const createPaymasterUserOperationOverrides = overrides; + const context: CandidePaymasterContext = {}; + if (sponsorshipPolicyId && sponsorshipPolicyId.trim().length > 0){ + context["sponsorshipPolicyId"] = sponsorshipPolicyId; + } if ("initCode" in userOperation) { return await this.createPaymasterUserOperation( userOperation as UserOperationV6, bundlerRpc, - {}, - createPaymasterUserOperationOverrides, + context ); } else { return await this.createPaymasterUserOperation( userOperation as UserOperationV7, bundlerRpc, - {}, - createPaymasterUserOperationOverrides, + context ); } } diff --git a/src/paymaster/types.ts b/src/paymaster/types.ts index 4d41edf..cc9716a 100644 --- a/src/paymaster/types.ts +++ b/src/paymaster/types.ts @@ -2,6 +2,7 @@ import type { StateOverrideSet } from "../types"; export interface CandidePaymasterContext { token?: string; + sponsorshipPolicyId?: string; } export interface PrependTokenPaymasterApproveAccount {