Skip to content

Commit

Permalink
optimize: SDK bundle size by ~100kb
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMikulic committed May 11, 2023
1 parent 0cf10f7 commit 7db6ff1
Show file tree
Hide file tree
Showing 19 changed files with 348 additions and 72 deletions.
4 changes: 2 additions & 2 deletions packages/safe-apps-sdk/dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/safe-apps-sdk",
"version": "7.10.1",
"version": "7.11.0",
"description": "SDK developed to integrate third-party apps with Safe app.",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"license": "MIT",
"dependencies": {
"@safe-global/safe-gateway-typescript-sdk": "^3.5.3",
"ethers": "^5.7.2"
"viem": "0.3.21"
},
"devDependencies": {
"rimraf": "^3.0.2"
Expand Down
90 changes: 78 additions & 12 deletions packages/safe-apps-sdk/dist/src/safe/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/src/safe/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions packages/safe-apps-sdk/dist/src/safe/signatures.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ethers } from 'ethers';
declare const MAGIC_VALUE = "0x1626ba7e";
declare const MAGIC_VALUE_BYTES = "0x20c13b0b";
declare const EIP_1271_INTERFACE: ethers.utils.Interface;
declare const EIP_1271_BYTES_INTERFACE: ethers.utils.Interface;
export { EIP_1271_INTERFACE, EIP_1271_BYTES_INTERFACE, MAGIC_VALUE, MAGIC_VALUE_BYTES };
export { MAGIC_VALUE, MAGIC_VALUE_BYTES };
11 changes: 1 addition & 10 deletions packages/safe-apps-sdk/dist/src/safe/signatures.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/src/safe/signatures.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/safe-apps-sdk/dist/src/setupTests.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
5 changes: 5 additions & 0 deletions packages/safe-apps-sdk/dist/src/setupTests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/safe-apps-sdk/dist/src/setupTests.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions packages/safe-apps-sdk/dist/src/types/sdk.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChainInfo as _ChainInfo } from '@safe-global/safe-gateway-typescript-sdk';
import { BigNumberish, BytesLike } from 'ethers';
export type ChainInfo = Pick<_ChainInfo, 'chainName' | 'chainId' | 'shortName' | 'nativeCurrency' | 'blockExplorerUriTemplate'>;
export { NativeCurrency } from '@safe-global/safe-gateway-typescript-sdk';
export type BaseTransaction = {
Expand All @@ -26,9 +25,11 @@ export type SignMessageParams = {
export interface TypedDataDomain {
name?: string;
version?: string;
chainId?: BigNumberish;
chainId?: string | number | bigint | {
toNumber: () => number;
};
verifyingContract?: string;
salt?: BytesLike;
salt?: string;
}
export interface TypedDataTypes {
name: string;
Expand All @@ -41,6 +42,7 @@ export type EIP712TypedData = {
domain: TypedDataDomain;
types: TypedMessageTypes;
message: Record<string, any>;
primaryType?: string;
};
export type SignTypedMessageParams = {
typedData: EIP712TypedData;
Expand Down
19 changes: 19 additions & 0 deletions packages/safe-apps-sdk/jest-environment-jsdom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// https://github.com/paralleldrive/cuid2/issues/44#issuecomment-1531731695
const { TextEncoder, TextDecoder } = require('util');
const { default: $JSDOMEnvironment, TestEnvironment } = require('jest-environment-jsdom');

Object.defineProperty(exports, '__esModule', {
value: true,
});

class JSDOMEnvironment extends $JSDOMEnvironment {
constructor(...args) {
const { global } = super(...args);
global.Uint8Array = Uint8Array;
if (!global.TextEncoder) global.TextEncoder = TextEncoder;
if (!global.TextDecoder) global.TextDecoder = TextDecoder;
}
}

exports.default = JSDOMEnvironment;
exports.TestEnvironment = TestEnvironment === $JSDOMEnvironment ? JSDOMEnvironment : TestEnvironment;
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
moduleDirectories: ['node_modules', 'src'],
roots: ['src'],
verbose: true,
testEnvironment: 'jsdom',
testEnvironment: './jest-environment-jsdom.js',
};
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"license": "MIT",
"dependencies": {
"@safe-global/safe-gateway-typescript-sdk": "^3.5.3",
"ethers": "^5.7.2"
"viem": "0.3.21"
},
"devDependencies": {
"rimraf": "^3.0.2"
Expand Down
Loading

0 comments on commit 7db6ff1

Please sign in to comment.