@mysten/wallet-standard 0.11.6 → 0.12.0
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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/detect.d.ts +1 -5
- package/dist/cjs/detect.js +1 -5
- package/dist/cjs/detect.js.map +2 -2
- package/dist/cjs/features/index.d.ts +9 -2
- package/dist/cjs/features/index.js +3 -0
- package/dist/cjs/features/index.js.map +2 -2
- package/dist/cjs/features/suiReportTransactionEffects.d.ts +22 -0
- package/dist/cjs/features/suiReportTransactionEffects.js +17 -0
- package/dist/cjs/features/suiReportTransactionEffects.js.map +7 -0
- package/dist/cjs/features/suiSignAndExecuteTransaction.d.ts +26 -0
- package/dist/cjs/features/suiSignAndExecuteTransaction.js +17 -0
- package/dist/cjs/features/suiSignAndExecuteTransaction.js.map +7 -0
- package/dist/cjs/features/suiSignAndExecuteTransactionBlock.d.ts +5 -1
- package/dist/cjs/features/suiSignAndExecuteTransactionBlock.js.map +1 -1
- package/dist/cjs/features/suiSignMessage.d.ts +2 -0
- package/dist/cjs/features/suiSignMessage.js.map +1 -1
- package/dist/cjs/features/suiSignPersonalMessage.d.ts +2 -0
- package/dist/cjs/features/suiSignPersonalMessage.js.map +1 -1
- package/dist/cjs/features/suiSignTransaction.d.ts +32 -0
- package/dist/cjs/features/suiSignTransaction.js +17 -0
- package/dist/cjs/features/suiSignTransaction.js.map +7 -0
- package/dist/cjs/features/suiSignTransactionBlock.d.ts +8 -2
- package/dist/cjs/features/suiSignTransactionBlock.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.d.ts +148 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/wallet.d.ts +7 -0
- package/dist/cjs/wallet.js +61 -0
- package/dist/cjs/wallet.js.map +2 -2
- package/dist/esm/detect.d.ts +1 -5
- package/dist/esm/detect.js +1 -5
- package/dist/esm/detect.js.map +2 -2
- package/dist/esm/features/index.d.ts +9 -2
- package/dist/esm/features/index.js +3 -0
- package/dist/esm/features/index.js.map +2 -2
- package/dist/esm/features/suiReportTransactionEffects.d.ts +22 -0
- package/dist/esm/features/suiReportTransactionEffects.js +1 -0
- package/dist/esm/features/suiReportTransactionEffects.js.map +7 -0
- package/dist/esm/features/suiSignAndExecuteTransaction.d.ts +26 -0
- package/dist/esm/features/suiSignAndExecuteTransaction.js +1 -0
- package/dist/esm/features/suiSignAndExecuteTransaction.js.map +7 -0
- package/dist/esm/features/suiSignAndExecuteTransactionBlock.d.ts +5 -1
- package/dist/esm/features/suiSignMessage.d.ts +2 -0
- package/dist/esm/features/suiSignPersonalMessage.d.ts +2 -0
- package/dist/esm/features/suiSignTransaction.d.ts +32 -0
- package/dist/esm/features/suiSignTransaction.js +1 -0
- package/dist/esm/features/suiSignTransaction.js.map +7 -0
- package/dist/esm/features/suiSignTransactionBlock.d.ts +8 -2
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/types.d.ts +148 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +7 -0
- package/dist/esm/wallet.d.ts +7 -0
- package/dist/esm/wallet.js +57 -0
- package/dist/esm/wallet.js.map +3 -3
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/detect.ts +1 -10
- package/src/features/index.ts +20 -11
- package/src/features/suiReportTransactionEffects.ts +30 -0
- package/src/features/suiSignAndExecuteTransaction.ts +35 -0
- package/src/features/suiSignAndExecuteTransactionBlock.ts +5 -1
- package/src/features/suiSignMessage.ts +2 -0
- package/src/features/suiSignPersonalMessage.ts +2 -0
- package/src/features/suiSignTransaction.ts +41 -0
- package/src/features/suiSignTransactionBlock.ts +8 -2
- package/src/index.ts +2 -1
- package/src/types.ts +170 -0
- package/src/wallet.ts +83 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** Contains data related to the gas payment for a Transaction */
|
|
2
|
+
export interface GasData {
|
|
3
|
+
/** The budget set for this transaction */
|
|
4
|
+
budget: string | number | null;
|
|
5
|
+
/** The gas price used for this transaction */
|
|
6
|
+
price: string | number | null;
|
|
7
|
+
/** The owner of the gas coins used to fund the transactions, this is either the sender or the gas sponsor */
|
|
8
|
+
owner: string | null;
|
|
9
|
+
/** The list of SUI coins to fund the transaction */
|
|
10
|
+
payment: {
|
|
11
|
+
objectId: string;
|
|
12
|
+
version: string;
|
|
13
|
+
digest: string;
|
|
14
|
+
}[] | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represent the serialized state of a partially built Transaction
|
|
18
|
+
* This format is designed to support transactions that have not been fully build
|
|
19
|
+
* allowing most properties to be omitted or set to null. It also supports
|
|
20
|
+
* unresolved object references, unresolved pure values, and Transaction Intents.
|
|
21
|
+
*/
|
|
22
|
+
export interface SerializedTransactionDataV2 {
|
|
23
|
+
version: 2;
|
|
24
|
+
/** The sender of the transaction */
|
|
25
|
+
sender: string | null | undefined;
|
|
26
|
+
/** The expiration of the transaction */
|
|
27
|
+
expiration: {
|
|
28
|
+
Epoch: number;
|
|
29
|
+
} | {
|
|
30
|
+
None: true;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
/** The gas data */
|
|
33
|
+
gasData: GasData;
|
|
34
|
+
/** The inputs to the transaction */
|
|
35
|
+
inputs: CallArg[];
|
|
36
|
+
/** The commands to execute */
|
|
37
|
+
commands: Command[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Represents an input to a Transaction, either as a fully resolved Object or Pure input
|
|
41
|
+
* or as an unresolved partial reference which needs to be resolved before the transaction
|
|
42
|
+
* can be serialized to bcs and executed.
|
|
43
|
+
*/
|
|
44
|
+
export type CallArg = {
|
|
45
|
+
Object: ObjectArg;
|
|
46
|
+
} | {
|
|
47
|
+
Pure: PureArg;
|
|
48
|
+
} | {
|
|
49
|
+
UnresolvedPure: UnresolvedPureArg;
|
|
50
|
+
} | {
|
|
51
|
+
UnresolvedObject: UnresolvedObjectArg;
|
|
52
|
+
};
|
|
53
|
+
export type ObjectArg = {
|
|
54
|
+
ImmOrOwnedObject: {
|
|
55
|
+
objectId: string;
|
|
56
|
+
version: string | number;
|
|
57
|
+
digest: string;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
SharedObject: {
|
|
61
|
+
objectId: string;
|
|
62
|
+
initialSharedVersion: string;
|
|
63
|
+
mutable: boolean;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
Receiving: {
|
|
67
|
+
objectId: string;
|
|
68
|
+
version: string | number;
|
|
69
|
+
digest: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export interface PureArg {
|
|
73
|
+
bytes: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Represents an un-serialized pure value.
|
|
77
|
+
* The correct bcs schema will need to be determined before this value can be serialized to bcs */
|
|
78
|
+
export interface UnresolvedPureArg {
|
|
79
|
+
value: unknown;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Represents an unresolved object reference. This allows objects to be referenced by only their ID.
|
|
83
|
+
* version and digest details may also be added to unresolved object references.
|
|
84
|
+
* To fully resolve a reference, the correct ObjectArg type needs to be determined based on the type of object,
|
|
85
|
+
* and how it used in the transaction (eg, is it used mutably if it's shared, and is it a receiving object if it's not shared)
|
|
86
|
+
*/
|
|
87
|
+
export interface UnresolvedObjectArg {
|
|
88
|
+
objectId: string;
|
|
89
|
+
version?: string | null | undefined;
|
|
90
|
+
digest?: string | null | undefined;
|
|
91
|
+
initialSharedVersion?: string | null | undefined;
|
|
92
|
+
}
|
|
93
|
+
export type Argument = {
|
|
94
|
+
GasCoin: true;
|
|
95
|
+
} | {
|
|
96
|
+
Input: number;
|
|
97
|
+
} | {
|
|
98
|
+
Result: number;
|
|
99
|
+
} | {
|
|
100
|
+
NestedResult: [number, number];
|
|
101
|
+
};
|
|
102
|
+
export type Command = {
|
|
103
|
+
MoveCall: {
|
|
104
|
+
package: string;
|
|
105
|
+
module: string;
|
|
106
|
+
function: string;
|
|
107
|
+
typeArguments: string[];
|
|
108
|
+
arguments: Argument[];
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
TransferObjects: {
|
|
112
|
+
objects: Argument[];
|
|
113
|
+
address: Argument;
|
|
114
|
+
};
|
|
115
|
+
} | {
|
|
116
|
+
SplitCoins: {
|
|
117
|
+
coin: Argument;
|
|
118
|
+
amounts: Argument[];
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
MergeCoins: {
|
|
122
|
+
destination: Argument;
|
|
123
|
+
sources: Argument[];
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
Publish: {
|
|
127
|
+
modules: string[];
|
|
128
|
+
dependencies: string[];
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
MakeMoveVec: {
|
|
132
|
+
type: string | null;
|
|
133
|
+
elements: Argument[];
|
|
134
|
+
};
|
|
135
|
+
} | {
|
|
136
|
+
Upgrade: {
|
|
137
|
+
modules: string[];
|
|
138
|
+
dependencies: string[];
|
|
139
|
+
package: string;
|
|
140
|
+
ticket: Argument;
|
|
141
|
+
};
|
|
142
|
+
} | {
|
|
143
|
+
$Intent: {
|
|
144
|
+
name: string;
|
|
145
|
+
inputs: Record<string, Argument | Argument[]>;
|
|
146
|
+
data: Record<string, unknown>;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Contains data related to the gas payment for a Transaction */\nexport interface GasData {\n\t/** The budget set for this transaction */\n\tbudget: string | number | null;\n\t/** The gas price used for this transaction */\n\tprice: string | number | null;\n\t/** The owner of the gas coins used to fund the transactions, this is either the sender or the gas sponsor */\n\towner: string | null;\n\t/** The list of SUI coins to fund the transaction */\n\tpayment: { objectId: string; version: string; digest: string }[] | null;\n}\n\n/**\n * Represent the serialized state of a partially built Transaction\n * This format is designed to support transactions that have not been fully build\n * allowing most properties to be omitted or set to null. It also supports\n * unresolved object references, unresolved pure values, and Transaction Intents.\n */\nexport interface SerializedTransactionDataV2 {\n\tversion: 2;\n\t/** The sender of the transaction */\n\tsender: string | null | undefined;\n\t/** The expiration of the transaction */\n\texpiration: { Epoch: number } | { None: true } | null | undefined;\n\t/** The gas data */\n\tgasData: GasData;\n\t/** The inputs to the transaction */\n\tinputs: CallArg[];\n\t/** The commands to execute */\n\tcommands: Command[];\n}\n\n/**\n * Represents an input to a Transaction, either as a fully resolved Object or Pure input\n * or as an unresolved partial reference which needs to be resolved before the transaction\n * can be serialized to bcs and executed.\n */\nexport type CallArg =\n\t| {\n\t\t\tObject: ObjectArg;\n\t }\n\t| {\n\t\t\tPure: PureArg;\n\t }\n\t| {\n\t\t\tUnresolvedPure: UnresolvedPureArg;\n\t }\n\t| {\n\t\t\tUnresolvedObject: UnresolvedObjectArg;\n\t };\n\nexport type ObjectArg =\n\t| {\n\t\t\tImmOrOwnedObject: {\n\t\t\t\tobjectId: string;\n\t\t\t\tversion: string | number;\n\t\t\t\tdigest: string;\n\t\t\t};\n\t }\n\t| {\n\t\t\tSharedObject: {\n\t\t\t\tobjectId: string;\n\t\t\t\tinitialSharedVersion: string;\n\t\t\t\tmutable: boolean;\n\t\t\t};\n\t }\n\t| {\n\t\t\tReceiving: {\n\t\t\t\tobjectId: string;\n\t\t\t\tversion: string | number;\n\t\t\t\tdigest: string;\n\t\t\t};\n\t };\n\nexport interface PureArg {\n\tbytes: string;\n}\n\n/**\n * Represents an un-serialized pure value.\n * The correct bcs schema will need to be determined before this value can be serialized to bcs */\nexport interface UnresolvedPureArg {\n\tvalue: unknown;\n}\n\n/**\n * Represents an unresolved object reference. This allows objects to be referenced by only their ID.\n * version and digest details may also be added to unresolved object references.\n * To fully resolve a reference, the correct ObjectArg type needs to be determined based on the type of object,\n * and how it used in the transaction (eg, is it used mutably if it's shared, and is it a receiving object if it's not shared)\n */\nexport interface UnresolvedObjectArg {\n\tobjectId: string;\n\tversion?: string | null | undefined;\n\tdigest?: string | null | undefined;\n\tinitialSharedVersion?: string | null | undefined;\n}\n\nexport type Argument =\n\t| {\n\t\t\tGasCoin: true;\n\t }\n\t| {\n\t\t\tInput: number;\n\t }\n\t| {\n\t\t\tResult: number;\n\t }\n\t| {\n\t\t\tNestedResult: [number, number];\n\t };\n\nexport type Command =\n\t| {\n\t\t\tMoveCall: {\n\t\t\t\tpackage: string;\n\t\t\t\tmodule: string;\n\t\t\t\tfunction: string;\n\t\t\t\ttypeArguments: string[];\n\t\t\t\targuments: Argument[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tTransferObjects: {\n\t\t\t\tobjects: Argument[];\n\t\t\t\taddress: Argument;\n\t\t\t};\n\t }\n\t| {\n\t\t\tSplitCoins: {\n\t\t\t\tcoin: Argument;\n\t\t\t\tamounts: Argument[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tMergeCoins: {\n\t\t\t\tdestination: Argument;\n\t\t\t\tsources: Argument[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tPublish: {\n\t\t\t\tmodules: string[];\n\t\t\t\tdependencies: string[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tMakeMoveVec: {\n\t\t\t\ttype: string | null;\n\t\t\t\telements: Argument[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tUpgrade: {\n\t\t\t\tmodules: string[];\n\t\t\t\tdependencies: string[];\n\t\t\t\tpackage: string;\n\t\t\t\tticket: Argument;\n\t\t\t};\n\t }\n\t| {\n\t\t\t$Intent: {\n\t\t\t\tname: string;\n\t\t\t\tinputs: Record<string, Argument | Argument[]>;\n\t\t\t\tdata: Record<string, unknown>;\n\t\t\t};\n\t };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/wallet.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WalletWithFeatures } from '@wallet-standard/core';
|
|
2
|
+
import type { SuiSignAndExecuteTransactionInput, SuiSignTransactionInput, SuiWalletFeatures } from './features/index.js';
|
|
1
3
|
declare module '@wallet-standard/core' {
|
|
2
4
|
interface Wallet {
|
|
3
5
|
/**
|
|
@@ -7,5 +9,10 @@ declare module '@wallet-standard/core' {
|
|
|
7
9
|
*/
|
|
8
10
|
readonly id?: string;
|
|
9
11
|
}
|
|
12
|
+
interface StandardConnectOutput {
|
|
13
|
+
supportedIntents?: string[];
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
export type { Wallet } from '@wallet-standard/core';
|
|
17
|
+
export declare function signAndExecuteTransaction(wallet: WalletWithFeatures<Partial<SuiWalletFeatures>>, input: SuiSignAndExecuteTransactionInput): Promise<import("./features/suiSignAndExecuteTransaction.js").SuiSignAndExecuteTransactionOutput>;
|
|
18
|
+
export declare function signTransaction(wallet: WalletWithFeatures<Partial<SuiWalletFeatures>>, input: SuiSignTransactionInput): Promise<import("./features/suiSignTransaction.js").SignedTransaction>;
|
package/dist/cjs/wallet.js
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,5 +17,62 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
};
|
|
14
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
19
|
var wallet_exports = {};
|
|
20
|
+
__export(wallet_exports, {
|
|
21
|
+
signAndExecuteTransaction: () => signAndExecuteTransaction,
|
|
22
|
+
signTransaction: () => signTransaction
|
|
23
|
+
});
|
|
16
24
|
module.exports = __toCommonJS(wallet_exports);
|
|
25
|
+
var import_bcs = require("@mysten/sui/bcs");
|
|
26
|
+
var import_transactions = require("@mysten/sui/transactions");
|
|
27
|
+
var import_utils = require("@mysten/sui/utils");
|
|
28
|
+
async function signAndExecuteTransaction(wallet, input) {
|
|
29
|
+
if (wallet.features["sui:signAndExecuteTransaction"]) {
|
|
30
|
+
return wallet.features["sui:signAndExecuteTransaction"].signAndExecuteTransaction(input);
|
|
31
|
+
}
|
|
32
|
+
if (!wallet.features["sui:signAndExecuteTransactionBlock"]) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Provided wallet (${wallet.name}) does not support the signAndExecuteTransaction feature.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const { signAndExecuteTransactionBlock } = wallet.features["sui:signAndExecuteTransactionBlock"];
|
|
38
|
+
const transactionBlock = import_transactions.Transaction.from(await input.transaction.toJSON());
|
|
39
|
+
const { digest, rawEffects, rawTransaction } = await signAndExecuteTransactionBlock({
|
|
40
|
+
...input,
|
|
41
|
+
transactionBlock,
|
|
42
|
+
options: {
|
|
43
|
+
showRawEffects: true,
|
|
44
|
+
showRawInput: true
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const [
|
|
48
|
+
{
|
|
49
|
+
txSignatures: [signature],
|
|
50
|
+
intentMessage: { value: bcsTransaction }
|
|
51
|
+
}
|
|
52
|
+
] = import_bcs.bcs.SenderSignedData.parse((0, import_utils.fromB64)(rawTransaction));
|
|
53
|
+
const bytes = import_bcs.bcs.TransactionData.serialize(bcsTransaction).toBase64();
|
|
54
|
+
return {
|
|
55
|
+
digest,
|
|
56
|
+
signature,
|
|
57
|
+
bytes,
|
|
58
|
+
effects: (0, import_utils.toB64)(new Uint8Array(rawEffects))
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function signTransaction(wallet, input) {
|
|
62
|
+
if (wallet.features["sui:signTransaction"]) {
|
|
63
|
+
return wallet.features["sui:signTransaction"].signTransaction(input);
|
|
64
|
+
}
|
|
65
|
+
if (!wallet.features["sui:signTransactionBlock"]) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Provided wallet (${wallet.name}) does not support the signTransaction feature.`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
const { signTransactionBlock } = wallet.features["sui:signTransactionBlock"];
|
|
71
|
+
const transaction = import_transactions.Transaction.from(await input.transaction.toJSON());
|
|
72
|
+
const { transactionBlockBytes, signature } = await signTransactionBlock({
|
|
73
|
+
...input,
|
|
74
|
+
transactionBlock: transaction
|
|
75
|
+
});
|
|
76
|
+
return { bytes: transactionBlockBytes, signature };
|
|
77
|
+
}
|
|
17
78
|
//# sourceMappingURL=wallet.js.map
|
package/dist/cjs/wallet.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wallet.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\ndeclare module '@wallet-standard/core' {\n\texport interface Wallet {\n\t\t/**\n\t\t * Unique identifier of the Wallet.\n\t\t *\n\t\t * If not provided, the wallet name will be used as the identifier.\n\t\t */\n\t\treadonly id?: string;\n\t}\n}\n\nexport type { Wallet } from '@wallet-standard/core';\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@mysten/sui/bcs';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { fromB64, toB64 } from '@mysten/sui/utils';\nimport type { WalletWithFeatures } from '@wallet-standard/core';\n\nimport type {\n\tSuiSignAndExecuteTransactionInput,\n\tSuiSignTransactionInput,\n\tSuiWalletFeatures,\n} from './features/index.js';\n\ndeclare module '@wallet-standard/core' {\n\texport interface Wallet {\n\t\t/**\n\t\t * Unique identifier of the Wallet.\n\t\t *\n\t\t * If not provided, the wallet name will be used as the identifier.\n\t\t */\n\t\treadonly id?: string;\n\t}\n\n\texport interface StandardConnectOutput {\n\t\tsupportedIntents?: string[];\n\t}\n}\n\nexport type { Wallet } from '@wallet-standard/core';\n\nexport async function signAndExecuteTransaction(\n\twallet: WalletWithFeatures<Partial<SuiWalletFeatures>>,\n\tinput: SuiSignAndExecuteTransactionInput,\n) {\n\tif (wallet.features['sui:signAndExecuteTransaction']) {\n\t\treturn wallet.features['sui:signAndExecuteTransaction'].signAndExecuteTransaction(input);\n\t}\n\n\tif (!wallet.features['sui:signAndExecuteTransactionBlock']) {\n\t\tthrow new Error(\n\t\t\t`Provided wallet (${wallet.name}) does not support the signAndExecuteTransaction feature.`,\n\t\t);\n\t}\n\n\tconst { signAndExecuteTransactionBlock } = wallet.features['sui:signAndExecuteTransactionBlock'];\n\n\tconst transactionBlock = Transaction.from(await input.transaction.toJSON());\n\tconst { digest, rawEffects, rawTransaction } = await signAndExecuteTransactionBlock({\n\t\t...input,\n\t\ttransactionBlock,\n\t\toptions: {\n\t\t\tshowRawEffects: true,\n\t\t\tshowRawInput: true,\n\t\t},\n\t});\n\n\tconst [\n\t\t{\n\t\t\ttxSignatures: [signature],\n\t\t\tintentMessage: { value: bcsTransaction },\n\t\t},\n\t] = bcs.SenderSignedData.parse(fromB64(rawTransaction!));\n\n\tconst bytes = bcs.TransactionData.serialize(bcsTransaction).toBase64();\n\n\treturn {\n\t\tdigest,\n\t\tsignature,\n\t\tbytes,\n\t\teffects: toB64(new Uint8Array(rawEffects!)),\n\t};\n}\n\nexport async function signTransaction(\n\twallet: WalletWithFeatures<Partial<SuiWalletFeatures>>,\n\tinput: SuiSignTransactionInput,\n) {\n\tif (wallet.features['sui:signTransaction']) {\n\t\treturn wallet.features['sui:signTransaction'].signTransaction(input);\n\t}\n\n\tif (!wallet.features['sui:signTransactionBlock']) {\n\t\tthrow new Error(\n\t\t\t`Provided wallet (${wallet.name}) does not support the signTransaction feature.`,\n\t\t);\n\t}\n\n\tconst { signTransactionBlock } = wallet.features['sui:signTransactionBlock'];\n\n\tconst transaction = Transaction.from(await input.transaction.toJSON());\n\tconst { transactionBlockBytes, signature } = await signTransactionBlock({\n\t\t...input,\n\t\ttransactionBlock: transaction,\n\t});\n\n\treturn { bytes: transactionBlockBytes, signature };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB;AACpB,0BAA4B;AAC5B,mBAA+B;AA0B/B,eAAsB,0BACrB,QACA,OACC;AACD,MAAI,OAAO,SAAS,+BAA+B,GAAG;AACrD,WAAO,OAAO,SAAS,+BAA+B,EAAE,0BAA0B,KAAK;AAAA,EACxF;AAEA,MAAI,CAAC,OAAO,SAAS,oCAAoC,GAAG;AAC3D,UAAM,IAAI;AAAA,MACT,oBAAoB,OAAO;AAAA,IAC5B;AAAA,EACD;AAEA,QAAM,EAAE,+BAA+B,IAAI,OAAO,SAAS,oCAAoC;AAE/F,QAAM,mBAAmB,gCAAY,KAAK,MAAM,MAAM,YAAY,OAAO,CAAC;AAC1E,QAAM,EAAE,QAAQ,YAAY,eAAe,IAAI,MAAM,+BAA+B;AAAA,IACnF,GAAG;AAAA,IACH;AAAA,IACA,SAAS;AAAA,MACR,gBAAgB;AAAA,MAChB,cAAc;AAAA,IACf;AAAA,EACD,CAAC;AAED,QAAM;AAAA,IACL;AAAA,MACC,cAAc,CAAC,SAAS;AAAA,MACxB,eAAe,EAAE,OAAO,eAAe;AAAA,IACxC;AAAA,EACD,IAAI,eAAI,iBAAiB,UAAM,sBAAQ,cAAe,CAAC;AAEvD,QAAM,QAAQ,eAAI,gBAAgB,UAAU,cAAc,EAAE,SAAS;AAErE,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAS,oBAAM,IAAI,WAAW,UAAW,CAAC;AAAA,EAC3C;AACD;AAEA,eAAsB,gBACrB,QACA,OACC;AACD,MAAI,OAAO,SAAS,qBAAqB,GAAG;AAC3C,WAAO,OAAO,SAAS,qBAAqB,EAAE,gBAAgB,KAAK;AAAA,EACpE;AAEA,MAAI,CAAC,OAAO,SAAS,0BAA0B,GAAG;AACjD,UAAM,IAAI;AAAA,MACT,oBAAoB,OAAO;AAAA,IAC5B;AAAA,EACD;AAEA,QAAM,EAAE,qBAAqB,IAAI,OAAO,SAAS,0BAA0B;AAE3E,QAAM,cAAc,gCAAY,KAAK,MAAM,MAAM,YAAY,OAAO,CAAC;AACrE,QAAM,EAAE,uBAAuB,UAAU,IAAI,MAAM,qBAAqB;AAAA,IACvE,GAAG;AAAA,IACH,kBAAkB;AAAA,EACnB,CAAC;AAED,SAAO,EAAE,OAAO,uBAAuB,UAAU;AAClD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/detect.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { Wallet, WalletWithFeatures } from '@wallet-standard/core';
|
|
2
|
-
import type { MinimallyRequiredFeatures
|
|
3
|
-
/** @deprecated Use isWalletWithRequiredFeatureSet instead since it provides more accurate typing! */
|
|
4
|
-
export declare function isWalletWithSuiFeatures(wallet: Wallet,
|
|
5
|
-
/** Extra features that are required to be present, in addition to the expected feature set. */
|
|
6
|
-
features?: string[]): wallet is WalletWithSuiFeatures;
|
|
2
|
+
import type { MinimallyRequiredFeatures } from './features/index.js';
|
|
7
3
|
export declare function isWalletWithRequiredFeatureSet<AdditionalFeatures extends Wallet['features']>(wallet: Wallet, additionalFeatures?: (keyof AdditionalFeatures)[]): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>;
|
package/dist/esm/detect.js
CHANGED
|
@@ -2,16 +2,12 @@ const REQUIRED_FEATURES = [
|
|
|
2
2
|
"standard:connect",
|
|
3
3
|
"standard:events"
|
|
4
4
|
];
|
|
5
|
-
function isWalletWithSuiFeatures(wallet, features = []) {
|
|
6
|
-
return [...REQUIRED_FEATURES, ...features].every((feature) => feature in wallet.features);
|
|
7
|
-
}
|
|
8
5
|
function isWalletWithRequiredFeatureSet(wallet, additionalFeatures = []) {
|
|
9
6
|
return [...REQUIRED_FEATURES, ...additionalFeatures].every(
|
|
10
7
|
(feature) => feature in wallet.features
|
|
11
8
|
);
|
|
12
9
|
}
|
|
13
10
|
export {
|
|
14
|
-
isWalletWithRequiredFeatureSet
|
|
15
|
-
isWalletWithSuiFeatures
|
|
11
|
+
isWalletWithRequiredFeatureSet
|
|
16
12
|
};
|
|
17
13
|
//# sourceMappingURL=detect.js.map
|
package/dist/esm/detect.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/detect.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Wallet, WalletWithFeatures } from '@wallet-standard/core';\n\nimport type { MinimallyRequiredFeatures
|
|
5
|
-
"mappings": "AASA,MAAM,oBAAyD;AAAA,EAC9D;AAAA,EACA;AACD;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Wallet, WalletWithFeatures } from '@wallet-standard/core';\n\nimport type { MinimallyRequiredFeatures } from './features/index.js';\n\n// These features are absolutely required for wallets to function in the Sui ecosystem.\n// Eventually, as wallets have more consistent support of features, we may want to extend this list.\nconst REQUIRED_FEATURES: (keyof MinimallyRequiredFeatures)[] = [\n\t'standard:connect',\n\t'standard:events',\n];\n\nexport function isWalletWithRequiredFeatureSet<AdditionalFeatures extends Wallet['features']>(\n\twallet: Wallet,\n\tadditionalFeatures: (keyof AdditionalFeatures)[] = [],\n): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> {\n\treturn [...REQUIRED_FEATURES, ...additionalFeatures].every(\n\t\t(feature) => feature in wallet.features,\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AASA,MAAM,oBAAyD;AAAA,EAC9D;AAAA,EACA;AACD;AAEO,SAAS,+BACf,QACA,qBAAmD,CAAC,GAC2B;AAC/E,SAAO,CAAC,GAAG,mBAAmB,GAAG,kBAAkB,EAAE;AAAA,IACpD,CAAC,YAAY,WAAW,OAAO;AAAA,EAChC;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { IdentifierRecord, StandardConnectFeature, StandardDisconnectFeature, StandardEventsFeature, WalletWithFeatures } from '@wallet-standard/core';
|
|
2
|
+
import type { SuiReportTransactionEffectsFeature } from './suiReportTransactionEffects.js';
|
|
3
|
+
import type { SuiSignAndExecuteTransactionFeature } from './suiSignAndExecuteTransaction.js';
|
|
2
4
|
import type { SuiSignAndExecuteTransactionBlockFeature } from './suiSignAndExecuteTransactionBlock.js';
|
|
3
5
|
import type { SuiSignMessageFeature } from './suiSignMessage.js';
|
|
4
6
|
import type { SuiSignPersonalMessageFeature } from './suiSignPersonalMessage.js';
|
|
7
|
+
import type { SuiSignTransactionFeature } from './suiSignTransaction.js';
|
|
5
8
|
import type { SuiSignTransactionBlockFeature } from './suiSignTransactionBlock.js';
|
|
6
9
|
/**
|
|
7
10
|
* Wallet Standard features that are unique to Sui, and that all Sui wallets are expected to implement.
|
|
8
11
|
*/
|
|
9
|
-
export type SuiFeatures = SuiSignTransactionBlockFeature & SuiSignAndExecuteTransactionBlockFeature & SuiSignPersonalMessageFeature & Partial<SuiSignMessageFeature>;
|
|
10
|
-
export type
|
|
12
|
+
export type SuiFeatures = Partial<SuiSignTransactionBlockFeature> & Partial<SuiSignAndExecuteTransactionBlockFeature> & SuiSignPersonalMessageFeature & SuiSignAndExecuteTransactionFeature & SuiSignTransactionFeature & Partial<SuiSignMessageFeature> & Partial<SuiReportTransactionEffectsFeature>;
|
|
13
|
+
export type SuiWalletFeatures = StandardConnectFeature & StandardEventsFeature & SuiFeatures & Partial<StandardDisconnectFeature>;
|
|
14
|
+
export type WalletWithSuiFeatures = WalletWithFeatures<SuiWalletFeatures>;
|
|
11
15
|
/**
|
|
12
16
|
* Represents a wallet with the absolute minimum feature set required to function in the Sui ecosystem.
|
|
13
17
|
*/
|
|
@@ -15,5 +19,8 @@ export type WalletWithRequiredFeatures = WalletWithFeatures<MinimallyRequiredFea
|
|
|
15
19
|
export type MinimallyRequiredFeatures = StandardConnectFeature & StandardEventsFeature;
|
|
16
20
|
export * from './suiSignMessage.js';
|
|
17
21
|
export * from './suiSignTransactionBlock.js';
|
|
22
|
+
export * from './suiSignTransaction.js';
|
|
18
23
|
export * from './suiSignAndExecuteTransactionBlock.js';
|
|
24
|
+
export * from './suiSignAndExecuteTransaction.js';
|
|
19
25
|
export * from './suiSignPersonalMessage.js';
|
|
26
|
+
export * from './suiReportTransactionEffects.js';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from "./suiSignMessage.js";
|
|
2
2
|
export * from "./suiSignTransactionBlock.js";
|
|
3
|
+
export * from "./suiSignTransaction.js";
|
|
3
4
|
export * from "./suiSignAndExecuteTransactionBlock.js";
|
|
5
|
+
export * from "./suiSignAndExecuteTransaction.js";
|
|
4
6
|
export * from "./suiSignPersonalMessage.js";
|
|
7
|
+
export * from "./suiReportTransactionEffects.js";
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tIdentifierRecord,\n\tStandardConnectFeature,\n\tStandardDisconnectFeature,\n\tStandardEventsFeature,\n\tWalletWithFeatures,\n} from '@wallet-standard/core';\n\nimport type { SuiSignAndExecuteTransactionBlockFeature } from './suiSignAndExecuteTransactionBlock.js';\nimport type { SuiSignMessageFeature } from './suiSignMessage.js';\nimport type { SuiSignPersonalMessageFeature } from './suiSignPersonalMessage.js';\nimport type { SuiSignTransactionBlockFeature } from './suiSignTransactionBlock.js';\n\n/**\n * Wallet Standard features that are unique to Sui, and that all Sui wallets are expected to implement.\n */\nexport type SuiFeatures = SuiSignTransactionBlockFeature &\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tIdentifierRecord,\n\tStandardConnectFeature,\n\tStandardDisconnectFeature,\n\tStandardEventsFeature,\n\tWalletWithFeatures,\n} from '@wallet-standard/core';\n\nimport type { SuiReportTransactionEffectsFeature } from './suiReportTransactionEffects.js';\nimport type { SuiSignAndExecuteTransactionFeature } from './suiSignAndExecuteTransaction.js';\nimport type { SuiSignAndExecuteTransactionBlockFeature } from './suiSignAndExecuteTransactionBlock.js';\nimport type { SuiSignMessageFeature } from './suiSignMessage.js';\nimport type { SuiSignPersonalMessageFeature } from './suiSignPersonalMessage.js';\nimport type { SuiSignTransactionFeature } from './suiSignTransaction.js';\nimport type { SuiSignTransactionBlockFeature } from './suiSignTransactionBlock.js';\n\n/**\n * Wallet Standard features that are unique to Sui, and that all Sui wallets are expected to implement.\n */\nexport type SuiFeatures = Partial<SuiSignTransactionBlockFeature> &\n\tPartial<SuiSignAndExecuteTransactionBlockFeature> &\n\tSuiSignPersonalMessageFeature &\n\tSuiSignAndExecuteTransactionFeature &\n\tSuiSignTransactionFeature &\n\t// This deprecated feature should be removed once wallets update to the new method:\n\tPartial<SuiSignMessageFeature> &\n\tPartial<SuiReportTransactionEffectsFeature>;\n\nexport type SuiWalletFeatures = StandardConnectFeature &\n\tStandardEventsFeature &\n\tSuiFeatures &\n\t// Disconnect is an optional feature:\n\tPartial<StandardDisconnectFeature>;\n\nexport type WalletWithSuiFeatures = WalletWithFeatures<SuiWalletFeatures>;\n\n/**\n * Represents a wallet with the absolute minimum feature set required to function in the Sui ecosystem.\n */\nexport type WalletWithRequiredFeatures = WalletWithFeatures<\n\tMinimallyRequiredFeatures &\n\t\tPartial<SuiFeatures> &\n\t\tPartial<StandardDisconnectFeature> &\n\t\tIdentifierRecord<unknown>\n>;\n\nexport type MinimallyRequiredFeatures = StandardConnectFeature & StandardEventsFeature;\n\nexport * from './suiSignMessage.js';\nexport * from './suiSignTransactionBlock.js';\nexport * from './suiSignTransaction.js';\nexport * from './suiSignAndExecuteTransactionBlock.js';\nexport * from './suiSignAndExecuteTransaction.js';\nexport * from './suiSignPersonalMessage.js';\nexport * from './suiReportTransactionEffects.js';\n"],
|
|
5
|
+
"mappings": "AAmDA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
2
|
+
/**
|
|
3
|
+
* A Wallet Standard feature for reporting the effects of a transaction block executed by a dapp
|
|
4
|
+
* The feature allows wallets to updated their caches using the effects of the transaction
|
|
5
|
+
* executed outside of the wallet
|
|
6
|
+
*/
|
|
7
|
+
export type SuiReportTransactionEffectsFeature = {
|
|
8
|
+
/** Namespace for the feature. */
|
|
9
|
+
'sui:reportTransactionEffects': {
|
|
10
|
+
/** Version of the feature API. */
|
|
11
|
+
version: '1.0.0';
|
|
12
|
+
reportTransactionEffects: SuiReportTransactionEffectsMethod;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type SuiReportTransactionEffectsMethod = (input: SuiReportTransactionEffectsInput) => Promise<void>;
|
|
16
|
+
/** Input for signing transactions. */
|
|
17
|
+
export interface SuiReportTransactionEffectsInput {
|
|
18
|
+
account: WalletAccount;
|
|
19
|
+
chain: IdentifierString;
|
|
20
|
+
/** Transaction effects as base64 encoded bcs. */
|
|
21
|
+
effects: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=suiReportTransactionEffects.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SignedTransaction, SuiSignTransactionInput } from './suiSignTransaction.js';
|
|
2
|
+
/** The latest API version of the signAndExecuteTransactionBlock API. */
|
|
3
|
+
export type SuiSignAndExecuteTransactionVersion = '2.0.0';
|
|
4
|
+
/**
|
|
5
|
+
* A Wallet Standard feature for signing a transaction, and submitting it to the
|
|
6
|
+
* network. The wallet is expected to submit the transaction to the network via RPC,
|
|
7
|
+
* and return the transaction response.
|
|
8
|
+
*/
|
|
9
|
+
export type SuiSignAndExecuteTransactionFeature = {
|
|
10
|
+
/** Namespace for the feature. */
|
|
11
|
+
'sui:signAndExecuteTransaction': {
|
|
12
|
+
/** Version of the feature API. */
|
|
13
|
+
version: SuiSignAndExecuteTransactionVersion;
|
|
14
|
+
signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type SuiSignAndExecuteTransactionMethod = (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
|
|
18
|
+
/** Input for signing and sending transactions. */
|
|
19
|
+
export interface SuiSignAndExecuteTransactionInput extends SuiSignTransactionInput {
|
|
20
|
+
}
|
|
21
|
+
/** Output of signing and sending transactions. */
|
|
22
|
+
export interface SuiSignAndExecuteTransactionOutput extends SignedTransaction {
|
|
23
|
+
digest: string;
|
|
24
|
+
/** Transaction effects as base64 encoded bcs. */
|
|
25
|
+
effects: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=suiSignAndExecuteTransaction.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { ExecuteTransactionRequestType, SuiTransactionBlockResponse, SuiTransactionBlockResponseOptions } from '@mysten/sui
|
|
1
|
+
import type { ExecuteTransactionRequestType, SuiTransactionBlockResponse, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
2
2
|
import type { SuiSignTransactionBlockInput } from './suiSignTransactionBlock.js';
|
|
3
3
|
/** The latest API version of the signAndExecuteTransactionBlock API. */
|
|
4
4
|
export type SuiSignAndExecuteTransactionBlockVersion = '1.0.0';
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated Use `sui:signAndExecuteTransaction` instead.
|
|
7
|
+
*
|
|
6
8
|
* A Wallet Standard feature for signing a transaction, and submitting it to the
|
|
7
9
|
* network. The wallet is expected to submit the transaction to the network via RPC,
|
|
8
10
|
* and return the transaction response.
|
|
@@ -12,9 +14,11 @@ export type SuiSignAndExecuteTransactionBlockFeature = {
|
|
|
12
14
|
'sui:signAndExecuteTransactionBlock': {
|
|
13
15
|
/** Version of the feature API. */
|
|
14
16
|
version: SuiSignAndExecuteTransactionBlockVersion;
|
|
17
|
+
/** @deprecated Use `sui:signAndExecuteTransaction` instead. */
|
|
15
18
|
signAndExecuteTransactionBlock: SuiSignAndExecuteTransactionBlockMethod;
|
|
16
19
|
};
|
|
17
20
|
};
|
|
21
|
+
/** @deprecated Use `sui:signAndExecuteTransaction` instead. */
|
|
18
22
|
export type SuiSignAndExecuteTransactionBlockMethod = (input: SuiSignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
|
|
19
23
|
/** Input for signing and sending transactions. */
|
|
20
24
|
export interface SuiSignAndExecuteTransactionBlockInput extends SuiSignTransactionBlockInput {
|
|
@@ -33,6 +33,8 @@ export interface SuiSignMessageInput {
|
|
|
33
33
|
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `sui:signPersonalMessage` feature
|
|
34
34
|
*/
|
|
35
35
|
export interface SuiSignMessageOutput {
|
|
36
|
+
/** Base64 message bytes. */
|
|
36
37
|
messageBytes: string;
|
|
38
|
+
/** Base64 encoded signature */
|
|
37
39
|
signature: string;
|
|
38
40
|
}
|
|
@@ -23,6 +23,8 @@ export interface SuiSignPersonalMessageInput {
|
|
|
23
23
|
export interface SuiSignPersonalMessageOutput extends SignedPersonalMessage {
|
|
24
24
|
}
|
|
25
25
|
export interface SignedPersonalMessage {
|
|
26
|
+
/** Base64 encoded message bytes */
|
|
26
27
|
bytes: string;
|
|
28
|
+
/** Base64 encoded signature */
|
|
27
29
|
signature: string;
|
|
28
30
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
2
|
+
/** The latest API version of the signTransaction API. */
|
|
3
|
+
export type SuiSignTransactionVersion = '2.0.0';
|
|
4
|
+
/**
|
|
5
|
+
* A Wallet Standard feature for signing a transaction, and returning the
|
|
6
|
+
* serialized transaction and transaction signature.
|
|
7
|
+
*/
|
|
8
|
+
export type SuiSignTransactionFeature = {
|
|
9
|
+
/** Namespace for the feature. */
|
|
10
|
+
'sui:signTransaction': {
|
|
11
|
+
/** Version of the feature API. */
|
|
12
|
+
version: SuiSignTransactionVersion;
|
|
13
|
+
signTransaction: SuiSignTransactionMethod;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type SuiSignTransactionMethod = (input: SuiSignTransactionInput) => Promise<SignedTransaction>;
|
|
17
|
+
/** Input for signing transactions. */
|
|
18
|
+
export interface SuiSignTransactionInput {
|
|
19
|
+
transaction: {
|
|
20
|
+
toJSON: () => Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
account: WalletAccount;
|
|
23
|
+
chain: IdentifierString;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
/** Output of signing transactions. */
|
|
27
|
+
export interface SignedTransaction {
|
|
28
|
+
/** Transaction as base64 encoded bcs. */
|
|
29
|
+
bytes: string;
|
|
30
|
+
/** Base64 encoded signature */
|
|
31
|
+
signature: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=suiSignTransaction.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
3
3
|
/** The latest API version of the signTransactionBlock API. */
|
|
4
4
|
export type SuiSignTransactionBlockVersion = '1.0.0';
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated Use `sui:signTransaction` instead.
|
|
7
|
+
*
|
|
6
8
|
* A Wallet Standard feature for signing a transaction, and returning the
|
|
7
9
|
* serialized transaction and transaction signature.
|
|
8
10
|
*/
|
|
@@ -11,13 +13,15 @@ export type SuiSignTransactionBlockFeature = {
|
|
|
11
13
|
'sui:signTransactionBlock': {
|
|
12
14
|
/** Version of the feature API. */
|
|
13
15
|
version: SuiSignTransactionBlockVersion;
|
|
16
|
+
/** @deprecated Use `sui:signTransaction` instead. */
|
|
14
17
|
signTransactionBlock: SuiSignTransactionBlockMethod;
|
|
15
18
|
};
|
|
16
19
|
};
|
|
20
|
+
/** @deprecated Use `sui:signTransaction` instead. */
|
|
17
21
|
export type SuiSignTransactionBlockMethod = (input: SuiSignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
|
|
18
22
|
/** Input for signing transactions. */
|
|
19
23
|
export interface SuiSignTransactionBlockInput {
|
|
20
|
-
transactionBlock:
|
|
24
|
+
transactionBlock: Transaction;
|
|
21
25
|
account: WalletAccount;
|
|
22
26
|
chain: IdentifierString;
|
|
23
27
|
}
|
|
@@ -25,6 +29,8 @@ export interface SuiSignTransactionBlockInput {
|
|
|
25
29
|
export interface SuiSignTransactionBlockOutput extends SignedTransactionBlock {
|
|
26
30
|
}
|
|
27
31
|
export interface SignedTransactionBlock {
|
|
32
|
+
/** Transaction as base64 encoded bcs. */
|
|
28
33
|
transactionBlockBytes: string;
|
|
34
|
+
/** Base64 encoded signature */
|
|
29
35
|
signature: string;
|
|
30
36
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from '@wallet-standard/core';
|
|
2
|
-
export type
|
|
2
|
+
export { type Wallet, signAndExecuteTransaction, signTransaction } from './wallet.js';
|
|
3
3
|
export * from './features/index.js';
|
|
4
4
|
export * from './detect.js';
|
|
5
5
|
export * from './chains.js';
|
|
6
|
+
export * from './types.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export * from "@wallet-standard/core";
|
|
2
|
+
import { signAndExecuteTransaction, signTransaction } from "./wallet.js";
|
|
2
3
|
export * from "./features/index.js";
|
|
3
4
|
export * from "./detect.js";
|
|
4
5
|
export * from "./chains.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export {
|
|
8
|
+
signAndExecuteTransaction,
|
|
9
|
+
signTransaction
|
|
10
|
+
};
|
|
5
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/core';\n\nexport type
|
|
5
|
-
"mappings": "AAGA,cAAc;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/core';\n\nexport { type Wallet, signAndExecuteTransaction, signTransaction } from './wallet.js';\nexport * from './features/index.js';\nexport * from './detect.js';\nexport * from './chains.js';\nexport * from './types.js';\n"],
|
|
5
|
+
"mappings": "AAGA,cAAc;AAEd,SAAsB,2BAA2B,uBAAuB;AACxE,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|