UNPKG

dp-contract-proxy-kit

Version:

Enable batched transactions and contract account interactions using a unique deterministic Gnosis Safe.

72 lines 3.68 kB
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _SafeAppsSdkConnector_appsSdk, _SafeAppsSdkConnector_safeAddress, _SafeAppsSdkConnector_isSafeApp; import SafeAppsSDK from '@gnosis.pm/safe-apps-sdk'; class SafeAppsSdkConnector { constructor() { _SafeAppsSdkConnector_appsSdk.set(this, void 0); _SafeAppsSdkConnector_safeAddress.set(this, void 0); _SafeAppsSdkConnector_isSafeApp.set(this, false); __classPrivateFieldSet(this, _SafeAppsSdkConnector_appsSdk, new SafeAppsSDK(), "f"); __classPrivateFieldGet(this, _SafeAppsSdkConnector_appsSdk, "f").getSafeInfo().then((appInfo) => { __classPrivateFieldSet(this, _SafeAppsSdkConnector_isSafeApp, !!appInfo.safeAddress, "f"); __classPrivateFieldSet(this, _SafeAppsSdkConnector_safeAddress, appInfo.safeAddress, "f"); }); } /** * Checks if the CPK is running as a Safe App or as a standalone app. * * @returns TRUE if the CPK is running as a Safe App */ get isSafeApp() { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_isSafeApp, "f"); } /** * Returns the Safe address connected to the CPK if the CPK is running as a Safe App. * * @returns The Safe address */ get safeAddress() { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_safeAddress, "f"); } /** * Returns an instance of the Safe Apps SDK used by the CPK. * * @returns The Safe Apps SDK instance */ get appsSdk() { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_appsSdk, "f"); } /** * Returns the information of the connected Safe App. * * @returns The information of the connected Safe App */ getSafeInfo() { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_appsSdk, "f").getSafeInfo(); } /** * Returns the transaction response for the given Safe transaction hash. * * @param safeTxHash - The desired Safe transaction hash * @returns The transaction response for the Safe transaction hash */ getBySafeTxHash(safeTxHash) { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_appsSdk, "f").txs.getBySafeTxHash(safeTxHash); } sendTransactions(transactions, params) { return __classPrivateFieldGet(this, _SafeAppsSdkConnector_appsSdk, "f").txs.send({ txs: transactions, params }); } } _SafeAppsSdkConnector_appsSdk = new WeakMap(), _SafeAppsSdkConnector_safeAddress = new WeakMap(), _SafeAppsSdkConnector_isSafeApp = new WeakMap(); export default SafeAppsSdkConnector; //# sourceMappingURL=index.js.map