aftermath-ts-sdk 1.2.60 → 1.2.61

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.
@@ -9,10 +9,6 @@ export declare class Auth extends Caller {
9
9
  walletAddress: SuiAddress;
10
10
  signMessageCallback: SignMessageCallback;
11
11
  }): Promise<() => void>;
12
- initFromSuiKeystore(inputs: {
13
- walletAddress: SuiAddress;
14
- path?: string;
15
- }): Promise<() => void>;
16
12
  adminCreateAuthAccount(inputs: {
17
13
  walletAddress: SuiAddress;
18
14
  signMessageCallback: SignMessageCallback;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/packages/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAIN,SAAS,EACT,MAAM,aAAa,CAAC;AAGrB,qBAAa,IAAK,SAAQ,MAAM;IAK/B,OAAO,CAAC,YAAY,CAA8C;IAClE,OAAO,CAAC,UAAU,CAAS;gBAMf,MAAM,CAAC,EAAE,YAAY;IAQpB,IAAI,CAAC,MAAM,EAAE;QACzB,aAAa,EAAE,UAAU,CAAC;QAC1B,mBAAmB,EAAE,mBAAmB,CAAC;KACzC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAmCV,mBAAmB,CAAC,MAAM,EAAE;QACxC,aAAa,EAAE,UAAU,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IA0EV,sBAAsB,CAAC,MAAM,EAAE;QAC3C,aAAa,EAAE,UAAU,CAAC;QAC1B,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,WAAW,EAAE,MAAM,CAAC;QACpB,oBAAoB,EAAE,UAAU,CAAC;QACjC,UAAU,EAAE,SAAS,EAAE,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;YAqCN,cAAc;IAyB5B,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAcnC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/packages/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAIN,SAAS,EACT,MAAM,aAAa,CAAC;AAGrB,qBAAa,IAAK,SAAQ,MAAM;IAK/B,OAAO,CAAC,YAAY,CAA8C;IAClE,OAAO,CAAC,UAAU,CAAS;gBAMf,MAAM,CAAC,EAAE,YAAY;IAQpB,IAAI,CAAC,MAAM,EAAE;QACzB,aAAa,EAAE,UAAU,CAAC;QAC1B,mBAAmB,EAAE,mBAAmB,CAAC;KACzC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAgHV,sBAAsB,CAAC,MAAM,EAAE;QAC3C,aAAa,EAAE,UAAU,CAAC;QAC1B,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,WAAW,EAAE,MAAM,CAAC;QACpB,oBAAoB,EAAE,UAAU,CAAC;QACjC,UAAU,EAAE,SAAS,EAAE,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;YAqCN,cAAc;IAyB5B,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAcnC"}
@@ -56,53 +56,70 @@ class Auth extends caller_1.Caller {
56
56
  };
57
57
  });
58
58
  }
59
- initFromSuiKeystore(inputs) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const { walletAddress, path: pathStr } = inputs;
62
- if (typeof window === "undefined") {
63
- const fs = require("fs");
64
- const path = require("path");
65
- const os = require("os");
66
- const keystorePath = pathStr
67
- ? path.join(pathStr)
68
- : (() => {
69
- // Locate the user’s home directory
70
- const homeDir = os.homedir();
71
- if (!homeDir) {
72
- throw new Error("cannot obtain home directory path");
73
- }
74
- // Construct the path: ~/.sui/sui_config/sui.keystore
75
- return path.join(homeDir, ".sui", "sui_config", "sui.keystore");
76
- })();
77
- // Read the JSON file from `keystorePath`
78
- let privateKeys;
79
- try {
80
- const fileContent = fs.readFileSync(keystorePath, "utf-8");
81
- privateKeys = JSON.parse(fileContent);
82
- if (!Array.isArray(privateKeys)) {
83
- throw new Error("Invalid keystore format: Expected an array of private keys");
84
- }
85
- }
86
- catch (error) {
87
- throw new Error(`Failed to read keystore file: ${error}`);
88
- }
89
- if (privateKeys.length <= 0) {
90
- throw new Error(`Empty keystore file`);
91
- }
92
- const foundKeypair = privateKeys
93
- .map((privateKey) => utils_1.Helpers.keypairFromPrivateKey(privateKey))
94
- .find((keypair) => utils_1.Helpers.addLeadingZeroesToType(keypair.toSuiAddress()) === utils_1.Helpers.addLeadingZeroesToType(walletAddress));
95
- if (!foundKeypair) {
96
- throw new Error(`No private key found in keystore file for ${walletAddress}`);
97
- }
98
- return this.init({
99
- walletAddress,
100
- signMessageCallback: ({ message }) => __awaiter(this, void 0, void 0, function* () { return foundKeypair.signPersonalMessage(message); }),
101
- });
102
- }
103
- throw new Error("`initFromSuiKeystore` must be called on server-side");
104
- });
105
- }
59
+ // public async initFromSuiKeystore(inputs: {
60
+ // walletAddress: SuiAddress;
61
+ // path?: string;
62
+ // }): Promise<() => void> {
63
+ // const { walletAddress, path: pathStr } = inputs;
64
+ // if (typeof window === "undefined") {
65
+ // const fs = require("fs");
66
+ // const path = require("path");
67
+ // const os = require("os");
68
+ // const keystorePath = pathStr
69
+ // ? path.join(pathStr)
70
+ // : (() => {
71
+ // // Locate the user’s home directory
72
+ // const homeDir = os.homedir();
73
+ // if (!homeDir) {
74
+ // throw new Error(
75
+ // "cannot obtain home directory path"
76
+ // );
77
+ // }
78
+ // // Construct the path: ~/.sui/sui_config/sui.keystore
79
+ // return path.join(
80
+ // homeDir,
81
+ // ".sui",
82
+ // "sui_config",
83
+ // "sui.keystore"
84
+ // );
85
+ // })();
86
+ // // Read the JSON file from `keystorePath`
87
+ // let privateKeys: string[];
88
+ // try {
89
+ // const fileContent = fs.readFileSync(keystorePath, "utf-8");
90
+ // privateKeys = JSON.parse(fileContent);
91
+ // if (!Array.isArray(privateKeys)) {
92
+ // throw new Error(
93
+ // "Invalid keystore format: Expected an array of private keys"
94
+ // );
95
+ // }
96
+ // } catch (error) {
97
+ // throw new Error(`Failed to read keystore file: ${error}`);
98
+ // }
99
+ // if (privateKeys.length <= 0) {
100
+ // throw new Error(`Empty keystore file`);
101
+ // }
102
+ // const foundKeypair = privateKeys
103
+ // .map((privateKey) => Helpers.keypairFromPrivateKey(privateKey))
104
+ // .find(
105
+ // (keypair) =>
106
+ // Helpers.addLeadingZeroesToType(
107
+ // keypair.toSuiAddress()
108
+ // ) === Helpers.addLeadingZeroesToType(walletAddress)
109
+ // );
110
+ // if (!foundKeypair) {
111
+ // throw new Error(
112
+ // `No private key found in keystore file for ${walletAddress}`
113
+ // );
114
+ // }
115
+ // return this.init({
116
+ // walletAddress,
117
+ // signMessageCallback: async ({ message }) =>
118
+ // foundKeypair.signPersonalMessage(message),
119
+ // });
120
+ // }
121
+ // throw new Error("`initFromSuiKeystore` must be called on server-side");
122
+ // }
106
123
  // =========================================================================
107
124
  // Admin
108
125
  // =========================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aftermath-ts-sdk",
3
- "version": "1.2.60",
3
+ "version": "1.2.61",
4
4
  "description": "Aftermath TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",