@safe-global/protocol-kit 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/LICENSE.md +9 -9
  2. package/README.md +1033 -1015
  3. package/dist/src/Safe.js +8 -4
  4. package/dist/src/Safe.js.map +1 -1
  5. package/dist/src/adapters/ethers/EthersAdapter.d.ts +6 -4
  6. package/dist/src/adapters/ethers/EthersAdapter.js +9 -0
  7. package/dist/src/adapters/ethers/EthersAdapter.js.map +1 -1
  8. package/dist/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerEthersContract.d.ts +4 -3
  9. package/dist/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerEthersContract.js.map +1 -1
  10. package/dist/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Ethers.d.ts +7 -0
  11. package/dist/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Ethers.js +14 -0
  12. package/dist/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Ethers.js.map +1 -0
  13. package/dist/src/adapters/ethers/contracts/CreateCall/CreateCallEthersContract.d.ts +5 -4
  14. package/dist/src/adapters/ethers/contracts/CreateCall/CreateCallEthersContract.js.map +1 -1
  15. package/dist/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Ethers.d.ts +7 -0
  16. package/dist/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Ethers.js +14 -0
  17. package/dist/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Ethers.js.map +1 -0
  18. package/dist/src/adapters/ethers/contracts/MultiSend/MultiSendEthersContract.d.ts +4 -3
  19. package/dist/src/adapters/ethers/contracts/MultiSend/MultiSendEthersContract.js.map +1 -1
  20. package/dist/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.d.ts +7 -0
  21. package/dist/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.js +14 -0
  22. package/dist/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.js.map +1 -0
  23. package/dist/src/adapters/ethers/contracts/MultiSendCallOnly/MultiSendCallOnlyEthersContract.d.ts +4 -3
  24. package/dist/src/adapters/ethers/contracts/MultiSendCallOnly/MultiSendCallOnlyEthersContract.js.map +1 -1
  25. package/dist/src/adapters/ethers/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.d.ts +7 -0
  26. package/dist/src/adapters/ethers/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.js +14 -0
  27. package/dist/src/adapters/ethers/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.js.map +1 -0
  28. package/dist/src/adapters/ethers/contracts/{GnosisSafe/GnosisSafeContractEthers.d.ts → Safe/SafeContractEthers.d.ts} +11 -10
  29. package/dist/src/adapters/ethers/contracts/{GnosisSafe/GnosisSafeContractEthers.js → Safe/SafeContractEthers.js} +5 -4
  30. package/dist/src/adapters/ethers/contracts/Safe/SafeContractEthers.js.map +1 -0
  31. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Ethers.d.ts → Safe/v1.0.0/SafeContract_V1_0_0_Ethers.d.ts} +7 -7
  32. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Ethers.js → Safe/v1.0.0/SafeContract_V1_0_0_Ethers.js} +5 -5
  33. package/dist/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_V1_0_0_Ethers.js.map +1 -0
  34. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Ethers.d.ts → Safe/v1.1.1/SafeContract_V1_1_1_Ethers.d.ts} +7 -7
  35. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Ethers.js → Safe/v1.1.1/SafeContract_V1_1_1_Ethers.js} +5 -5
  36. package/dist/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_V1_1_1_Ethers.js.map +1 -0
  37. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Ethers.d.ts → Safe/v1.2.0/SafeContract_V1_2_0_Ethers.d.ts} +7 -7
  38. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Ethers.js → Safe/v1.2.0/SafeContract_V1_2_0_Ethers.js} +4 -4
  39. package/dist/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_V1_2_0_Ethers.js.map +1 -0
  40. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Ethers.d.ts → Safe/v1.3.0/SafeContract_V1_3_0_Ethers.d.ts} +7 -7
  41. package/dist/src/adapters/ethers/contracts/{GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Ethers.js → Safe/v1.3.0/SafeContract_V1_3_0_Ethers.js} +4 -4
  42. package/dist/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_V1_3_0_Ethers.js.map +1 -0
  43. package/dist/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Ethers.d.ts +12 -0
  44. package/dist/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Ethers.js +33 -0
  45. package/dist/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Ethers.js.map +1 -0
  46. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryEthersContract.d.ts +23 -0
  47. package/dist/src/adapters/ethers/contracts/{GnosisSafeProxyFactory/GnosisSafeProxyFactoryEthersContract.js → SafeProxyFactory/SafeProxyFactoryEthersContract.js} +3 -3
  48. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryEthersContract.js.map +1 -0
  49. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Ethers.d.ts +7 -0
  50. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Ethers.js +14 -0
  51. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Ethers.js.map +1 -0
  52. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Ethers.d.ts +7 -0
  53. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Ethers.js +14 -0
  54. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Ethers.js.map +1 -0
  55. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Ethers.d.ts +7 -0
  56. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Ethers.js +14 -0
  57. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Ethers.js.map +1 -0
  58. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Ethers.d.ts +7 -0
  59. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Ethers.js +14 -0
  60. package/dist/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Ethers.js.map +1 -0
  61. package/dist/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibEthersContract.d.ts +5 -4
  62. package/dist/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibEthersContract.js.map +1 -1
  63. package/dist/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.d.ts +7 -0
  64. package/dist/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.js +14 -0
  65. package/dist/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.js.map +1 -0
  66. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorEthersContract.d.ts +10 -0
  67. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorEthersContract.js +15 -0
  68. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorEthersContract.js.map +1 -0
  69. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Ethers.d.ts +7 -0
  70. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Ethers.js +14 -0
  71. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Ethers.js.map +1 -0
  72. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Ethers.d.ts +7 -0
  73. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Ethers.js +14 -0
  74. package/dist/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Ethers.js.map +1 -0
  75. package/dist/src/adapters/ethers/contracts/contractInstancesEthers.d.ts +24 -14
  76. package/dist/src/adapters/ethers/contracts/contractInstancesEthers.js +74 -21
  77. package/dist/src/adapters/ethers/contracts/contractInstancesEthers.js.map +1 -1
  78. package/dist/src/adapters/ethers/index.d.ts +4 -4
  79. package/dist/src/adapters/ethers/index.js +7 -7
  80. package/dist/src/adapters/ethers/index.js.map +1 -1
  81. package/dist/src/adapters/web3/Web3Adapter.d.ts +6 -4
  82. package/dist/src/adapters/web3/Web3Adapter.js +10 -1
  83. package/dist/src/adapters/web3/Web3Adapter.js.map +1 -1
  84. package/dist/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.d.ts +4 -3
  85. package/dist/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.js.map +1 -1
  86. package/dist/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.d.ts +7 -0
  87. package/dist/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.js +14 -0
  88. package/dist/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.js.map +1 -0
  89. package/dist/src/adapters/web3/contracts/CreateCall/CreateCallWeb3Contract.d.ts +5 -4
  90. package/dist/src/adapters/web3/contracts/CreateCall/CreateCallWeb3Contract.js.map +1 -1
  91. package/dist/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Web3.d.ts +7 -0
  92. package/dist/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Web3.js +14 -0
  93. package/dist/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallEthersContract_V1_4_1_Web3.js.map +1 -0
  94. package/dist/src/adapters/web3/contracts/MultiSend/MultiSendWeb3Contract.d.ts +4 -3
  95. package/dist/src/adapters/web3/contracts/MultiSend/MultiSendWeb3Contract.js.map +1 -1
  96. package/dist/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.d.ts +7 -0
  97. package/dist/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.js +14 -0
  98. package/dist/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.js.map +1 -0
  99. package/dist/src/adapters/web3/contracts/MultiSendCallOnly/MultiSendCallOnlyWeb3Contract.d.ts +4 -3
  100. package/dist/src/adapters/web3/contracts/MultiSendCallOnly/MultiSendCallOnlyWeb3Contract.js.map +1 -1
  101. package/dist/src/adapters/web3/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.d.ts +7 -0
  102. package/dist/src/adapters/web3/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.js +14 -0
  103. package/dist/src/adapters/web3/contracts/MultiSendCallOnly/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.js.map +1 -0
  104. package/dist/src/adapters/web3/contracts/{GnosisSafe/GnosisSafeContractWeb3.d.ts → Safe/SafeContractWeb3.d.ts} +10 -9
  105. package/dist/src/adapters/web3/contracts/{GnosisSafe/GnosisSafeContractWeb3.js → Safe/SafeContractWeb3.js} +3 -3
  106. package/dist/src/adapters/web3/contracts/Safe/SafeContractWeb3.js.map +1 -0
  107. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Web3.d.ts → Safe/v1.0.0/SafeContract_V1_0_0_Web3.d.ts} +7 -7
  108. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Web3.js → Safe/v1.0.0/SafeContract_V1_0_0_Web3.js} +4 -4
  109. package/dist/src/adapters/web3/contracts/Safe/v1.0.0/SafeContract_V1_0_0_Web3.js.map +1 -0
  110. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Web3.d.ts → Safe/v1.1.1/SafeContract_V1_1_1_Web3.d.ts} +7 -7
  111. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Web3.js → Safe/v1.1.1/SafeContract_V1_1_1_Web3.js} +4 -4
  112. package/dist/src/adapters/web3/contracts/Safe/v1.1.1/SafeContract_V1_1_1_Web3.js.map +1 -0
  113. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Web3.d.ts → Safe/v1.2.0/SafeContract_V1_2_0_Web3.d.ts} +7 -7
  114. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Web3.js → Safe/v1.2.0/SafeContract_V1_2_0_Web3.js} +4 -4
  115. package/dist/src/adapters/web3/contracts/Safe/v1.2.0/SafeContract_V1_2_0_Web3.js.map +1 -0
  116. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Web3.d.ts → Safe/v1.3.0/SafeContract_V1_3_0_Web3.d.ts} +7 -7
  117. package/dist/src/adapters/web3/contracts/{GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Web3.js → Safe/v1.3.0/SafeContract_V1_3_0_Web3.js} +4 -4
  118. package/dist/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_V1_3_0_Web3.js.map +1 -0
  119. package/dist/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Web3.d.ts +12 -0
  120. package/dist/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Web3.js +35 -0
  121. package/dist/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_V1_4_1_Web3.js.map +1 -0
  122. package/dist/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryWeb3Contract.d.ts +23 -0
  123. package/dist/src/adapters/web3/contracts/{GnosisSafeProxyFactory/GnosisSafeProxyFactoryWeb3Contract.js → SafeProxyFactory/SafeProxyFactoryWeb3Contract.js} +3 -3
  124. package/dist/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryWeb3Contract.js.map +1 -0
  125. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Web3.d.ts +7 -0
  126. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Web3.js +14 -0
  127. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_V1_0_0_Web3.js.map +1 -0
  128. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Web3.d.ts +7 -0
  129. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Web3.js +14 -0
  130. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_V1_1_1_Web3.js.map +1 -0
  131. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Web3.d.ts +7 -0
  132. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Web3.js +14 -0
  133. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_V1_3_0_Web3.js.map +1 -0
  134. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Web3.d.ts +7 -0
  135. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Web3.js +14 -0
  136. package/dist/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_V1_4_1_Web3.js.map +1 -0
  137. package/dist/src/adapters/web3/contracts/SignMessageLib/SignMessageLibWeb3Contract.d.ts +5 -4
  138. package/dist/src/adapters/web3/contracts/SignMessageLib/SignMessageLibWeb3Contract.js.map +1 -1
  139. package/dist/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.d.ts +7 -0
  140. package/dist/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.js +14 -0
  141. package/dist/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.js.map +1 -0
  142. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorWeb3Contract.d.ts +10 -0
  143. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorWeb3Contract.js +15 -0
  144. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorWeb3Contract.js.map +1 -0
  145. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Web3.d.ts +7 -0
  146. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Web3.js +14 -0
  147. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_V1_3_0_Web3.js.map +1 -0
  148. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Web3.d.ts +7 -0
  149. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Web3.js +14 -0
  150. package/dist/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_V1_4_1_Web3.js.map +1 -0
  151. package/dist/src/adapters/web3/contracts/contractInstancesWeb3.d.ts +37 -17
  152. package/dist/src/adapters/web3/contracts/contractInstancesWeb3.js +51 -17
  153. package/dist/src/adapters/web3/contracts/contractInstancesWeb3.js.map +1 -1
  154. package/dist/src/adapters/web3/index.d.ts +4 -4
  155. package/dist/src/adapters/web3/index.js +7 -7
  156. package/dist/src/adapters/web3/index.js.map +1 -1
  157. package/dist/src/contracts/config.js +11 -1
  158. package/dist/src/contracts/config.js.map +1 -1
  159. package/dist/src/contracts/safeDeploymentContracts.d.ts +5 -3
  160. package/dist/src/contracts/safeDeploymentContracts.js +25 -4
  161. package/dist/src/contracts/safeDeploymentContracts.js.map +1 -1
  162. package/dist/src/contracts/utils.d.ts +5 -4
  163. package/dist/src/contracts/utils.js +27 -10
  164. package/dist/src/contracts/utils.js.map +1 -1
  165. package/dist/src/index.d.ts +6 -5
  166. package/dist/src/index.js +11 -9
  167. package/dist/src/index.js.map +1 -1
  168. package/dist/src/managers/contractManager.d.ts +2 -2
  169. package/dist/src/managers/contractManager.js.map +1 -1
  170. package/dist/src/managers/fallbackHandlerManager.d.ts +2 -2
  171. package/dist/src/managers/fallbackHandlerManager.js.map +1 -1
  172. package/dist/src/managers/guardManager.d.ts +2 -2
  173. package/dist/src/managers/guardManager.js.map +1 -1
  174. package/dist/src/managers/moduleManager.d.ts +2 -2
  175. package/dist/src/managers/moduleManager.js.map +1 -1
  176. package/dist/src/managers/ownerManager.d.ts +2 -2
  177. package/dist/src/managers/ownerManager.js.map +1 -1
  178. package/dist/src/safeFactory/index.d.ts +1 -1
  179. package/dist/src/safeFactory/index.js +7 -7
  180. package/dist/src/safeFactory/index.js.map +1 -1
  181. package/dist/src/types/index.d.ts +14 -8
  182. package/dist/src/utils/eip-3770/config.js +8 -0
  183. package/dist/src/utils/eip-3770/config.js.map +1 -1
  184. package/dist/src/utils/memoized.d.ts +1 -0
  185. package/dist/src/utils/memoized.js +12 -0
  186. package/dist/src/utils/memoized.js.map +1 -0
  187. package/dist/src/utils/transactions/gas.d.ts +4 -2
  188. package/dist/src/utils/transactions/gas.js +56 -1
  189. package/dist/src/utils/transactions/gas.js.map +1 -1
  190. package/dist/src/utils/transactions/utils.d.ts +1 -1
  191. package/dist/src/utils/transactions/utils.js +15 -4
  192. package/dist/src/utils/transactions/utils.js.map +1 -1
  193. package/dist/tsconfig.build.tsbuildinfo +1 -1
  194. package/dist/typechain/src/ethers-v5/v1.3.0/Simulate_tx_accessor.d.ts +63 -0
  195. package/dist/typechain/src/ethers-v5/v1.3.0/Simulate_tx_accessor.js +3 -0
  196. package/dist/typechain/src/ethers-v5/v1.3.0/Simulate_tx_accessor.js.map +1 -0
  197. package/dist/typechain/src/ethers-v5/v1.3.0/factories/Simulate_tx_accessor__factory.d.ts +46 -0
  198. package/dist/typechain/src/ethers-v5/v1.3.0/factories/Simulate_tx_accessor__factory.js +69 -0
  199. package/dist/typechain/src/ethers-v5/v1.3.0/factories/Simulate_tx_accessor__factory.js.map +1 -0
  200. package/dist/typechain/src/ethers-v5/v1.3.0/factories/index.d.ts +1 -0
  201. package/dist/typechain/src/ethers-v5/v1.3.0/factories/index.js +3 -1
  202. package/dist/typechain/src/ethers-v5/v1.3.0/factories/index.js.map +1 -1
  203. package/dist/typechain/src/ethers-v5/v1.3.0/index.d.ts +2 -0
  204. package/dist/typechain/src/ethers-v5/v1.3.0/index.js +3 -1
  205. package/dist/typechain/src/ethers-v5/v1.3.0/index.js.map +1 -1
  206. package/dist/typechain/src/ethers-v5/v1.4.1/Compatibility_fallback_handler.d.ts +162 -0
  207. package/dist/typechain/src/ethers-v5/v1.4.1/Compatibility_fallback_handler.js +3 -0
  208. package/dist/typechain/src/ethers-v5/v1.4.1/Compatibility_fallback_handler.js.map +1 -0
  209. package/dist/typechain/src/ethers-v5/v1.4.1/Create_call.d.ts +83 -0
  210. package/dist/typechain/src/ethers-v5/v1.4.1/Create_call.js +3 -0
  211. package/dist/typechain/src/ethers-v5/v1.4.1/Create_call.js.map +1 -0
  212. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send.d.ts +50 -0
  213. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send.js +3 -0
  214. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send.js.map +1 -0
  215. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send.ts +102 -0
  216. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send_call_only.d.ts +50 -0
  217. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send_call_only.js +3 -0
  218. package/dist/typechain/src/ethers-v5/v1.4.1/Multi_send_call_only.js.map +1 -0
  219. package/dist/typechain/src/ethers-v5/v1.4.1/Safe.d.ts +640 -0
  220. package/dist/typechain/src/ethers-v5/v1.4.1/Safe.js +3 -0
  221. package/dist/typechain/src/ethers-v5/v1.4.1/Safe.js.map +1 -0
  222. package/dist/typechain/src/ethers-v5/v1.4.1/Safe_proxy_factory.d.ts +126 -0
  223. package/dist/typechain/src/ethers-v5/v1.4.1/Safe_proxy_factory.js +3 -0
  224. package/dist/typechain/src/ethers-v5/v1.4.1/Safe_proxy_factory.js.map +1 -0
  225. package/dist/typechain/src/ethers-v5/v1.4.1/Sign_message_lib.d.ts +69 -0
  226. package/dist/typechain/src/ethers-v5/v1.4.1/Sign_message_lib.js +3 -0
  227. package/dist/typechain/src/ethers-v5/v1.4.1/Sign_message_lib.js.map +1 -0
  228. package/dist/typechain/src/ethers-v5/v1.4.1/Simulate_tx_accessor.d.ts +63 -0
  229. package/dist/typechain/src/ethers-v5/v1.4.1/Simulate_tx_accessor.js +3 -0
  230. package/dist/typechain/src/ethers-v5/v1.4.1/Simulate_tx_accessor.js.map +1 -0
  231. package/dist/typechain/src/ethers-v5/v1.4.1/common.d.ts +22 -0
  232. package/dist/typechain/src/ethers-v5/v1.4.1/common.js +3 -0
  233. package/dist/typechain/src/ethers-v5/v1.4.1/common.js.map +1 -0
  234. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Compatibility_fallback_handler__factory.d.ts +252 -0
  235. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Compatibility_fallback_handler__factory.js +341 -0
  236. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Compatibility_fallback_handler__factory.js.map +1 -0
  237. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Create_call__factory.d.ts +58 -0
  238. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Create_call__factory.js +86 -0
  239. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Create_call__factory.js.map +1 -0
  240. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send__factory.d.ts +22 -0
  241. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send__factory.js +38 -0
  242. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send__factory.js.map +1 -0
  243. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send_call_only__factory.d.ts +18 -0
  244. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send_call_only__factory.js +33 -0
  245. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Multi_send_call_only__factory.js.map +1 -0
  246. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe__factory.d.ts +780 -0
  247. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe__factory.js +1017 -0
  248. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe__factory.js.map +1 -0
  249. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe_proxy_factory__factory.d.ts +113 -0
  250. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe_proxy_factory__factory.js +157 -0
  251. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Safe_proxy_factory__factory.js.map +1 -0
  252. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Sign_message_lib__factory.d.ts +42 -0
  253. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Sign_message_lib__factory.js +65 -0
  254. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Sign_message_lib__factory.js.map +1 -0
  255. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Simulate_tx_accessor__factory.d.ts +46 -0
  256. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Simulate_tx_accessor__factory.js +69 -0
  257. package/dist/typechain/src/ethers-v5/v1.4.1/factories/Simulate_tx_accessor__factory.js.map +1 -0
  258. package/dist/typechain/src/ethers-v5/v1.4.1/factories/index.d.ts +8 -0
  259. package/dist/typechain/src/ethers-v5/v1.4.1/factories/index.js +23 -0
  260. package/dist/typechain/src/ethers-v5/v1.4.1/factories/index.js.map +1 -0
  261. package/dist/typechain/src/ethers-v5/v1.4.1/index.d.ts +17 -0
  262. package/dist/typechain/src/ethers-v5/v1.4.1/index.js +44 -0
  263. package/dist/typechain/src/ethers-v5/v1.4.1/index.js.map +1 -0
  264. package/dist/typechain/src/web3-v1/v1.3.0/Simulate_tx_accessor.d.ts +28 -0
  265. package/dist/typechain/src/web3-v1/v1.3.0/Simulate_tx_accessor.js +6 -0
  266. package/dist/typechain/src/web3-v1/v1.3.0/Simulate_tx_accessor.js.map +1 -0
  267. package/dist/typechain/src/web3-v1/v1.3.0/index.d.ts +1 -0
  268. package/dist/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler.d.ts +32 -0
  269. package/dist/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler.js +6 -0
  270. package/dist/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler.js.map +1 -0
  271. package/dist/typechain/src/web3-v1/v1.4.1/Create_call.d.ts +30 -0
  272. package/dist/typechain/src/web3-v1/v1.4.1/Create_call.js +6 -0
  273. package/dist/typechain/src/web3-v1/v1.4.1/Create_call.js.map +1 -0
  274. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send.d.ts +20 -0
  275. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send.js +6 -0
  276. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send.js.map +1 -0
  277. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send.ts +37 -0
  278. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send_call_only.d.ts +20 -0
  279. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send_call_only.js +6 -0
  280. package/dist/typechain/src/web3-v1/v1.4.1/Multi_send_call_only.js.map +1 -0
  281. package/dist/typechain/src/web3-v1/v1.4.1/Safe.d.ts +196 -0
  282. package/dist/typechain/src/web3-v1/v1.4.1/Safe.js +6 -0
  283. package/dist/typechain/src/web3-v1/v1.4.1/Safe.js.map +1 -0
  284. package/dist/typechain/src/web3-v1/v1.4.1/Safe_proxy_factory.d.ts +35 -0
  285. package/dist/typechain/src/web3-v1/v1.4.1/Safe_proxy_factory.js +6 -0
  286. package/dist/typechain/src/web3-v1/v1.4.1/Safe_proxy_factory.js.map +1 -0
  287. package/dist/typechain/src/web3-v1/v1.4.1/Sign_message_lib.d.ts +29 -0
  288. package/dist/typechain/src/web3-v1/v1.4.1/Sign_message_lib.js +6 -0
  289. package/dist/typechain/src/web3-v1/v1.4.1/Sign_message_lib.js.map +1 -0
  290. package/dist/typechain/src/web3-v1/v1.4.1/Simulate_tx_accessor.d.ts +28 -0
  291. package/dist/typechain/src/web3-v1/v1.4.1/Simulate_tx_accessor.js +6 -0
  292. package/dist/typechain/src/web3-v1/v1.4.1/Simulate_tx_accessor.js.map +1 -0
  293. package/dist/typechain/src/web3-v1/v1.4.1/index.d.ts +8 -0
  294. package/dist/typechain/src/web3-v1/v1.4.1/index.js +3 -0
  295. package/dist/typechain/src/web3-v1/v1.4.1/index.js.map +1 -0
  296. package/dist/typechain/src/web3-v1/v1.4.1/types.d.ts +54 -0
  297. package/dist/typechain/src/web3-v1/v1.4.1/types.js +3 -0
  298. package/dist/typechain/src/web3-v1/v1.4.1/types.js.map +1 -0
  299. package/dist/typechain/tests/ethers-v5/v1.4.1/DebugTransactionGuard.d.ts +144 -0
  300. package/dist/typechain/tests/ethers-v5/v1.4.1/DebugTransactionGuard.js +3 -0
  301. package/dist/typechain/tests/ethers-v5/v1.4.1/DebugTransactionGuard.js.map +1 -0
  302. package/dist/typechain/tests/ethers-v5/v1.4.1/common.d.ts +22 -0
  303. package/dist/typechain/tests/ethers-v5/v1.4.1/common.js +3 -0
  304. package/dist/typechain/tests/ethers-v5/v1.4.1/common.js.map +1 -0
  305. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/DebugTransactionGuard__factory.d.ts +201 -0
  306. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/DebugTransactionGuard__factory.js +270 -0
  307. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/DebugTransactionGuard__factory.js.map +1 -0
  308. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/index.d.ts +1 -0
  309. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/index.js +9 -0
  310. package/dist/typechain/tests/ethers-v5/v1.4.1/factories/index.js.map +1 -0
  311. package/dist/typechain/tests/ethers-v5/v1.4.1/index.d.ts +3 -0
  312. package/dist/typechain/tests/ethers-v5/v1.4.1/index.js +30 -0
  313. package/dist/typechain/tests/ethers-v5/v1.4.1/index.js.map +1 -0
  314. package/dist/typechain/tests/web3-v1/v1.4.1/DebugTransactionGuard.d.ts +66 -0
  315. package/dist/typechain/tests/web3-v1/v1.4.1/DebugTransactionGuard.js +6 -0
  316. package/dist/typechain/tests/web3-v1/v1.4.1/DebugTransactionGuard.js.map +1 -0
  317. package/dist/typechain/tests/web3-v1/v1.4.1/index.d.ts +1 -0
  318. package/dist/typechain/tests/web3-v1/v1.4.1/index.js +3 -0
  319. package/dist/typechain/tests/web3-v1/v1.4.1/index.js.map +1 -0
  320. package/dist/typechain/tests/web3-v1/v1.4.1/types.d.ts +54 -0
  321. package/dist/typechain/tests/web3-v1/v1.4.1/types.js +3 -0
  322. package/dist/typechain/tests/web3-v1/v1.4.1/types.js.map +1 -0
  323. package/package.json +96 -91
  324. package/dist/src/adapters/ethers/contracts/GnosisSafe/GnosisSafeContractEthers.js.map +0 -1
  325. package/dist/src/adapters/ethers/contracts/GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Ethers.js.map +0 -1
  326. package/dist/src/adapters/ethers/contracts/GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Ethers.js.map +0 -1
  327. package/dist/src/adapters/ethers/contracts/GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Ethers.js.map +0 -1
  328. package/dist/src/adapters/ethers/contracts/GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Ethers.js.map +0 -1
  329. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/GnosisSafeProxyFactoryEthersContract.d.ts +0 -22
  330. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/GnosisSafeProxyFactoryEthersContract.js.map +0 -1
  331. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Ethers.d.ts +0 -7
  332. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Ethers.js +0 -14
  333. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Ethers.js.map +0 -1
  334. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Ethers.d.ts +0 -7
  335. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Ethers.js +0 -14
  336. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Ethers.js.map +0 -1
  337. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Ethers.d.ts +0 -7
  338. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Ethers.js +0 -14
  339. package/dist/src/adapters/ethers/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Ethers.js.map +0 -1
  340. package/dist/src/adapters/web3/contracts/GnosisSafe/GnosisSafeContractWeb3.js.map +0 -1
  341. package/dist/src/adapters/web3/contracts/GnosisSafe/v1.0.0/GnosisSafeContract_V1_0_0_Web3.js.map +0 -1
  342. package/dist/src/adapters/web3/contracts/GnosisSafe/v1.1.1/GnosisSafeContract_V1_1_1_Web3.js.map +0 -1
  343. package/dist/src/adapters/web3/contracts/GnosisSafe/v1.2.0/GnosisSafeContract_V1_2_0_Web3.js.map +0 -1
  344. package/dist/src/adapters/web3/contracts/GnosisSafe/v1.3.0/GnosisSafeContract_V1_3_0_Web3.js.map +0 -1
  345. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/GnosisSafeProxyFactoryWeb3Contract.d.ts +0 -22
  346. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/GnosisSafeProxyFactoryWeb3Contract.js.map +0 -1
  347. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Web3.d.ts +0 -7
  348. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Web3.js +0 -14
  349. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.0.0/GnosisSafeProxyFactoryContract_V1_0_0_Web3.js.map +0 -1
  350. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Web3.d.ts +0 -7
  351. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Web3.js +0 -14
  352. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.1.1/GnosisSafeProxyFactoryContract_V1_1_1_Web3.js.map +0 -1
  353. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Web3.d.ts +0 -7
  354. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Web3.js +0 -14
  355. package/dist/src/adapters/web3/contracts/GnosisSafeProxyFactory/v1.3.0/GnosisSafeProxyFactoryContract_V1_3_0_Web3.js.map +0 -1
