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;
|
|
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,MA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
|
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
|
// =========================================================================
|