@safe-global/sdk-starter-kit 1.1.5 → 2.0.0-alpha.1

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 (60) hide show
  1. package/dist/cjs/index.cjs +908 -0
  2. package/dist/esm/index.mjs +877 -0
  3. package/dist/src/BaseClient.d.ts +1 -0
  4. package/dist/src/BaseClient.d.ts.map +1 -0
  5. package/dist/src/SafeClient.d.ts +1 -0
  6. package/dist/src/SafeClient.d.ts.map +1 -0
  7. package/dist/src/constants.d.ts +2 -0
  8. package/dist/src/constants.d.ts.map +1 -0
  9. package/dist/src/extensions/index.d.ts +1 -0
  10. package/dist/src/extensions/index.d.ts.map +1 -0
  11. package/dist/src/extensions/messages/SafeMessageClient.d.ts +1 -0
  12. package/dist/src/extensions/messages/SafeMessageClient.d.ts.map +1 -0
  13. package/dist/src/extensions/messages/offChainMessages.d.ts +1 -0
  14. package/dist/src/extensions/messages/offChainMessages.d.ts.map +1 -0
  15. package/dist/src/extensions/messages/onChainMessages.d.ts +1 -0
  16. package/dist/src/extensions/messages/onChainMessages.d.ts.map +1 -0
  17. package/dist/src/extensions/safe-operations/SafeOperationClient.d.ts +1 -0
  18. package/dist/src/extensions/safe-operations/SafeOperationClient.d.ts.map +1 -0
  19. package/dist/src/extensions/safe-operations/safeOperations.d.ts +1 -0
  20. package/dist/src/extensions/safe-operations/safeOperations.d.ts.map +1 -0
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/index.d.ts.map +1 -0
  23. package/dist/src/types.d.ts +1 -0
  24. package/dist/src/types.d.ts.map +1 -0
  25. package/dist/src/utils/index.d.ts +7 -6
  26. package/dist/src/utils/index.d.ts.map +1 -0
  27. package/dist/src/utils/proposeTransaction.d.ts +1 -0
  28. package/dist/src/utils/proposeTransaction.d.ts.map +1 -0
  29. package/dist/src/utils/sendTransaction.d.ts +1 -0
  30. package/dist/src/utils/sendTransaction.d.ts.map +1 -0
  31. package/package.json +17 -8
  32. package/dist/src/BaseClient.js +0 -123
  33. package/dist/src/BaseClient.js.map +0 -1
  34. package/dist/src/SafeClient.js +0 -215
  35. package/dist/src/SafeClient.js.map +0 -1
  36. package/dist/src/constants.js +0 -37
  37. package/dist/src/constants.js.map +0 -1
  38. package/dist/src/extensions/index.js +0 -20
  39. package/dist/src/extensions/index.js.map +0 -1
  40. package/dist/src/extensions/messages/SafeMessageClient.js +0 -161
  41. package/dist/src/extensions/messages/SafeMessageClient.js.map +0 -1
  42. package/dist/src/extensions/messages/offChainMessages.js +0 -52
  43. package/dist/src/extensions/messages/offChainMessages.js.map +0 -1
  44. package/dist/src/extensions/messages/onChainMessages.js +0 -48
  45. package/dist/src/extensions/messages/onChainMessages.js.map +0 -1
  46. package/dist/src/extensions/safe-operations/SafeOperationClient.js +0 -127
  47. package/dist/src/extensions/safe-operations/SafeOperationClient.js.map +0 -1
  48. package/dist/src/extensions/safe-operations/safeOperations.js +0 -85
  49. package/dist/src/extensions/safe-operations/safeOperations.js.map +0 -1
  50. package/dist/src/index.js +0 -112
  51. package/dist/src/index.js.map +0 -1
  52. package/dist/src/types.js +0 -3
  53. package/dist/src/types.js.map +0 -1
  54. package/dist/src/utils/index.js +0 -57
  55. package/dist/src/utils/index.js.map +0 -1
  56. package/dist/src/utils/proposeTransaction.js +0 -29
  57. package/dist/src/utils/proposeTransaction.js.map +0 -1
  58. package/dist/src/utils/sendTransaction.js +0 -28
  59. package/dist/src/utils/sendTransaction.js.map +0 -1
  60. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/src/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createSafeClientResult = exports.waitSafeTxReceipt = exports.isValidSafeConfig = exports.isValidAddress = void 0;