package/README.md CHANGED
@@ -1,1015 +1,1033 @@
1
- # Protocol Kit
2
-
3
- [![NPM Version](https://badge.fury.io/js/%40safe-global%2Fprotocol-kit.svg)](https://badge.fury.io/js/%40safe-global%2Fprotocol-kit)
4
- [![GitHub Release](https://img.shields.io/github/release/safe-global/safe-core-sdk.svg?style=flat)](https://github.com/safe-global/safe-core-sdk/releases)
5
- [![GitHub](https://img.shields.io/github/license/safe-global/safe-core-sdk)](https://github.com/safe-global/safe-core-sdk/blob/main/LICENSE.md)
6
-
7
- Software development kit that facilitates the interaction with the [Safe contracts](https://github.com/safe-global/safe-contracts).
8
-
9
- ## Table of contents
10
-
11
- - [Installation](#installation)
12
- - [Build](#build)
13
- - [Getting Started](#getting-started)
14
- - [Safe Factory API Reference](#factory-api)
15
- - [Safe Core SDK API Reference](#sdk-api)
16
- - [License](#license)
17
- - [Contributors](#contributors)
18
-
19
- ## <a name="installation">Installation</a>
20
-
21
- Install the package with yarn or npm:
22
-
23
- ```bash
24
- yarn install
25
- npm install
26
- ```
27
-
28
- ## <a name="build">Build</a>
29
-
30
- Build the package with yarn or npm:
31
-
32
- ```bash
33
- yarn build
34
- npm build
35
- ```
36
-
37
- ## <a name="getting-started">Getting Started</a>
38
-
39
- The following steps show how to set up the Protocol Kit, deploy a new Safe, create a Safe transaction, generate the required signatures from owners and execute the transaction. However, using the Protocol Kit alone will not allow for the collection of owner signatures off-chain. To do this and be able to see and confirm the pending transactions shown in the [Safe Web App](https://app.safe.global/), it is recommended that you follow this other [guide](/guides/integrating-the-safe-core-sdk.md) that covers the use of the Protocol Kit, combined with the API Kit.
40
-
41
- ### 1. Instantiate an EthAdapter
42
-
43
- First of all, we need to create an `EthAdapter`, which contains all the required utilities for the SDKs to interact with the blockchain. It acts as a wrapper for [web3.js](https://web3js.readthedocs.io/) or [ethers.js](https://docs.ethers.io/v5/) Ethereum libraries.
44
-
45
- Depending on the library used by the Dapp, there are two options:
46
-
47
- - [Create an `EthersAdapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/ethers)
48
- - [Create a `Web3Adapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/web3)
49
-
50
- Once the instance of `EthersAdapter` or `Web3Adapter` is created, it can be used in the SDK initialization.
51
-
52
- ### 2. Deploy a new Safe
53
-
54
- To deploy a new Safe account instantiate the `SafeFactory` class and call the `deploySafe` method with the right params to configure the new Safe. This includes defining the list of owners and the threshold of the Safe. A Safe account with three owners and threshold equal three will be used as the starting point for this example but any Safe configuration is valid.
55
-
56
- ```js
57
- import Safe, { SafeFactory, SafeAccountConfig } from '@safe-global/protocol-kit'
58
-
59
- const safeFactory = await SafeFactory.create({ ethAdapter })
60
-
61
- const owners = ['0x<address>', '0x<address>', '0x<address>']
62
- const threshold = 3
63
- const safeAccountConfig: SafeAccountConfig = {
64
- owners,
65
- threshold
66
- // ...
67
- }
68
-
69
- const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig })
70
- ```
71
-
72
- The `deploySafe` method executes a transaction from the `owner1` account, deploys a new Safe and returns an instance of the Protocol Kit connected to the new Safe. Check the `deploySafe` method in the [API Reference](#factory-api) for more details on additional configuration parameters and callbacks.
73
-
74
- Call the `getAddress` method, for example, to check the address of the newly deployed Safe.
75
-
76
- ```js
77
- const newSafeAddress = await safeSdk.getAddress()
78
- ```
79
-
80
- To instantiate the Protocol Kit from an existing Safe just pass to it an instance of the `EthAdapter` class and the Safe address.
81
-
82
- ```js
83
- import Safe from '@safe-global/protocol-kit'
84
-
85
- const safeSdk: Safe = await Safe.create({ ethAdapter: ethAdapterOwner1, safeAddress })
86
- ```
87
-
88
- Check the `create` method in the [API Reference](#sdk-api) for more details on additional configuration parameters.
89
-
90
- ### 3. Create a Safe transaction
91
-
92
- ```js
93
- import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
94
-
95
- const safeTransactionData: SafeTransactionDataPartial = {
96
- to: '0x<address>',
97
- value: '<eth_value_in_wei>',
98
- data: '0x<data>'
99
- }
100
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
101
- ```
102
-
103
- Check the `createTransaction` method in the [API Reference](#sdk-api) for additional details on creating MultiSend transactions.
104
-
105
- Before executing this transaction, it must be signed by the owners and this can be done off-chain or on-chain. In this example `owner1` will sign it off-chain, `owner2` will sign it on-chain and `owner3` will execute it (the executor also signs the transaction transparently).
106
-
107
- ### 3.a. Off-chain signatures
108
-
109
- The `owner1` account signs the transaction off-chain.
110
-
111
- ```js
112
- const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction)
113
- ```
114
-
115
- Because the signature is off-chain, there is no interaction with the contract and the signature becomes available at `signedSafeTransaction.signatures`.
116
-
117
- ### 3.b. On-chain signatures
118
-
119
- To connect `owner2` to the Safe we need to create a new instance of the class `EthAdapter` passing to its constructor the owner we would like to connect. After `owner2` account is connected to the SDK as a signer the transaction hash will be approved on-chain.
120
-
121
- ```js
122
- const ethAdapterOwner2 = new EthersAdapter({ ethers, signerOrProvider: owner2 })
123
- const safeSdk2 = await safeSdk.connect({ ethAdapter: ethAdapterOwner2, safeAddress })
124
- const txHash = await safeSdk2.getTransactionHash(safeTransaction)
125
- const approveTxResponse = await safeSdk2.approveTransactionHash(txHash)
126
- await approveTxResponse.transactionResponse?.wait()
127
- ```
128
-
129
- ### 4. Transaction execution
130
-
131
- Lastly, `owner3` account is connected to the SDK as a signer and executor of the Safe transaction to execute it.
132
-
133
- ```js
134
- const ethAdapterOwner3 = new EthersAdapter({ ethers, signerOrProvider: owner3 })
135
- const safeSdk3 = await safeSdk2.connect({ ethAdapter: ethAdapterOwner3, safeAddress })
136
- const executeTxResponse = await safeSdk3.executeTransaction(safeTransaction)
137
- await executeTxResponse.transactionResponse?.wait()
138
- ```
139
-
140
- All the signatures used to execute the transaction are now available at `safeTransaction.signatures`.
141
-
142
- ## <a name="factory-api">Safe Factory API Reference</a>
143
-
144
- ### create
145
-
146
- Returns an instance of the Safe Factory.
147
-
148
- ```js
149
- import { SafeFactory } from '@safe-global/protocol-kit'
150
-
151
- const safeFactory = await SafeFactory.create({ ethAdapter })
152
- ```
153
-
154
- - The `isL1SafeMasterCopy` flag
155
-
156
- There are two versions of the Safe contracts: [GnosisSafe.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafe.sol) that does not trigger events in order to save gas and [GnosisSafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafeL2.sol) that does, which is more appropriate for L2 networks.
157
-
158
- By default `GnosisSafe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `GnosisSafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `GnosisSafe.sol` contract.
159
-
160
- ```js
161
- const safeFactory = await SafeFactory.create({ ethAdapter, isL1SafeMasterCopy: true })
162
- ```
163
-
164
- - The `contractNetworks` property
165
-
166
- If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
167
-
168
- ```js
169
- import { ContractNetworksConfig } from '@safe-global/protocol-kit'
170
-
171
- const chainId = await ethAdapter.getChainId()
172
- const contractNetworks: ContractNetworksConfig = {
173
- [chainId]: {
174
- safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
175
- safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
176
- multiSendAddress: '<MULTI_SEND_ADDRESS>',
177
- multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
178
- fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
179
- signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
180
- createCallAddress: '<CREATE_CALL_ADDRESS>',
181
- safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
182
- safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
183
- multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
184
- multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
185
- fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
186
- signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
187
- createCallAbi: '<CREATE_CALL_ABI>' // Optional. Only needed with web3.js
188
- }
189
- }
190
-
191
- const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks })
192
- ```
193
-
194
- - The `safeVersion` property
195
-
196
- The `SafeFactory` constructor also accepts the `safeVersion` property to specify the Safe contract version that will be deployed. This string can take the values `1.0.0`, `1.1.1`, `1.2.0` or `1.3.0`. If not specified, the most recent contract version will be used by default.
197
-
198
- ```js
199
- const safeVersion = 'X.Y.Z'
200
- const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion })
201
- ```
202
-
203
- ### deploySafe
204
-
205
- Deploys a new Safe and returns an instance of the Protocol Kit connected to the deployed Safe. The address of the Master Copy, Safe contract version and the contract (`GnosisSafe.sol` or `GnosisSafeL2.sol`) of the deployed Safe will depend on the initialization of the `safeFactory` instance.
206
-
207
- ```js
208
- const safeAccountConfig: SafeAccountConfig = {
209
- owners,
210
- threshold,
211
- to, // Optional
212
- data, // Optional
213
- fallbackHandler, // Optional
214
- paymentToken, // Optional
215
- payment, // Optional
216
- paymentReceiver // Optional
217
- }
218
-
219
- const safeSdk = await safeFactory.deploySafe({ safeAccountConfig })
220
- ```
221
-
222
- This method can optionally receive the `saltNonce` parameter.
223
-
224
- ```js
225
- const safeAccountConfig: SafeAccountConfig = {
226
- owners,
227
- threshold,
228
- to, // Optional
229
- data, // Optional
230
- fallbackHandler, // Optional
231
- paymentToken, // Optional
232
- payment, // Optional
233
- paymentReceiver // Optional
234
- }
235
-
236
- const saltNonce = '<YOUR_CUSTOM_VALUE>'
237
-
238
- const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, saltNonce })
239
- ```
240
-
241
- Optionally, some properties can be passed as execution options:
242
-
243
- ```js
244
- const options: Web3TransactionOptions = {
245
- from, // Optional
246
- gas, // Optional
247
- gasPrice, // Optional
248
- maxFeePerGas, // Optional
249
- maxPriorityFeePerGas // Optional
250
- nonce // Optional
251
- }
252
- ```
253
-
254
- ```js
255
- const options: EthersTransactionOptions = {
256
- from, // Optional
257
- gasLimit, // Optional
258
- gasPrice, // Optional
259
- maxFeePerGas, // Optional
260
- maxPriorityFeePerGas // Optional
261
- nonce // Optional
262
- }
263
- ```
264
-
265
- ```js
266
- const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, safeDeploymentConfig, options })
267
- ```
268
-
269
- It can also take an optional callback which receives the `txHash` of the Safe deployment transaction prior to returning a new instance of the Protocol Kit:
270
-
271
- ```js
272
- const callback = (txHash: string): void => {
273
- console.log({ txHash })
274
- }
275
-
276
- const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, callback })
277
- ```
278
-
279
- ## <a name="sdk-api">Safe Core SDK API Reference</a>
280
-
281
- ### create
282
-
283
- Returns an instance of the Protocol Kit connected to a Safe. The provided Safe must be a `safeAddress` or a `predictedSafe`.
284
-
285
- Initialization of a deployed Safe using the `safeAddress` property:
286
-
287
- ```js
288
- import Safe from '@safe-global/protocol-kit'
289
-
290
- const safeSdk = await Safe.create({ ethAdapter, safeAddress })
291
- ```
292
-
293
- Initialization of a not deployed Safe using the `predictedSafe` property. Because Safes are deployed in a deterministic way, passing a `predictedSafe` will allow to initialize the SDK with the Safe configuration and use it to some extent before it is deployed:
294
-
295
- ```js
296
- import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit'
297
-
298
- const predictedSafe: PredictedSafeProps = {
299
- safeAccountConfig,
300
- safeDeploymentConfig
301
- }
302
-
303
- const safeSdk = await Safe.create({ ethAdapter, predictedSafe })
304
- ```
305
-
306
- - The `isL1SafeMasterCopy` flag
307
-
308
- There are two versions of the Safe contracts: [GnosisSafe.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafe.sol) that does not trigger events in order to save gas and [GnosisSafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafeL2.sol) that does, which is more appropriate for L2 networks.
309
-
310
- By default `GnosisSafe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `GnosisSafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `GnosisSafe.sol` contract.
311
-
312
- ```js
313
- const safeSdk = await Safe.create({ ethAdapter, safeAddress, isL1SafeMasterCopy: true })
314
- ```
315
-
316
- - The `contractNetworks` property
317
-
318
- If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
319
-
320
- ```js
321
- import { ContractNetworksConfig } from '@safe-global/protocol-kit'
322
-
323
- const chainId = await ethAdapter.getChainId()
324
- const contractNetworks: ContractNetworksConfig = {
325
- [chainId]: {
326
- safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
327
- safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
328
- multiSendAddress: '<MULTI_SEND_ADDRESS>',
329
- multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
330
- fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
331
- signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
332
- createCallAddress: '<CREATE_CALL_ADDRESS>',
333
- safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
334
- safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
335
- multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
336
- multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
337
- fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
338
- signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
339
- createCallAbi: '<CREATE_CALL_ABI>' // Optional. Only needed with web3.js
340
- }
341
- }
342
-
343
- const safeSdk = await Safe.create({ ethAdapter, safeAddress, contractNetworks })
344
- ```
345
-
346
- ### connect
347
-
348
- Returns a new instance of the Protocol Kit connected to a new Safe or a new Signer. The new connected signer can be passed via the `ethAdapter` property while the new connected Safe can be passed using a `safeAddress` or a `predictedSafe`.
349
-
350
- Connection of a deployed Safe using the `safeAddress` property:
351
-
352
- ```js
353
- const safeSdk = await safeSdk.connect({ ethAdapter, safeAddress })
354
- ```
355
-
356
- Connection of a not deployed Safe using the `predictedSafe` property. Because Safes are deployed in a deterministic way, passing a `predictedSafe` will allow to connect a Safe to the SDK with the Safe configuration:
357
-
358
- ```js
359
- import { PredictedSafeProps } from '@safe-global/protocol-kit'
360
-
361
- const predictedSafe: PredictedSafeProps = {
362
- safeAccountConfig,
363
- safeDeploymentConfig
364
- }
365
-
366
- const safeSdk = await safeSdk.connect({ ethAdapter, predictedSafe })
367
- ```
368
-
369
- - The `isL1SafeMasterCopy` flag
370
-
371
- There are two versions of the Safe contracts: [GnosisSafe.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafe.sol) that does not trigger events in order to save gas and [GnosisSafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.3.0/contracts/GnosisSafeL2.sol) that does, which is more appropriate for L2 networks.
372
-
373
- By default `GnosisSafe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `GnosisSafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `GnosisSafe.sol` contract.
374
-
375
- ```js
376
- const safeSdk = await Safe.connect({ ethAdapter, safeAddress, isL1SafeMasterCopy: true })
377
- ```
378
-
379
- - The `contractNetworks` property
380
-
381
- If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
382
-
383
- ```js
384
- import { ContractNetworksConfig } from '@safe-global/protocol-kit'
385
-
386
- const chainId = await ethAdapter.getChainId()
387
- const contractNetworks: ContractNetworksConfig = {
388
- [chainId]: {
389
- safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
390
- safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
391
- multiSendAddress: '<MULTI_SEND_ADDRESS>',
392
- multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
393
- fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
394
- signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
395
- createCallAddress: '<CREATE_CALL_ADDRESS>',
396
- safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
397
- safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
398
- multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
399
- multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
400
- fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
401
- signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
402
- createCallAbi: '<CREATE_CALL_ABI>' // Optional. Only needed with web3.js
403
- }
404
- }
405
- const safeSdk = await Safe.connect({ ethAdapter, safeAddress, contractNetworks })
406
- ```
407
-
408
- ### getAddress
409
-
410
- Returns the address of the current SafeProxy contract.
411
-
412
- ```js
413
- const safeAddress = await safeSdk.getAddress()
414
- ```
415
-
416
- ### getContractVersion
417
-
418
- Returns the Safe Master Copy contract version.
419
-
420
- ```js
421
- const contractVersion = await safeSdk.getContractVersion()
422
- ```
423
-
424
- ### getOwners
425
-
426
- Returns the list of Safe owner accounts.
427
-
428
- ```js
429
- const ownerAddresses = await safeSdk.getOwners()
430
- ```
431
-
432
- ### getNonce
433
-
434
- Returns the Safe nonce.
435
-
436
- ```js
437
- const nonce = await safeSdk.getNonce()
438
- ```
439
-
440
- ### getThreshold
441
-
442
- Returns the Safe threshold.
443
-
444
- ```js
445
- const threshold = await safeSdk.getThreshold()
446
- ```
447
-
448
- ### getChainId
449
-
450
- Returns the chainId of the connected network.
451
-
452
- ```js
453
- const chainId = await safeSdk.getChainId()
454
- ```
455
-
456
- ### getBalance
457
-
458
- Returns the ETH balance of the Safe.
459
-
460
- ```js
461
- const balance = await safeSdk.getBalance()
462
- ```
463
-
464
- ### getGuard
465
-
466
- Returns the enabled Safe guard or 0x address if no guards are enabled.
467
-
468
- ```js
469
- const guardAddress = await safeSdk.getGuard()
470
- ```
471
-
472
- ### getModules
473
-
474
- Returns the list of addresses of all the enabled Safe modules.
475
-
476
- ```js
477
- const moduleAddresses = await safeSdk.getModules()
478
- ```
479
-
480
- ### isModuleEnabled
481
-
482
- Checks if a specific Safe module is enabled for the current Safe.
483
-
484
- ```js
485
- const isEnabled = await safeSdk.isModuleEnabled(moduleAddress)
486
- ```
487
-
488
- ### isOwner
489
-
490
- Checks if a specific address is an owner of the current Safe.
491
-
492
- ```js
493
- const isOwner = await safeSdk.isOwner(address)
494
- ```
495
-
496
- ### createTransaction
497
-
498
- Returns a Safe transaction ready to be signed by the owners and executed. The Protocol Kit supports the creation of single Safe transactions but also MultiSend transactions.
499
-
500
- - **Single transactions**
501
-
502
- This method can take an object of type `SafeTransactionDataPartial` that represents the transaction we want to execute (once the signatures are collected). It accepts some optional properties as follows.
503
-
504
- ```js
505
- import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
506
-
507
- const safeTransactionData: SafeTransactionDataPartial = {
508
- to,
509
- data,
510
- value,
511
- operation, // Optional
512
- safeTxGas, // Optional
513
- baseGas, // Optional
514
- gasPrice, // Optional
515
- gasToken, // Optional
516
- refundReceiver, // Optional
517
- nonce // Optional
518
- }
519
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
520
- ```
521
-
522
- - **MultiSend transactions**
523
-
524
- This method can take an array of `MetaTransactionData` objects that represent the multiple transactions we want to include in our MultiSend transaction. If we want to specify some of the optional properties in our MultiSend transaction, we can pass a second argument to the `createTransaction` method with the `SafeTransactionOptionalProps` object.
525
-
526
- ```js
527
- const safeTransactionData: MetaTransactionData[] = [
528
- {
529
- to,
530
- data,
531
- value,
532
- operation // Optional
533
- },
534
- {
535
- to,
536
- data,
537
- value,
538
- operation // Optional
539
- }
540
- // ...
541
- ]
542
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
543
- ```
544
-
545
- This method can also receive the `options` parameter to set the optional properties in the MultiSend transaction:
546
-
547
- ```js
548
- const safeTransactionData: MetaTransactionData[] = [
549
- {
550
- to,
551
- data,
552
- value,
553
- operation // Optional
554
- },
555
- {
556
- to,
557
- data,
558
- value,
559
- operation // Optional
560
- }
561
- // ...
562
- ]
563
- const options: SafeTransactionOptionalProps = {
564
- safeTxGas, // Optional
565
- baseGas, // Optional
566
- gasPrice, // Optional
567
- gasToken, // Optional
568
- refundReceiver, // Optional
569
- nonce // Optional
570
- }
571
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData, options })
572
- ```
573
-
574
- In addition, the optional `callsOnly` parameter, which is `false` by default, allows to force the use of the `MultiSendCallOnly` instead of the `MultiSend` contract when sending a batch transaction:
575
-
576
- ```js
577
- const callsOnly = true
578
- const safeTransaction = await safeSdk.createTransaction({
579
- safeTransactionData,
580
- options,
581
- callsOnly
582
- })
583
- ```
584
-
585
- If the optional properties are not manually set, the Safe transaction returned will have the default value for each one:
586
-
587
- - `operation`: `OperationType.Call` (0) is the default value.
588
- - `safeTxGas`: The right gas estimation is the default value.
589
- - `baseGas`: 0 is the default value.
590
- - `gasPrice`: 0 is the default value.
591
- - `gasToken`: 0x address is the default value.
592
- - `refundReceiver`: 0x address is the default value.
593
- - `nonce`: The current Safe nonce is the default value.
594
-
595
- Read more about [create transactions from a Safe](https://docs.safe.global/learn/safe-core-account-abstraction-sdk/protocol-kit#making-a-transaction-from-a-safe).
596
-
597
- ### createRejectionTransaction
598
-
599
- Returns a Safe transaction ready to be signed by the owners that invalidates the pending Safe transaction/s with a specific nonce.
600
-
601
- ```js
602
- const safeTransactionData: SafeTransactionDataPartial = {
603
- // ...
604
- }
605
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
606
- const rejectionTransaction = await safeSdk.createRejectionTransaction(safeTransaction.data.nonce)
607
- ```
608
-
609
- ### copyTransaction
610
-
611
- Copies a Safe transaction.
612
-
613
- ```js
614
- const safeTransaction1 = await safeSdk.createTransaction({ safeTransactionData })
615
- const safeTransaction2 = await copyTransaction(safeTransaction1)
616
- ```
617
-
618
- ### getTransactionHash
619
-
620
- Returns the transaction hash of a Safe transaction.
621
-
622
- ```js
623
- const safeTransactionData: SafeTransactionDataPartial = {
624
- // ...
625
- }
626
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
627
- const txHash = await safeSdk.getTransactionHash(safeTransaction)
628
- ```
629
-
630
- ### signTransactionHash
631
-
632
- Signs a hash using the current owner account.
633
-
634
- ```js
635
- const safeTransactionData: SafeTransactionDataPartial = {
636
- // ...
637
- }
638
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
639
- const txHash = await safeSdk.getTransactionHash(safeTransaction)
640
- const signature = await safeSdk.signTransactionHash(txHash)
641
- ```
642
-
643
- ### signTypedData
644
-
645
- Signs a transaction according to the EIP-712 using the current signer account.
646
-
647
- ```js
648
- const safeTransactionData: SafeTransactionDataPartial = {
649
- // ...
650
- }
651
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
652
- const signature = await safeSdk.signTypedData(safeTransaction)
653
- ```
654
-
655
- ### signTransaction
656
-
657
- Returns a new `SafeTransaction` object that includes the signature of the current owner. `eth_sign` will be used by default to generate the signature.
658
-
659
- ```js
660
- const safeTransactionData: SafeTransactionDataPartial = {
661
- // ...
662
- }
663
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
664
- const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction)
665
- ```
666
-
667
- Optionally, an additional parameter can be passed to specify a different way of signing:
668
-
669
- ```js
670
- const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction, 'eth_signTypedData')
671
- ```
672
-
673
- ```js
674
- const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction, 'eth_sign') // default option.
675
- ```
676
-
677
- ### approveTransactionHash
678
-
679
- Approves a hash on-chain using the current owner account.
680
-
681
- ```js
682
- const safeTransactionData: SafeTransactionDataPartial = {
683
- // ...
684
- }
685
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
686
- const txHash = await safeSdk.getTransactionHash(safeTransaction)
687
- const txResponse = await safeSdk.approveTransactionHash(txHash)
688
- await txResponse.transactionResponse?.wait()
689
- ```
690
-
691
- Optionally, some properties can be passed as execution options:
692
-
693
- ```js
694
- const options: Web3TransactionOptions = {
695
- from, // Optional
696
- gas, // Optional
697
- gasPrice, // Optional
698
- maxFeePerGas, // Optional
699
- maxPriorityFeePerGas // Optional
700
- nonce // Optional
701
- }
702
- ```
703
-
704
- ```js
705
- const options: EthersTransactionOptions = {
706
- from, // Optional
707
- gasLimit, // Optional
708
- gasPrice, // Optional
709
- maxFeePerGas, // Optional
710
- maxPriorityFeePerGas // Optional
711
- nonce // Optional
712
- }
713
- ```
714
-
715
- ```js
716
- const txResponse = await safeSdk.approveTransactionHash(txHash, options)
717
- ```
718
-
719
- ### getOwnersWhoApprovedTx
720
-
721
- Returns a list of owners who have approved a specific Safe transaction.
722
-
723
- ```js
724
- const safeTransactionData: SafeTransactionDataPartial = {
725
- // ...
726
- }
727
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
728
- const txHash = await safeSdk.getTransactionHash(safeTransaction)
729
- const ownerAddresses = await safeSdk.getOwnersWhoApprovedTx(txHash)
730
- ```
731
-
732
- ### createEnableFallbackHandlerTx
733
-
734
- Returns the Safe transaction to enable the fallback handler.
735
-
736
- ```js
737
- const safeTransaction = await safeSdk.createEnableFallbackHandlerTx(fallbackHandlerAddress)
738
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
739
- await txResponse.transactionResponse?.wait()
740
- ```
741
-
742
- This method can optionally receive the `options` parameter:
743
-
744
- ```js
745
- const options: SafeTransactionOptionalProps = {
746
- safeTxGas, // Optional
747
- baseGas, // Optional
748
- gasPrice, // Optional
749
- gasToken, // Optional
750
- refundReceiver, // Optional
751
- nonce // Optional
752
- }
753
- const safeTransaction = await safeSdk.createEnableFallbackHandlerTx(fallbackHandlerAddress, options)
754
- ```
755
-
756
- ### createDisableFallbackHandlerTx
757
-
758
- Returns the Safe transaction to disable the fallback handler.
759
-
760
- ```js
761
- const safeTransaction = await safeSdk.createDisableFallbackHandlerTx()
762
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
763
- await txResponse.transactionResponse?.wait()
764
- ```
765
-
766
- This method can optionally receive the `options` parameter:
767
-
768
- ```js
769
- const options: SafeTransactionOptionalProps = { ... }
770
- const safeTransaction = await safeSdk.createDisableFallbackHandlerTx(options)
771
- ```
772
-
773
- ### createEnableGuardTx
774
-
775
- Returns the Safe transaction to enable a Safe guard.
776
-
777
- ```js
778
- const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress)
779
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
780
- await txResponse.transactionResponse?.wait()
781
- ```
782
-
783
- This method can optionally receive the `options` parameter:
784
-
785
- ```js
786
- const options: SafeTransactionOptionalProps = {
787
- safeTxGas, // Optional
788
- baseGas, // Optional
789
- gasPrice, // Optional
790
- gasToken, // Optional
791
- refundReceiver, // Optional
792
- nonce // Optional
793
- }
794
- const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress, options)
795
- ```
796
-
797
- ### createDisableGuardTx
798
-
799
- Returns the Safe transaction to disable a Safe guard.
800
-
801
- ```js
802
- const safeTransaction = await safeSdk.createDisableGuardTx()
803
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
804
- await txResponse.transactionResponse?.wait()
805
- ```
806
-
807
- This method can optionally receive the `options` parameter:
808
-
809
- ```js
810
- const options: SafeTransactionOptionalProps = { ... }
811
- const safeTransaction = await safeSdk.createDisableGuardTx(options)
812
- ```
813
-
814
- ### createEnableModuleTx
815
-
816
- Returns a Safe transaction ready to be signed that will enable a Safe module.
817
-
818
- ```js
819
- const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress)
820
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
821
- await txResponse.transactionResponse?.wait()
822
- ```
823
-
824
- This method can optionally receive the `options` parameter:
825
-
826
- ```js
827
- const options: SafeTransactionOptionalProps = { ... }
828
- const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress, options)
829
- ```
830
-
831
- ### createDisableModuleTx
832
-
833
- Returns a Safe transaction ready to be signed that will disable a Safe module.
834
-
835
- ```js
836
- const safeTransaction = await safeSdk.createDisableModuleTx(moduleAddress)
837
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
838
- await txResponse.transactionResponse?.wait()
839
- ```
840
-
841
- This method can optionally receive the `options` parameter:
842
-
843
- ```js
844
- const options: SafeTransactionOptionalProps = { ... }
845
- const safeTransaction = await safeSdk.createDisableModuleTx(moduleAddress, options)
846
- ```
847
-
848
- ### createAddOwnerTx
849
-
850
- Returns the Safe transaction to add an owner and optionally change the threshold.
851
-
852
- ```js
853
- const params: AddOwnerTxParams = {
854
- ownerAddress,
855
- threshold // Optional. If `threshold` is not provided the current threshold will not change.
856
- }
857
- const safeTransaction = await safeSdk.createAddOwnerTx(params)
858
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
859
- await txResponse.transactionResponse?.wait()
860
- ```
861
-
862
- This method can optionally receive the `options` parameter:
863
-
864
- ```js
865
- const options: SafeTransactionOptionalProps = { ... }
866
- const safeTransaction = await safeSdk.createAddOwnerTx(params, options)
867
- ```
868
-
869
- ### createRemoveOwnerTx
870
-
871
- Returns the Safe transaction to remove an owner and optionally change the threshold.
872
-
873
- ```js
874
- const params: RemoveOwnerTxParams = {
875
- ownerAddress,
876
- newThreshold // Optional. If `newThreshold` is not provided, the current threshold will be decreased by one.
877
- }
878
- const safeTransaction = await safeSdk.createRemoveOwnerTx(params)
879
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
880
- await txResponse.transactionResponse?.wait()
881
- ```
882
-
883
- This method can optionally receive the `options` parameter:
884
-
885
- ```js
886
- const options: SafeTransactionOptionalProps = { ... }
887
- const safeTransaction = await safeSdk.createRemoveOwnerTx(params, options)
888
- ```
889
-
890
- ### createSwapOwnerTx
891
-
892
- Returns the Safe transaction to replace an owner of the Safe with a new one.
893
-
894
- ```js
895
- const params: SwapOwnerTxParams = {
896
- oldOwnerAddress,
897
- newOwnerAddress
898
- }
899
- const safeTransaction = await safeSdk.createSwapOwnerTx(params)
900
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
901
- await txResponse.transactionResponse?.wait()
902
- ```
903
-
904
- This method can optionally receive the `options` parameter:
905
-
906
- ```js
907
- const options: SafeTransactionOptionalProps = { ... }
908
- const safeTransaction = await safeSdk.createSwapOwnerTx(params, options)
909
- ```
910
-
911
- ### createChangeThresholdTx
912
-
913
- Returns the Safe transaction to change the threshold.
914
-
915
- ```js
916
- const safeTransaction = await safeSdk.createChangeThresholdTx(newThreshold)
917
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
918
- await txResponse.transactionResponse?.wait()
919
- ```
920
-
921
- This method can optionally receive the `options` parameter:
922
-
923
- ```js
924
- const options: SafeTransactionOptionalProps = { ... }
925
- const safeTransaction = await safeSdk.createChangeThresholdTx(newThreshold, options)
926
- ```
927
-
928
- ### isValidTransaction
929
-
930
- Checks if a Safe transaction can be executed successfully with no errors.
931
-
932
- ```js
933
- const safeTransactionData: SafeTransactionDataPartial = {
934
- // ...
935
- }
936
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
937
- const isValidTx = await safeSdk.isValidTransaction(safeTransaction)
938
- ```
939
-
940
- Optionally, some properties can be passed as execution options:
941
-
942
- ```js
943
- const options: Web3TransactionOptions = {
944
- from, // Optional
945
- gas, // Optional
946
- gasPrice, // Optional
947
- maxFeePerGas, // Optional
948
- maxPriorityFeePerGas // Optional
949
- nonce // Optional
950
- }
951
- ```
952
-
953
- ```js
954
- const options: EthersTransactionOptions = {
955
- from, // Optional
956
- gasLimit, // Optional
957
- gasPrice, // Optional
958
- maxFeePerGas, // Optional
959
- maxPriorityFeePerGas // Optional
960
- nonce // Optional
961
- }
962
- ```
963
-
964
- ```js
965
- const isValidTx = await safeSdk.isValidTransaction(safeTransaction, options)
966
- ```
967
-
968
- ### executeTransaction
969
-
970
- Executes a Safe transaction.
971
-
972
- ```js
973
- const safeTransactionData: SafeTransactionDataPartial = {
974
- // ...
975
- }
976
- const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
977
- const txResponse = await safeSdk.executeTransaction(safeTransaction)
978
- await txResponse.transactionResponse?.wait()
979
- ```
980
-
981
- Optionally, some properties can be passed as execution options:
982
-
983
- ```js
984
- const options: Web3TransactionOptions = {
985
- from, // Optional
986
- gas, // Optional
987
- gasPrice, // Optional
988
- maxFeePerGas, // Optional
989
- maxPriorityFeePerGas // Optional
990
- nonce // Optional
991
- }
992
- ```
993
-
994
- ```js
995
- const options: EthersTransactionOptions = {
996
- from, // Optional
997
- gasLimit, // Optional
998
- gasPrice, // Optional
999
- maxFeePerGas, // Optional
1000
- maxPriorityFeePerGas // Optional
1001
- nonce // Optional
1002
- }
1003
- ```
1004
-
1005
- ```js
1006
- const txResponse = await safeSdk.executeTransaction(safeTransaction, options)
1007
- ```
1008
-
1009
- ## <a name="license">License</a>
1010
-
1011
- This library is released under MIT.
1012
-
1013
- ## <a name="contributors">Contributors</a>
1014
-
1015
- - Germán Martínez ([germartinez](https://github.com/germartinez))
1
+ # Protocol Kit
2
+
3
+ [![NPM Version](https://badge.fury.io/js/%40safe-global%2Fprotocol-kit.svg)](https://badge.fury.io/js/%40safe-global%2Fprotocol-kit)
4
+ [![GitHub Release](https://img.shields.io/github/release/safe-global/safe-core-sdk.svg?style=flat)](https://github.com/safe-global/safe-core-sdk/releases)
5
+ [![GitHub](https://img.shields.io/github/license/safe-global/safe-core-sdk)](https://github.com/safe-global/safe-core-sdk/blob/main/LICENSE.md)
6
+
7
+ Software development kit that facilitates the interaction with the [Safe contracts](https://github.com/safe-global/safe-contracts).
8
+
9
+ ## Table of contents
10
+
11
+ - [Installation](#installation)
12
+ - [Build](#build)
13
+ - [Tests](#tests)
14
+ - [Getting Started](#getting-started)
15
+ - [Safe Factory API Reference](#factory-api)
16
+ - [Safe Core SDK API Reference](#sdk-api)
17
+ - [License](#license)
18
+ - [Contributors](#contributors)
19
+
20
+ ## <a name="installation">Installation</a>
21
+
22
+ Install the package with yarn or npm:
23
+
24
+ ```bash
25
+ yarn add @safe-global/protocol-kit
26
+ npm install @safe-global/protocol-kit
27
+ ```
28
+
29
+ ## <a name="build">Build</a>
30
+
31
+ Build the package with yarn or npm:
32
+
33
+ ```bash
34
+ yarn build
35
+ npm run build
36
+ ```
37
+
38
+ ## <a name="tests">Tests</a>
39
+
40
+ Create a `.env` file with environment variables. You can use the `.env.example` file as a reference.
41
+
42
+ Test the package with yarn or npm:
43
+
44
+ ```bash
45
+ yarn test
46
+ npm run test
47
+ ```
48
+
49
+ ## <a name="getting-started">Getting Started</a>
50
+
51
+ The following steps show how to set up the Protocol Kit, deploy a new Safe, create a Safe transaction, generate the required signatures from owners and execute the transaction. However, using the Protocol Kit alone will not allow for the collection of owner signatures off-chain. To do this and be able to see and confirm the pending transactions shown in the [Safe Web App](https://app.safe.global/), it is recommended that you follow this other [guide](/guides/integrating-the-safe-core-sdk.md) that covers the use of the Protocol Kit, combined with the API Kit.
52
+
53
+ ### 1. Instantiate an EthAdapter
54
+
55
+ First of all, we need to create an `EthAdapter`, which contains all the required utilities for the SDKs to interact with the blockchain. It acts as a wrapper for [web3.js](https://web3js.readthedocs.io/) or [ethers.js](https://docs.ethers.io/v5/) Ethereum libraries.
56
+
57
+ Depending on the library used by the Dapp, there are two options:
58
+
59
+ - [Create an `EthersAdapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/ethers)
60
+ - [Create a `Web3Adapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/web3)
61
+
62
+ Once the instance of `EthersAdapter` or `Web3Adapter` is created, it can be used in the SDK initialization.
63
+
64
+ ### 2. Deploy a new Safe
65
+
66
+ To deploy a new Safe account instantiate the `SafeFactory` class and call the `deploySafe` method with the right params to configure the new Safe. This includes defining the list of owners and the threshold of the Safe. A Safe account with three owners and threshold equal three will be used as the starting point for this example but any Safe configuration is valid.
67
+
68
+ ```js
69
+ import Safe, { SafeFactory, SafeAccountConfig } from '@safe-global/protocol-kit'
70
+
71
+ const safeFactory = await SafeFactory.create({ ethAdapter })
72
+
73
+ const owners = ['0x<address>', '0x<address>', '0x<address>']
74
+ const threshold = 3
75
+ const safeAccountConfig: SafeAccountConfig = {
76
+ owners,
77
+ threshold
78
+ // ...
79
+ }
80
+
81
+ const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig })
82
+ ```
83
+
84
+ The `deploySafe` method executes a transaction from the `owner1` account, deploys a new Safe and returns an instance of the Protocol Kit connected to the new Safe. Check the `deploySafe` method in the [API Reference](#factory-api) for more details on additional configuration parameters and callbacks.
85
+
86
+ Call the `getAddress` method, for example, to check the address of the newly deployed Safe.
87
+
88
+ ```js
89
+ const newSafeAddress = await safeSdk.getAddress()
90
+ ```
91
+
92
+ To instantiate the Protocol Kit from an existing Safe just pass to it an instance of the `EthAdapter` class and the Safe address.
93
+
94
+ ```js
95
+ import Safe from '@safe-global/protocol-kit'
96
+
97
+ const safeSdk: Safe = await Safe.create({ ethAdapter: ethAdapterOwner1, safeAddress })
98
+ ```
99
+
100
+ Check the `create` method in the [API Reference](#sdk-api) for more details on additional configuration parameters.
101
+
102
+ ### 3. Create a Safe transaction
103
+
104
+ ```js
105
+ import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
106
+
107
+ const safeTransactionData: SafeTransactionDataPartial = {
108
+ to: '0x<address>',
109
+ value: '<eth_value_in_wei>',
110
+ data: '0x<data>'
111
+ }
112
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
113
+ ```
114
+
115
+ Check the `createTransaction` method in the [API Reference](#sdk-api) for additional details on creating MultiSend transactions.
116
+
117
+ Before executing this transaction, it must be signed by the owners and this can be done off-chain or on-chain. In this example `owner1` will sign it off-chain, `owner2` will sign it on-chain and `owner3` will execute it (the executor also signs the transaction transparently).
118
+
119
+ ### 3.a. Off-chain signatures
120
+
121
+ The `owner1` account signs the transaction off-chain.
122
+
123
+ ```js
124
+ const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction)
125
+ ```
126
+
127
+ Because the signature is off-chain, there is no interaction with the contract and the signature becomes available at `signedSafeTransaction.signatures`.
128
+
129
+ ### 3.b. On-chain signatures
130
+
131
+ To connect `owner2` to the Safe we need to create a new instance of the class `EthAdapter` passing to its constructor the owner we would like to connect. After `owner2` account is connected to the SDK as a signer the transaction hash will be approved on-chain.
132
+
133
+ ```js
134
+ const ethAdapterOwner2 = new EthersAdapter({ ethers, signerOrProvider: owner2 })
135
+ const safeSdk2 = await safeSdk.connect({ ethAdapter: ethAdapterOwner2, safeAddress })
136
+ const txHash = await safeSdk2.getTransactionHash(safeTransaction)
137
+ const approveTxResponse = await safeSdk2.approveTransactionHash(txHash)
138
+ await approveTxResponse.transactionResponse?.wait()
139
+ ```
140
+
141
+ ### 4. Transaction execution
142
+
143
+ Lastly, `owner3` account is connected to the SDK as a signer and executor of the Safe transaction to execute it.
144
+
145
+ ```js
146
+ const ethAdapterOwner3 = new EthersAdapter({ ethers, signerOrProvider: owner3 })
147
+ const safeSdk3 = await safeSdk2.connect({ ethAdapter: ethAdapterOwner3, safeAddress })
148
+ const executeTxResponse = await safeSdk3.executeTransaction(safeTransaction)
149
+ await executeTxResponse.transactionResponse?.wait()
150
+ ```
151
+
152
+ All the signatures used to execute the transaction are now available at `safeTransaction.signatures`.
153
+
154
+ ## <a name="factory-api">Safe Factory API Reference</a>
155
+
156
+ ### create
157
+
158
+ Returns an instance of the Safe Factory.
159
+
160
+ ```js
161
+ import { SafeFactory } from '@safe-global/protocol-kit'
162
+
163
+ const safeFactory = await SafeFactory.create({ ethAdapter })
164
+ ```
165
+
166
+ - The `isL1SafeMasterCopy` flag
167
+
168
+ There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that does not trigger events in order to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks.
169
+
170
+ By default `Safe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `SafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `Safe.sol` contract.
171
+
172
+ ```js
173
+ const safeFactory = await SafeFactory.create({ ethAdapter, isL1SafeMasterCopy: true })
174
+ ```
175
+
176
+ - The `contractNetworks` property
177
+
178
+ If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
179
+
180
+ ```js
181
+ import { ContractNetworksConfig } from '@safe-global/protocol-kit'
182
+
183
+ const chainId = await ethAdapter.getChainId()
184
+ const contractNetworks: ContractNetworksConfig = {
185
+ [chainId]: {
186
+ safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
187
+ safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
188
+ multiSendAddress: '<MULTI_SEND_ADDRESS>',
189
+ multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
190
+ fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
191
+ signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
192
+ createCallAddress: '<CREATE_CALL_ADDRESS>',
193
+ simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
194
+ safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
195
+ safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
196
+ multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
197
+ multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
198
+ fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
199
+ signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
200
+ createCallAbi: '<CREATE_CALL_ABI>', // Optional. Only needed with web3.js
201
+ simulateTxAccessorAbi: '<SIMULATE_TX_ACCESSOR_ABI>' // Optional. Only needed with web3.js
202
+ }
203
+ }
204
+
205
+ const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks })
206
+ ```
207
+
208
+ - The `safeVersion` property
209
+
210
+ The `SafeFactory` constructor also accepts the `safeVersion` property to specify the Safe contract version that will be deployed. This string can take the values `1.0.0`, `1.1.1`, `1.2.0`, `1.3.0` or `1.4.1`. If not specified, the most recent contract version will be used by default.
211
+
212
+ ```js
213
+ const safeVersion = 'X.Y.Z'
214
+ const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion })
215
+ ```
216
+
217
+ ### deploySafe
218
+
219
+ Deploys a new Safe and returns an instance of the Protocol Kit connected to the deployed Safe. The address of the Master Copy, Safe contract version and the contract (`Safe.sol` or `SafeL2.sol`) of the deployed Safe will depend on the initialization of the `safeFactory` instance.
220
+
221
+ ```js
222
+ const safeAccountConfig: SafeAccountConfig = {
223
+ owners,
224
+ threshold,
225
+ to, // Optional
226
+ data, // Optional
227
+ fallbackHandler, // Optional
228
+ paymentToken, // Optional
229
+ payment, // Optional
230
+ paymentReceiver // Optional
231
+ }
232
+
233
+ const safeSdk = await safeFactory.deploySafe({ safeAccountConfig })
234
+ ```
235
+
236
+ This method can optionally receive the `saltNonce` parameter.
237
+
238
+ ```js
239
+ const safeAccountConfig: SafeAccountConfig = {
240
+ owners,
241
+ threshold,
242
+ to, // Optional
243
+ data, // Optional
244
+ fallbackHandler, // Optional
245
+ paymentToken, // Optional
246
+ payment, // Optional
247
+ paymentReceiver // Optional
248
+ }
249
+
250
+ const saltNonce = '<YOUR_CUSTOM_VALUE>'
251
+
252
+ const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, saltNonce })
253
+ ```
254
+
255
+ Optionally, some properties can be passed as execution options:
256
+
257
+ ```js
258
+ const options: Web3TransactionOptions = {
259
+ from, // Optional
260
+ gas, // Optional
261
+ gasPrice, // Optional
262
+ maxFeePerGas, // Optional
263
+ maxPriorityFeePerGas // Optional
264
+ nonce // Optional
265
+ }
266
+ ```
267
+
268
+ ```js
269
+ const options: EthersTransactionOptions = {
270
+ from, // Optional
271
+ gasLimit, // Optional
272
+ gasPrice, // Optional
273
+ maxFeePerGas, // Optional
274
+ maxPriorityFeePerGas // Optional
275
+ nonce // Optional
276
+ }
277
+ ```
278
+
279
+ ```js
280
+ const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, safeDeploymentConfig, options })
281
+ ```
282
+
283
+ It can also take an optional callback which receives the `txHash` of the Safe deployment transaction prior to returning a new instance of the Protocol Kit:
284
+
285
+ ```js
286
+ const callback = (txHash: string): void => {
287
+ console.log({ txHash })
288
+ }
289
+
290
+ const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, callback })
291
+ ```
292
+
293
+ ## <a name="sdk-api">Safe Core SDK API Reference</a>
294
+
295
+ ### create
296
+
297
+ Returns an instance of the Protocol Kit connected to a Safe. The provided Safe must be a `safeAddress` or a `predictedSafe`.
298
+
299
+ Initialization of a deployed Safe using the `safeAddress` property:
300
+
301
+ ```js
302
+ import Safe from '@safe-global/protocol-kit'
303
+
304
+ const safeSdk = await Safe.create({ ethAdapter, safeAddress })
305
+ ```
306
+
307
+ Initialization of a not deployed Safe using the `predictedSafe` property. Because Safes are deployed in a deterministic way, passing a `predictedSafe` will allow to initialize the SDK with the Safe configuration and use it to some extent before it is deployed:
308
+
309
+ ```js
310
+ import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit'
311
+
312
+ const predictedSafe: PredictedSafeProps = {
313
+ safeAccountConfig,
314
+ safeDeploymentConfig
315
+ }
316
+
317
+ const safeSdk = await Safe.create({ ethAdapter, predictedSafe })
318
+ ```
319
+
320
+ - The `isL1SafeMasterCopy` flag
321
+
322
+ There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that does not trigger events in order to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks.
323
+
324
+ By default `Safe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `SafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `Safe.sol` contract.
325
+
326
+ ```js
327
+ const safeSdk = await Safe.create({ ethAdapter, safeAddress, isL1SafeMasterCopy: true })
328
+ ```
329
+
330
+ - The `contractNetworks` property
331
+
332
+ If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
333
+
334
+ ```js
335
+ import { ContractNetworksConfig } from '@safe-global/protocol-kit'
336
+
337
+ const chainId = await ethAdapter.getChainId()
338
+ const contractNetworks: ContractNetworksConfig = {
339
+ [chainId]: {
340
+ safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
341
+ safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
342
+ multiSendAddress: '<MULTI_SEND_ADDRESS>',
343
+ multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
344
+ fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
345
+ signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
346
+ createCallAddress: '<CREATE_CALL_ADDRESS>',
347
+ simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
348
+ safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
349
+ safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
350
+ multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
351
+ multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
352
+ fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
353
+ signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
354
+ createCallAbi: '<CREATE_CALL_ABI>', // Optional. Only needed with web3.js
355
+ simulateTxAccessorAbi: '<SIMULATE_TX_ACCESSOR_ABI>' // Optional. Only needed with web3.js
356
+ }
357
+ }
358
+
359
+ const safeSdk = await Safe.create({ ethAdapter, safeAddress, contractNetworks })
360
+ ```
361
+
362
+ ### connect
363
+
364
+ Returns a new instance of the Protocol Kit connected to a new Safe or a new Signer. The new connected signer can be passed via the `ethAdapter` property while the new connected Safe can be passed using a `safeAddress` or a `predictedSafe`.
365
+
366
+ Connection of a deployed Safe using the `safeAddress` property:
367
+
368
+ ```js
369
+ const safeSdk = await safeSdk.connect({ ethAdapter, safeAddress })
370
+ ```
371
+
372
+ Connection of a not deployed Safe using the `predictedSafe` property. Because Safes are deployed in a deterministic way, passing a `predictedSafe` will allow to connect a Safe to the SDK with the Safe configuration:
373
+
374
+ ```js
375
+ import { PredictedSafeProps } from '@safe-global/protocol-kit'
376
+
377
+ const predictedSafe: PredictedSafeProps = {
378
+ safeAccountConfig,
379
+ safeDeploymentConfig
380
+ }
381
+
382
+ const safeSdk = await safeSdk.connect({ ethAdapter, predictedSafe })
383
+ ```
384
+
385
+ - The `isL1SafeMasterCopy` flag
386
+
387
+ There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that does not trigger events in order to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks.
388
+
389
+ By default `Safe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `SafeL2.sol` contract will be used unless you add the `isL1SafeMasterCopy` flag to force the use of the `Safe.sol` contract.
390
+
391
+ ```js
392
+ const safeSdk = await Safe.connect({ ethAdapter, safeAddress, isL1SafeMasterCopy: true })
393
+ ```
394
+
395
+ - The `contractNetworks` property
396
+
397
+ If the Safe contracts are not deployed to your current network, the `contractNetworks` property will be required to point to the addresses of the Safe contracts previously deployed by you.
398
+
399
+ ```js
400
+ import { ContractNetworksConfig } from '@safe-global/protocol-kit'
401
+
402
+ const chainId = await ethAdapter.getChainId()
403
+ const contractNetworks: ContractNetworksConfig = {
404
+ [chainId]: {
405
+ safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
406
+ safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>',
407
+ multiSendAddress: '<MULTI_SEND_ADDRESS>',
408
+ multiSendCallOnlyAddress: '<MULTI_SEND_CALL_ONLY_ADDRESS>',
409
+ fallbackHandlerAddress: '<FALLBACK_HANDLER_ADDRESS>',
410
+ signMessageLibAddress: '<SIGN_MESSAGE_LIB_ADDRESS>',
411
+ createCallAddress: '<CREATE_CALL_ADDRESS>',
412
+ simulateTxAccessorAddress: '<SIMULATE_TX_ACCESSOR_ADDRESS>',
413
+ safeMasterCopyAbi: '<MASTER_COPY_ABI>', // Optional. Only needed with web3.js
414
+ safeProxyFactoryAbi: '<PROXY_FACTORY_ABI>', // Optional. Only needed with web3.js
415
+ multiSendAbi: '<MULTI_SEND_ABI>', // Optional. Only needed with web3.js
416
+ multiSendCallOnlyAbi: '<MULTI_SEND_CALL_ONLY_ABI>', // Optional. Only needed with web3.js
417
+ fallbackHandlerAbi: '<FALLBACK_HANDLER_ABI>', // Optional. Only needed with web3.js
418
+ signMessageLibAbi: '<SIGN_MESSAGE_LIB_ABI>', // Optional. Only needed with web3.js
419
+ createCallAbi: '<CREATE_CALL_ABI>', // Optional. Only needed with web3.js
420
+ simulateTxAccessorAbi: '<SIMULATE_TX_ACCESSOR_ABI>' // Optional. Only needed with web3.js
421
+ }
422
+ }
423
+ const safeSdk = await Safe.connect({ ethAdapter, safeAddress, contractNetworks })
424
+ ```
425
+
426
+ ### getAddress
427
+
428
+ Returns the address of the current SafeProxy contract.
429
+
430
+ ```js
431
+ const safeAddress = await safeSdk.getAddress()
432
+ ```
433
+
434
+ ### getContractVersion
435
+
436
+ Returns the Safe Master Copy contract version.
437
+
438
+ ```js
439
+ const contractVersion = await safeSdk.getContractVersion()
440
+ ```
441
+
442
+ ### getOwners
443
+
444
+ Returns the list of Safe owner accounts.
445
+
446
+ ```js
447
+ const ownerAddresses = await safeSdk.getOwners()
448
+ ```
449
+
450
+ ### getNonce
451
+
452
+ Returns the Safe nonce.
453
+
454
+ ```js
455
+ const nonce = await safeSdk.getNonce()
456
+ ```
457
+
458
+ ### getThreshold
459
+
460
+ Returns the Safe threshold.
461
+
462
+ ```js
463
+ const threshold = await safeSdk.getThreshold()
464
+ ```
465
+
466
+ ### getChainId
467
+
468
+ Returns the chainId of the connected network.
469
+
470
+ ```js
471
+ const chainId = await safeSdk.getChainId()
472
+ ```
473
+
474
+ ### getBalance
475
+
476
+ Returns the ETH balance of the Safe.
477
+
478
+ ```js
479
+ const balance = await safeSdk.getBalance()
480
+ ```
481
+
482
+ ### getGuard
483
+
484
+ Returns the enabled Safe guard or 0x address if no guards are enabled.
485
+
486
+ ```js
487
+ const guardAddress = await safeSdk.getGuard()
488
+ ```
489
+
490
+ ### getModules
491
+
492
+ Returns the list of addresses of all the enabled Safe modules.
493
+
494
+ ```js
495
+ const moduleAddresses = await safeSdk.getModules()
496
+ ```
497
+
498
+ ### isModuleEnabled
499
+
500
+ Checks if a specific Safe module is enabled for the current Safe.
501
+
502
+ ```js
503
+ const isEnabled = await safeSdk.isModuleEnabled(moduleAddress)
504
+ ```
505
+
506
+ ### isOwner
507
+
508
+ Checks if a specific address is an owner of the current Safe.
509
+
510
+ ```js
511
+ const isOwner = await safeSdk.isOwner(address)
512
+ ```
513
+
514
+ ### createTransaction
515
+
516
+ Returns a Safe transaction ready to be signed by the owners and executed. The Protocol Kit supports the creation of single Safe transactions but also MultiSend transactions.
517
+
518
+ - **Single transactions**
519
+
520
+ This method can take an object of type `SafeTransactionDataPartial` that represents the transaction we want to execute (once the signatures are collected). It accepts some optional properties as follows.
521
+
522
+ ```js
523
+ import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types'
524
+
525
+ const safeTransactionData: SafeTransactionDataPartial = {
526
+ to,
527
+ data,
528
+ value,
529
+ operation, // Optional
530
+ safeTxGas, // Optional
531
+ baseGas, // Optional
532
+ gasPrice, // Optional
533
+ gasToken, // Optional
534
+ refundReceiver, // Optional
535
+ nonce // Optional
536
+ }
537
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
538
+ ```
539
+
540
+ - **MultiSend transactions**
541
+
542
+ This method can take an array of `MetaTransactionData` objects that represent the multiple transactions we want to include in our MultiSend transaction. If we want to specify some of the optional properties in our MultiSend transaction, we can pass a second argument to the `createTransaction` method with the `SafeTransactionOptionalProps` object.
543
+
544
+ ```js
545
+ const safeTransactionData: MetaTransactionData[] = [
546
+ {
547
+ to,
548
+ data,
549
+ value,
550
+ operation // Optional
551
+ },
552
+ {
553
+ to,
554
+ data,
555
+ value,
556
+ operation // Optional
557
+ }
558
+ // ...
559
+ ]
560
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
561
+ ```
562
+
563
+ This method can also receive the `options` parameter to set the optional properties in the MultiSend transaction:
564
+
565
+ ```js
566
+ const safeTransactionData: MetaTransactionData[] = [
567
+ {
568
+ to,
569
+ data,
570
+ value,
571
+ operation // Optional
572
+ },
573
+ {
574
+ to,
575
+ data,
576
+ value,
577
+ operation // Optional
578
+ }
579
+ // ...
580
+ ]
581
+ const options: SafeTransactionOptionalProps = {
582
+ safeTxGas, // Optional
583
+ baseGas, // Optional
584
+ gasPrice, // Optional
585
+ gasToken, // Optional
586
+ refundReceiver, // Optional
587
+ nonce // Optional
588
+ }
589
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData, options })
590
+ ```
591
+
592
+ In addition, the optional `callsOnly` parameter, which is `false` by default, allows to force the use of the `MultiSendCallOnly` instead of the `MultiSend` contract when sending a batch transaction:
593
+
594
+ ```js
595
+ const callsOnly = true
596
+ const safeTransaction = await safeSdk.createTransaction({
597
+ safeTransactionData,
598
+ options,
599
+ callsOnly
600
+ })
601
+ ```
602
+
603
+ If the optional properties are not manually set, the Safe transaction returned will have the default value for each one:
604
+
605
+ - `operation`: `OperationType.Call` (0) is the default value.
606
+ - `safeTxGas`: The right gas estimation is the default value.
607
+ - `baseGas`: 0 is the default value.
608
+ - `gasPrice`: 0 is the default value.
609
+ - `gasToken`: 0x address is the default value.
610
+ - `refundReceiver`: 0x address is the default value.
611
+ - `nonce`: The current Safe nonce is the default value.
612
+
613
+ Read more about [create transactions from a Safe](https://docs.safe.global/learn/safe-core-account-abstraction-sdk/protocol-kit#making-a-transaction-from-a-safe).
614
+
615
+ ### createRejectionTransaction
616
+
617
+ Returns a Safe transaction ready to be signed by the owners that invalidates the pending Safe transaction/s with a specific nonce.
618
+
619
+ ```js
620
+ const safeTransactionData: SafeTransactionDataPartial = {
621
+ // ...
622
+ }
623
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
624
+ const rejectionTransaction = await safeSdk.createRejectionTransaction(safeTransaction.data.nonce)
625
+ ```
626
+
627
+ ### copyTransaction
628
+
629
+ Copies a Safe transaction.
630
+
631
+ ```js
632
+ const safeTransaction1 = await safeSdk.createTransaction({ safeTransactionData })
633
+ const safeTransaction2 = await copyTransaction(safeTransaction1)
634
+ ```
635
+
636
+ ### getTransactionHash
637
+
638
+ Returns the transaction hash of a Safe transaction.
639
+
640
+ ```js
641
+ const safeTransactionData: SafeTransactionDataPartial = {
642
+ // ...
643
+ }
644
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
645
+ const txHash = await safeSdk.getTransactionHash(safeTransaction)
646
+ ```
647
+
648
+ ### signTransactionHash
649
+
650
+ Signs a hash using the current owner account.
651
+
652
+ ```js
653
+ const safeTransactionData: SafeTransactionDataPartial = {
654
+ // ...
655
+ }
656
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
657
+ const txHash = await safeSdk.getTransactionHash(safeTransaction)
658
+ const signature = await safeSdk.signTransactionHash(txHash)
659
+ ```
660
+
661
+ ### signTypedData
662
+
663
+ Signs a transaction according to the EIP-712 using the current signer account.
664
+
665
+ ```js
666
+ const safeTransactionData: SafeTransactionDataPartial = {
667
+ // ...
668
+ }
669
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
670
+ const signature = await safeSdk.signTypedData(safeTransaction)
671
+ ```
672
+
673
+ ### signTransaction
674
+
675
+ Returns a new `SafeTransaction` object that includes the signature of the current owner. `eth_sign` will be used by default to generate the signature.
676
+
677
+ ```js
678
+ const safeTransactionData: SafeTransactionDataPartial = {
679
+ // ...
680
+ }
681
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
682
+ const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction)
683
+ ```
684
+
685
+ Optionally, an additional parameter can be passed to specify a different way of signing:
686
+
687
+ ```js
688
+ const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction, 'eth_signTypedData')
689
+ ```
690
+
691
+ ```js
692
+ const signedSafeTransaction = await safeSdk.signTransaction(safeTransaction, 'eth_sign') // default option.
693
+ ```
694
+
695
+ ### approveTransactionHash
696
+
697
+ Approves a hash on-chain using the current owner account.
698
+
699
+ ```js
700
+ const safeTransactionData: SafeTransactionDataPartial = {
701
+ // ...
702
+ }
703
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
704
+ const txHash = await safeSdk.getTransactionHash(safeTransaction)
705
+ const txResponse = await safeSdk.approveTransactionHash(txHash)
706
+ await txResponse.transactionResponse?.wait()
707
+ ```
708
+
709
+ Optionally, some properties can be passed as execution options:
710
+
711
+ ```js
712
+ const options: Web3TransactionOptions = {
713
+ from, // Optional
714
+ gas, // Optional
715
+ gasPrice, // Optional
716
+ maxFeePerGas, // Optional
717
+ maxPriorityFeePerGas // Optional
718
+ nonce // Optional
719
+ }
720
+ ```
721
+
722
+ ```js
723
+ const options: EthersTransactionOptions = {
724
+ from, // Optional
725
+ gasLimit, // Optional
726
+ gasPrice, // Optional
727
+ maxFeePerGas, // Optional
728
+ maxPriorityFeePerGas // Optional
729
+ nonce // Optional
730
+ }
731
+ ```
732
+
733
+ ```js
734
+ const txResponse = await safeSdk.approveTransactionHash(txHash, options)
735
+ ```
736
+
737
+ ### getOwnersWhoApprovedTx
738
+
739
+ Returns a list of owners who have approved a specific Safe transaction.
740
+
741
+ ```js
742
+ const safeTransactionData: SafeTransactionDataPartial = {
743
+ // ...
744
+ }
745
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
746
+ const txHash = await safeSdk.getTransactionHash(safeTransaction)
747
+ const ownerAddresses = await safeSdk.getOwnersWhoApprovedTx(txHash)
748
+ ```
749
+
750
+ ### createEnableFallbackHandlerTx
751
+
752
+ Returns the Safe transaction to enable the fallback handler.
753
+
754
+ ```js
755
+ const safeTransaction = await safeSdk.createEnableFallbackHandlerTx(fallbackHandlerAddress)
756
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
757
+ await txResponse.transactionResponse?.wait()
758
+ ```
759
+
760
+ This method can optionally receive the `options` parameter:
761
+
762
+ ```js
763
+ const options: SafeTransactionOptionalProps = {
764
+ safeTxGas, // Optional
765
+ baseGas, // Optional
766
+ gasPrice, // Optional
767
+ gasToken, // Optional
768
+ refundReceiver, // Optional
769
+ nonce // Optional
770
+ }
771
+ const safeTransaction = await safeSdk.createEnableFallbackHandlerTx(fallbackHandlerAddress, options)
772
+ ```
773
+
774
+ ### createDisableFallbackHandlerTx
775
+
776
+ Returns the Safe transaction to disable the fallback handler.
777
+
778
+ ```js
779
+ const safeTransaction = await safeSdk.createDisableFallbackHandlerTx()
780
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
781
+ await txResponse.transactionResponse?.wait()
782
+ ```
783
+
784
+ This method can optionally receive the `options` parameter:
785
+
786
+ ```js
787
+ const options: SafeTransactionOptionalProps = { ... }
788
+ const safeTransaction = await safeSdk.createDisableFallbackHandlerTx(options)
789
+ ```
790
+
791
+ ### createEnableGuardTx
792
+
793
+ Returns the Safe transaction to enable a Safe guard.
794
+
795
+ ```js
796
+ const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress)
797
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
798
+ await txResponse.transactionResponse?.wait()
799
+ ```
800
+
801
+ This method can optionally receive the `options` parameter:
802
+
803
+ ```js
804
+ const options: SafeTransactionOptionalProps = {
805
+ safeTxGas, // Optional
806
+ baseGas, // Optional
807
+ gasPrice, // Optional
808
+ gasToken, // Optional
809
+ refundReceiver, // Optional
810
+ nonce // Optional
811
+ }
812
+ const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress, options)
813
+ ```
814
+
815
+ ### createDisableGuardTx
816
+
817
+ Returns the Safe transaction to disable a Safe guard.
818
+
819
+ ```js
820
+ const safeTransaction = await safeSdk.createDisableGuardTx()
821
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
822
+ await txResponse.transactionResponse?.wait()
823
+ ```
824
+
825
+ This method can optionally receive the `options` parameter:
826
+
827
+ ```js
828
+ const options: SafeTransactionOptionalProps = { ... }
829
+ const safeTransaction = await safeSdk.createDisableGuardTx(options)
830
+ ```
831
+
832
+ ### createEnableModuleTx
833
+
834
+ Returns a Safe transaction ready to be signed that will enable a Safe module.
835
+
836
+ ```js
837
+ const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress)
838
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
839
+ await txResponse.transactionResponse?.wait()
840
+ ```
841
+
842
+ This method can optionally receive the `options` parameter:
843
+
844
+ ```js
845
+ const options: SafeTransactionOptionalProps = { ... }
846
+ const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress, options)
847
+ ```
848
+
849
+ ### createDisableModuleTx
850
+
851
+ Returns a Safe transaction ready to be signed that will disable a Safe module.
852
+
853
+ ```js
854
+ const safeTransaction = await safeSdk.createDisableModuleTx(moduleAddress)
855
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
856
+ await txResponse.transactionResponse?.wait()
857
+ ```
858
+
859
+ This method can optionally receive the `options` parameter:
860
+
861
+ ```js
862
+ const options: SafeTransactionOptionalProps = { ... }
863
+ const safeTransaction = await safeSdk.createDisableModuleTx(moduleAddress, options)
864
+ ```
865
+
866
+ ### createAddOwnerTx
867
+
868
+ Returns the Safe transaction to add an owner and optionally change the threshold.
869
+
870
+ ```js
871
+ const params: AddOwnerTxParams = {
872
+ ownerAddress,
873
+ threshold // Optional. If `threshold` is not provided the current threshold will not change.
874
+ }
875
+ const safeTransaction = await safeSdk.createAddOwnerTx(params)
876
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
877
+ await txResponse.transactionResponse?.wait()
878
+ ```
879
+
880
+ This method can optionally receive the `options` parameter:
881
+
882
+ ```js
883
+ const options: SafeTransactionOptionalProps = { ... }
884
+ const safeTransaction = await safeSdk.createAddOwnerTx(params, options)
885
+ ```
886
+
887
+ ### createRemoveOwnerTx
888
+
889
+ Returns the Safe transaction to remove an owner and optionally change the threshold.
890
+
891
+ ```js
892
+ const params: RemoveOwnerTxParams = {
893
+ ownerAddress,
894
+ newThreshold // Optional. If `newThreshold` is not provided, the current threshold will be decreased by one.
895
+ }
896
+ const safeTransaction = await safeSdk.createRemoveOwnerTx(params)
897
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
898
+ await txResponse.transactionResponse?.wait()
899
+ ```
900
+
901
+ This method can optionally receive the `options` parameter:
902
+
903
+ ```js
904
+ const options: SafeTransactionOptionalProps = { ... }
905
+ const safeTransaction = await safeSdk.createRemoveOwnerTx(params, options)
906
+ ```
907
+
908
+ ### createSwapOwnerTx
909
+
910
+ Returns the Safe transaction to replace an owner of the Safe with a new one.
911
+
912
+ ```js
913
+ const params: SwapOwnerTxParams = {
914
+ oldOwnerAddress,
915
+ newOwnerAddress
916
+ }
917
+ const safeTransaction = await safeSdk.createSwapOwnerTx(params)
918
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
919
+ await txResponse.transactionResponse?.wait()
920
+ ```
921
+
922
+ This method can optionally receive the `options` parameter:
923
+
924
+ ```js
925
+ const options: SafeTransactionOptionalProps = { ... }
926
+ const safeTransaction = await safeSdk.createSwapOwnerTx(params, options)
927
+ ```
928
+
929
+ ### createChangeThresholdTx
930
+
931
+ Returns the Safe transaction to change the threshold.
932
+
933
+ ```js
934
+ const safeTransaction = await safeSdk.createChangeThresholdTx(newThreshold)
935
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
936
+ await txResponse.transactionResponse?.wait()
937
+ ```
938
+
939
+ This method can optionally receive the `options` parameter:
940
+
941
+ ```js
942
+ const options: SafeTransactionOptionalProps = { ... }
943
+ const safeTransaction = await safeSdk.createChangeThresholdTx(newThreshold, options)
944
+ ```
945
+
946
+ ### isValidTransaction
947
+
948
+ Checks if a Safe transaction can be executed successfully with no errors.
949
+
950
+ ```js
951
+ const safeTransactionData: SafeTransactionDataPartial = {
952
+ // ...
953
+ }
954
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
955
+ const isValidTx = await safeSdk.isValidTransaction(safeTransaction)
956
+ ```
957
+
958
+ Optionally, some properties can be passed as execution options:
959
+
960
+ ```js
961
+ const options: Web3TransactionOptions = {
962
+ from, // Optional
963
+ gas, // Optional
964
+ gasPrice, // Optional
965
+ maxFeePerGas, // Optional
966
+ maxPriorityFeePerGas // Optional
967
+ nonce // Optional
968
+ }
969
+ ```
970
+
971
+ ```js
972
+ const options: EthersTransactionOptions = {
973
+ from, // Optional
974
+ gasLimit, // Optional
975
+ gasPrice, // Optional
976
+ maxFeePerGas, // Optional
977
+ maxPriorityFeePerGas // Optional
978
+ nonce // Optional
979
+ }
980
+ ```
981
+
982
+ ```js
983
+ const isValidTx = await safeSdk.isValidTransaction(safeTransaction, options)
984
+ ```
985
+
986
+ ### executeTransaction
987
+
988
+ Executes a Safe transaction.
989
+
990
+ ```js
991
+ const safeTransactionData: SafeTransactionDataPartial = {
992
+ // ...
993
+ }
994
+ const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
995
+ const txResponse = await safeSdk.executeTransaction(safeTransaction)
996
+ await txResponse.transactionResponse?.wait()
997
+ ```
998
+
999
+ Optionally, some properties can be passed as execution options:
1000
+
1001
+ ```js
1002
+ const options: Web3TransactionOptions = {
1003
+ from, // Optional
1004
+ gas, // Optional
1005
+ gasPrice, // Optional
1006
+ maxFeePerGas, // Optional
1007
+ maxPriorityFeePerGas // Optional
1008
+ nonce // Optional
1009
+ }
1010
+ ```
1011
+
1012
+ ```js
1013
+ const options: EthersTransactionOptions = {
1014
+ from, // Optional
1015
+ gasLimit, // Optional
1016
+ gasPrice, // Optional
1017
+ maxFeePerGas, // Optional
1018
+ maxPriorityFeePerGas // Optional
1019
+ nonce // Optional
1020
+ }
1021
+ ```
1022
+
1023
+ ```js
1024
+ const txResponse = await safeSdk.executeTransaction(safeTransaction, options)
1025
+ ```
1026
+
1027
+ ## <a name="license">License</a>
1028
+
1029
+ This library is released under MIT.
1030
+
1031
+ ## <a name="contributors">Contributors</a>
1032
+
1033
+ - Germán Martínez ([germartinez](https://github.com/germartinez))