18
- const protocol_kit_1 = require("@safe-global/protocol-kit");
19
- const constants_1 = require("../constants");
20
- const isValidAddress = (address) => {
21
- try {
22
- (0, protocol_kit_1.validateEthereumAddress)(address);
23
- return true;
24
- }
25
- catch {
26
- return false;
27
- }
28
- };
29
- exports.isValidAddress = isValidAddress;
30
- const isValidSafeConfig = (config) => {
31
- if (!config.owners || !config.threshold)
32
- return false;
33
- return true;
34
- };
35
- exports.isValidSafeConfig = isValidSafeConfig;
36
- const waitSafeTxReceipt = async (txResult) => {
37
- const receipt = txResult.transactionResponse
38
- ? await txResult.transactionResponse.wait()
39
- : undefined;
40
- return receipt;
41
- };
42
- exports.waitSafeTxReceipt = waitSafeTxReceipt;
43
- const createSafeClientResult = ({ status, safeAddress, deploymentTxHash, safeTxHash, txHash, messageHash, userOperationHash, safeOperationHash }) => {
44
- return {
45
- safeAddress,
46
- description: constants_1.MESSAGES[status],
47
- status,
48
- transactions: txHash || safeTxHash ? { ethereumTxHash: txHash, safeTxHash } : undefined,
49
- messages: messageHash ? { messageHash } : undefined,
50
- safeOperations: userOperationHash || safeOperationHash ? { userOperationHash, safeOperationHash } : undefined,
51
- safeAccountDeployment: deploymentTxHash ? { ethereumTxHash: deploymentTxHash } : undefined
52
- };
53
- };
54
- exports.createSafeClientResult = createSafeClientResult;
55
- __exportStar(require("./sendTransaction"), exports);
56
- __exportStar(require("./proposeTransaction"), exports);
57
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4DAAmE;AAInE,sEAAqF;AAG9E,MAAM,cAAc,GAAG,CAAC,OAAe,EAAW,EAAE;IACzD,IAAI,CAAC;QACH,IAAA,sCAAuB,EAAC,OAAO,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAPY,QAAA,cAAc,kBAO1B;AAEM,MAAM,iBAAiB,GAAG,CAAC,MAAkB,EAAW,EAAE;IAC/D,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAErD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B;AAEM,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAA2B,EACkC,EAAE;IAC/D,MAAM,OAAO,GAAG,QAAQ,CAAC,mBAAmB;QAC1C,CAAC,CAAC,MACE,QAAQ,CAAC,mBAGV,CAAC,IAAI,EAAE;QACV,CAAC,CAAC,SAAS,CAAA;IACb,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAXY,QAAA,iBAAiB,qBAW7B;AAEM,MAAM,sBAAsB,GAAG,CAAC,EACrC,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EAUlB,EAAoB,EAAE;IACrB,OAAO;QACL,WAAW;QACX,WAAW,EAAE,oBAAQ,CAAC,MAAM,CAAC;QAC7B,MAAM;QACN,YAAY,EAAE,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS;QACvF,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;QACnD,cAAc,EACZ,iBAAiB,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS;QAC/F,qBAAqB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS;KAC3F,CAAA;AACH,CAAC,CAAA;AA7BY,QAAA,sBAAsB,0BA6BlC;AAED,oDAAiC;AACjC,uDAAoC"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.proposeTransaction = void 0;
4
- const protocol_kit_1 = require("@safe-global/protocol-kit");
5
- /**
6
- * Propose a transaction to the Safe
7
- *
8
- * @param {SafeTransaction} safeTransaction The Safe transaction to propose
9
- * @param {Safe} protocolKit The Safe instance
10
- * @param {SafeApiKit} apiKit The SafeApiKit instance
11
- * @returns The Safe transaction hash
12
- */
13
- const proposeTransaction = async ({ safeTransaction, protocolKit, apiKit }) => {
14
- safeTransaction = await protocolKit.signTransaction(safeTransaction);
15
- const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x';
16
- const ethSig = safeTransaction.getSignature(signerAddress);
17
- const safeTxHash = await protocolKit.getTransactionHash(safeTransaction);
18
- const txOptions = {
19
- safeAddress: await protocolKit.getAddress(),
20
- safeTransactionData: safeTransaction.data,
21
- safeTxHash,
22
- senderAddress: signerAddress,
23
- senderSignature: (0, protocol_kit_1.buildSignatureBytes)([ethSig])
24
- };
25
- await apiKit.proposeTransaction(txOptions);
26
- return safeTxHash;
27
- };
28
- exports.proposeTransaction = proposeTransaction;
29
- //# sourceMappingURL=proposeTransaction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proposeTransaction.js","sourceRoot":"","sources":["../../../src/utils/proposeTransaction.ts"],"names":[],"mappings":";;;AAAA,4DAAuF;AAIvF;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,eAAe,EACf,WAAW,EACX,MAAM,EAKP,EAAmB,EAAE;IACpB,eAAe,GAAG,MAAM,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,CAAA;IAEpE,MAAM,aAAa,GAAG,CAAC,MAAM,WAAW,CAAC,eAAe,EAAE,CAAC,gBAAgB,EAAE,CAAC,IAAI,IAAI,CAAA;IACtF,MAAM,MAAM,GAAG,eAAe,CAAC,YAAY,CAAC,aAAa,CAAqB,CAAA;IAC9E,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAA;IAExE,MAAM,SAAS,GAAG;QAChB,WAAW,EAAE,MAAM,WAAW,CAAC,UAAU,EAAE;QAC3C,mBAAmB,EAAE,eAAe,CAAC,IAAI;QACzC,UAAU;QACV,aAAa,EAAE,aAAa;QAC5B,eAAe,EAAE,IAAA,kCAAmB,EAAC,CAAC,MAAM,CAAC,CAAC;KAC/C,CAAA;IAED,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;IAE1C,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AA1BY,QAAA,kBAAkB,sBA0B9B"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendTransaction = void 0;
4
- const actions_1 = require("viem/actions");
5
- /**
6
- * Sends a transaction using the signer (owner)
7
- * It's useful to deploy Safe accounts
8
- *
9
- * @param {Transaction} transaction The transaction.
10
- * @param {Safe} protocolKit The protocolKit instance
11
- * @returns {Promise<string | undefined>} A promise that resolves with the transaction hash
12
- */
13
- const sendTransaction = async ({ transaction, protocolKit }) => {
14
- const signer = (await protocolKit.getSafeProvider().getExternalSigner());
15
- const client = protocolKit.getSafeProvider().getExternalProvider();
16
- if (!signer)
17
- throw new Error('SafeProvider must be initialized with a signer to use this function');
18
- const hash = await signer.sendTransaction({
19
- to: transaction.to,
20
- data: transaction.data,
21
- value: BigInt(transaction.value),
22
- account: signer.account
23
- });
24
- const receipt = await (0, actions_1.waitForTransactionReceipt)(client, { hash });
25
- return receipt.transactionHash;
26
- };
27
- exports.sendTransaction = sendTransaction;
28
- //# sourceMappingURL=sendTransaction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sendTransaction.js","sourceRoot":"","sources":["../../../src/utils/sendTransaction.ts"],"names":[],"mappings":";;;AACA,0CAAwD;AAIxD;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,WAAW,EACX,WAAW,EAIZ,EAA+B,EAAE;IAChC,MAAM,MAAM,GAAG,CAAC,MAAM,WAAW,CAAC,eAAe,EAAE,CAAC,iBAAiB,EAAE,CAItE,CAAA;IACD,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC,mBAAmB,EAAE,CAAA;IAElE,IAAI,CAAC,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAA;IAExF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;QACxC,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,IAAI,EAAE,WAAW,CAAC,IAAW;QAC7B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,MAAM,IAAA,mCAAyB,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAEjE,OAAO,OAAO,CAAC,eAAe,CAAA;AAChC,CAAC,CAAA;AA3BY,QAAA,eAAe,mBA2B3B"}