@haneullabs/wallet-standard 0.1.0 → 0.20.1
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 +172 -159
- package/README.md +1 -1
- package/dist/chains.d.mts +21 -0
- package/dist/chains.d.mts.map +1 -0
- package/dist/chains.mjs +26 -0
- package/dist/chains.mjs.map +1 -0
- package/dist/detect.d.mts +8 -0
- package/dist/detect.d.mts.map +1 -0
- package/dist/detect.mjs +11 -0
- package/dist/detect.mjs.map +1 -0
- package/dist/features/haneulGetCapabilities.d.mts +19 -0
- package/dist/features/haneulGetCapabilities.d.mts.map +1 -0
- package/dist/features/haneulGetCapabilities.mjs +6 -0
- package/dist/features/haneulGetCapabilities.mjs.map +1 -0
- package/dist/features/haneulSignAndExecuteTransaction.d.mts +32 -0
- package/dist/features/haneulSignAndExecuteTransaction.d.mts.map +1 -0
- package/dist/features/haneulSignAndExecuteTransaction.mjs +7 -0
- package/dist/features/haneulSignAndExecuteTransaction.mjs.map +1 -0
- package/dist/features/haneulSignAndExecuteTransactionBlock.d.mts +40 -0
- package/dist/features/haneulSignAndExecuteTransactionBlock.d.mts.map +1 -0
- package/dist/features/haneulSignAndExecuteTransactionBlock.mjs +7 -0
- package/dist/features/haneulSignAndExecuteTransactionBlock.mjs.map +1 -0
- package/dist/features/haneulSignMessage.d.mts +51 -0
- package/dist/features/haneulSignMessage.d.mts.map +1 -0
- package/dist/features/haneulSignMessage.mjs +10 -0
- package/dist/features/haneulSignMessage.mjs.map +1 -0
- package/dist/features/haneulSignPersonalMessage.d.mts +37 -0
- package/dist/features/haneulSignPersonalMessage.d.mts.map +1 -0
- package/dist/features/haneulSignPersonalMessage.mjs +7 -0
- package/dist/features/haneulSignPersonalMessage.mjs.map +1 -0
- package/dist/features/haneulSignTransaction.d.mts +39 -0
- package/dist/features/haneulSignTransaction.d.mts.map +1 -0
- package/dist/features/haneulSignTransaction.mjs +7 -0
- package/dist/features/haneulSignTransaction.mjs.map +1 -0
- package/dist/features/haneulSignTransactionBlock.d.mts +42 -0
- package/dist/features/haneulSignTransactionBlock.d.mts.map +1 -0
- package/dist/features/haneulSignTransactionBlock.mjs +7 -0
- package/dist/features/haneulSignTransactionBlock.mjs.map +1 -0
- package/dist/features/index.d.mts +25 -0
- package/dist/features/index.d.mts.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +14 -0
- package/dist/types.d.mts +163 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/wallet.d.mts +24 -0
- package/dist/wallet.d.mts.map +1 -0
- package/dist/wallet.mjs +45 -0
- package/dist/wallet.mjs.map +1 -0
- package/package.json +21 -19
- package/src/chains.ts +3 -3
- package/src/features/haneulGetCapabilities.ts +1 -1
- package/src/features/haneulSignAndExecuteTransaction.ts +1 -1
- package/src/features/haneulSignAndExecuteTransactionBlock.ts +5 -5
- package/src/features/haneulSignMessage.ts +7 -7
- package/src/features/haneulSignPersonalMessage.ts +1 -1
- package/src/features/haneulSignTransaction.ts +1 -1
- package/src/features/haneulSignTransactionBlock.ts +4 -4
- package/src/features/index.ts +1 -4
- package/src/types.ts +1 -1
- package/src/wallet.ts +8 -8
- package/dist/cjs/chains.d.ts +0 -16
- package/dist/cjs/chains.js +0 -42
- package/dist/cjs/chains.js.map +0 -7
- package/dist/cjs/detect.d.ts +0 -3
- package/dist/cjs/detect.js +0 -31
- package/dist/cjs/detect.js.map +0 -7
- package/dist/cjs/features/haneulGetCapabilities.d.ts +0 -15
- package/dist/cjs/features/haneulGetCapabilities.js +0 -25
- package/dist/cjs/features/haneulGetCapabilities.js.map +0 -7
- package/dist/cjs/features/haneulReportTransactionEffects.d.ts +0 -26
- package/dist/cjs/features/haneulReportTransactionEffects.js +0 -25
- package/dist/cjs/features/haneulReportTransactionEffects.js.map +0 -7
- package/dist/cjs/features/haneulSignAndExecuteTransaction.d.ts +0 -28
- package/dist/cjs/features/haneulSignAndExecuteTransaction.js +0 -25
- package/dist/cjs/features/haneulSignAndExecuteTransaction.js.map +0 -7
- package/dist/cjs/features/haneulSignAndExecuteTransactionBlock.d.ts +0 -36
- package/dist/cjs/features/haneulSignAndExecuteTransactionBlock.js +0 -25
- package/dist/cjs/features/haneulSignAndExecuteTransactionBlock.js.map +0 -7
- package/dist/cjs/features/haneulSignMessage.d.ts +0 -45
- package/dist/cjs/features/haneulSignMessage.js +0 -25
- package/dist/cjs/features/haneulSignMessage.js.map +0 -7
- package/dist/cjs/features/haneulSignPersonalMessage.d.ts +0 -33
- package/dist/cjs/features/haneulSignPersonalMessage.js +0 -25
- package/dist/cjs/features/haneulSignPersonalMessage.js.map +0 -7
- package/dist/cjs/features/haneulSignTransaction.d.ts +0 -34
- package/dist/cjs/features/haneulSignTransaction.js +0 -25
- package/dist/cjs/features/haneulSignTransaction.js.map +0 -7
- package/dist/cjs/features/haneulSignTransactionBlock.d.ts +0 -38
- package/dist/cjs/features/haneulSignTransactionBlock.js +0 -25
- package/dist/cjs/features/haneulSignTransactionBlock.js.map +0 -7
- package/dist/cjs/features/index.d.ts +0 -28
- package/dist/cjs/features/index.js +0 -26
- package/dist/cjs/features/index.js.map +0 -7
- package/dist/cjs/index.d.ts +0 -6
- package/dist/cjs/index.js +0 -32
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/types.d.ts +0 -159
- package/dist/cjs/types.js +0 -17
- package/dist/cjs/types.js.map +0 -7
- package/dist/cjs/wallet.d.ts +0 -18
- package/dist/cjs/wallet.js +0 -80
- package/dist/cjs/wallet.js.map +0 -7
- package/dist/esm/chains.d.ts +0 -16
- package/dist/esm/chains.js +0 -22
- package/dist/esm/chains.js.map +0 -7
- package/dist/esm/detect.d.ts +0 -3
- package/dist/esm/detect.js +0 -11
- package/dist/esm/detect.js.map +0 -7
- package/dist/esm/features/haneulGetCapabilities.d.ts +0 -15
- package/dist/esm/features/haneulGetCapabilities.js +0 -5
- package/dist/esm/features/haneulGetCapabilities.js.map +0 -7
- package/dist/esm/features/haneulReportTransactionEffects.d.ts +0 -26
- package/dist/esm/features/haneulReportTransactionEffects.js +0 -5
- package/dist/esm/features/haneulReportTransactionEffects.js.map +0 -7
- package/dist/esm/features/haneulSignAndExecuteTransaction.d.ts +0 -28
- package/dist/esm/features/haneulSignAndExecuteTransaction.js +0 -5
- package/dist/esm/features/haneulSignAndExecuteTransaction.js.map +0 -7
- package/dist/esm/features/haneulSignAndExecuteTransactionBlock.d.ts +0 -36
- package/dist/esm/features/haneulSignAndExecuteTransactionBlock.js +0 -5
- package/dist/esm/features/haneulSignAndExecuteTransactionBlock.js.map +0 -7
- package/dist/esm/features/haneulSignMessage.d.ts +0 -45
- package/dist/esm/features/haneulSignMessage.js +0 -5
- package/dist/esm/features/haneulSignMessage.js.map +0 -7
- package/dist/esm/features/haneulSignPersonalMessage.d.ts +0 -33
- package/dist/esm/features/haneulSignPersonalMessage.js +0 -5
- package/dist/esm/features/haneulSignPersonalMessage.js.map +0 -7
- package/dist/esm/features/haneulSignTransaction.d.ts +0 -34
- package/dist/esm/features/haneulSignTransaction.js +0 -5
- package/dist/esm/features/haneulSignTransaction.js.map +0 -7
- package/dist/esm/features/haneulSignTransactionBlock.d.ts +0 -38
- package/dist/esm/features/haneulSignTransactionBlock.js +0 -5
- package/dist/esm/features/haneulSignTransactionBlock.js.map +0 -7
- package/dist/esm/features/index.d.ts +0 -28
- package/dist/esm/features/index.js +0 -9
- package/dist/esm/features/index.js.map +0 -7
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/package.json +0 -5
- package/dist/esm/types.d.ts +0 -159
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -7
- package/dist/esm/wallet.d.ts +0 -18
- package/dist/esm/wallet.js +0 -60
- package/dist/esm/wallet.js.map +0 -7
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/features/haneulReportTransactionEffects.ts +0 -36
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/** Contains data related to the gas payment for a Transaction */
|
|
3
|
+
interface GasData {
|
|
4
|
+
/** The budget set for this transaction */
|
|
5
|
+
budget: string | number | null;
|
|
6
|
+
/** The gas price used for this transaction */
|
|
7
|
+
price: string | number | null;
|
|
8
|
+
/** The owner of the gas coins used to fund the transactions, this is either the sender or the gas sponsor */
|
|
9
|
+
owner: string | null;
|
|
10
|
+
/** The list of HANEUL coins to fund the transaction */
|
|
11
|
+
payment: {
|
|
12
|
+
objectId: string;
|
|
13
|
+
version: string;
|
|
14
|
+
digest: string;
|
|
15
|
+
}[] | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represent the serialized state of a partially built Transaction
|
|
19
|
+
* This format is designed to support transactions that have not been fully build
|
|
20
|
+
* allowing most properties to be omitted or set to null. It also supports
|
|
21
|
+
* unresolved object references, unresolved pure values, and Transaction Intents.
|
|
22
|
+
*/
|
|
23
|
+
interface SerializedTransactionDataV2 {
|
|
24
|
+
version: 2;
|
|
25
|
+
/** The sender of the transaction */
|
|
26
|
+
sender: string | null | undefined;
|
|
27
|
+
/** The expiration of the transaction */
|
|
28
|
+
expiration: {
|
|
29
|
+
Epoch: number;
|
|
30
|
+
} | {
|
|
31
|
+
None: true;
|
|
32
|
+
} | null | undefined;
|
|
33
|
+
/** The gas data */
|
|
34
|
+
gasData: GasData;
|
|
35
|
+
/** The inputs to the transaction */
|
|
36
|
+
inputs: CallArg[];
|
|
37
|
+
/** The commands to execute */
|
|
38
|
+
commands: Command[];
|
|
39
|
+
/** Extra metadata for implementation specific use-cases */
|
|
40
|
+
extensions?: {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
};
|
|
43
|
+
/** The digest of the transaction, may be set when the transaction is fully resolved */
|
|
44
|
+
digest: string | null | undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Represents an input to a Transaction, either as a fully resolved Object or Pure input
|
|
48
|
+
* or as an unresolved partial reference which needs to be resolved before the transaction
|
|
49
|
+
* can be serialized to bcs and executed.
|
|
50
|
+
*/
|
|
51
|
+
type CallArg = {
|
|
52
|
+
Object: ObjectArg;
|
|
53
|
+
} | {
|
|
54
|
+
Pure: PureArg;
|
|
55
|
+
} | {
|
|
56
|
+
UnresolvedPure: UnresolvedPureArg;
|
|
57
|
+
} | {
|
|
58
|
+
UnresolvedObject: UnresolvedObjectArg;
|
|
59
|
+
};
|
|
60
|
+
type ObjectArg = {
|
|
61
|
+
ImmOrOwnedObject: {
|
|
62
|
+
objectId: string;
|
|
63
|
+
version: string | number;
|
|
64
|
+
digest: string;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
SharedObject: {
|
|
68
|
+
objectId: string;
|
|
69
|
+
initialSharedVersion: string;
|
|
70
|
+
mutable: boolean;
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
Receiving: {
|
|
74
|
+
objectId: string;
|
|
75
|
+
version: string | number;
|
|
76
|
+
digest: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
interface PureArg {
|
|
80
|
+
bytes: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Represents an un-serialized pure value.
|
|
84
|
+
* The correct bcs schema will need to be determined before this value can be serialized to bcs */
|
|
85
|
+
interface UnresolvedPureArg {
|
|
86
|
+
value: unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Represents an unresolved object reference. This allows objects to be referenced by only their ID.
|
|
90
|
+
* version and digest details may also be added to unresolved object references.
|
|
91
|
+
* To fully resolve a reference, the correct ObjectArg type needs to be determined based on the type of object,
|
|
92
|
+
* 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)
|
|
93
|
+
*/
|
|
94
|
+
interface UnresolvedObjectArg {
|
|
95
|
+
objectId: string;
|
|
96
|
+
version?: string | null | undefined;
|
|
97
|
+
digest?: string | null | undefined;
|
|
98
|
+
initialSharedVersion?: string | null | undefined;
|
|
99
|
+
mutable?: boolean | null | undefined;
|
|
100
|
+
}
|
|
101
|
+
type Argument = {
|
|
102
|
+
GasCoin: true;
|
|
103
|
+
} | {
|
|
104
|
+
Input: number;
|
|
105
|
+
} | {
|
|
106
|
+
Result: number;
|
|
107
|
+
} | {
|
|
108
|
+
NestedResult: [number, number];
|
|
109
|
+
};
|
|
110
|
+
type Command = {
|
|
111
|
+
MoveCall: {
|
|
112
|
+
package: string;
|
|
113
|
+
module: string;
|
|
114
|
+
function: string;
|
|
115
|
+
typeArguments: string[];
|
|
116
|
+
arguments: Argument[];
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
TransferObjects: {
|
|
120
|
+
objects: Argument[];
|
|
121
|
+
address: Argument;
|
|
122
|
+
};
|
|
123
|
+
} | {
|
|
124
|
+
SplitCoins: {
|
|
125
|
+
coin: Argument;
|
|
126
|
+
amounts: Argument[];
|
|
127
|
+
};
|
|
128
|
+
} | {
|
|
129
|
+
MergeCoins: {
|
|
130
|
+
destination: Argument;
|
|
131
|
+
sources: Argument[];
|
|
132
|
+
};
|
|
133
|
+
} | {
|
|
134
|
+
Publish: {
|
|
135
|
+
modules: string[];
|
|
136
|
+
dependencies: string[];
|
|
137
|
+
};
|
|
138
|
+
} | {
|
|
139
|
+
MakeMoveVec: {
|
|
140
|
+
type: string | null;
|
|
141
|
+
elements: Argument[];
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
Upgrade: {
|
|
145
|
+
modules: string[];
|
|
146
|
+
dependencies: string[];
|
|
147
|
+
package: string;
|
|
148
|
+
ticket: Argument;
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
$Intent: {
|
|
152
|
+
name: string;
|
|
153
|
+
inputs: {
|
|
154
|
+
[key: string]: Argument | Argument[];
|
|
155
|
+
};
|
|
156
|
+
data: {
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
//#endregion
|
|
162
|
+
export { Argument, CallArg, Command, GasData, ObjectArg, PureArg, SerializedTransactionDataV2, UnresolvedObjectArg, UnresolvedPureArg };
|
|
163
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAIiB,UAAA,OAAA,CAAO;EAiBP;EAOP,MAAA,EAAA,MAAA,GAAA,MAAA,GAAA,IAAA;EAED;EAEE,KAAA,EAAA,MAAA,GAAA,MAAA,GAAA,IAAA;EAAO;EAYN,KAAA,EAAA,MAAO,GAAA,IAAA;EAER;EAGF,OAAA,EAAA;IAGU,QAAA,EAAA,MAAA;IAGE,OAAA,EAAA,MAAA;IAAmB,MAAA,EAAA,MAAA;EAG5B,CAAA,EAAA,GAAA,IAAA;AAuBZ;AAOA;AAUA;AAQA;AAcA;;;AAaa,UAhHI,2BAAA,CAgHJ;EAKH,OAAA,EAAA,CAAA;EACG;EAKI,MAAA,EAAA,MAAA,GAAA,IAAA,GAAA,SAAA;EACJ;EAYC,UAAA,EAAA;IAQF,KAAA,EAAA,MAAA;EAMiB,CAAA,GAAA;IAAW,IAAA,EAAA,IAAA;EAAQ,CAAA,GAAA,IAAA,GAAA,SAAA;;WA/ItC;;UAED;;YAEE;;;;;;;;;;;;;KAYC,OAAA;UAED;;QAGF;;kBAGU;;oBAGE;;KAGT,SAAA;;;;;;;;;;;;;;;;;;;UAuBK,OAAA;;;;;;UAOA,iBAAA;;;;;;;;;UAUA,mBAAA;;;;;;;KAQL,QAAA;;;;;;;;;KAcA,OAAA;;;;;;eAOG;;;;aAKF;aACA;;;;UAKH;aACG;;;;iBAKI;aACJ;;;;;;;;;;cAYC;;;;;;;YAQF;;;;;;qBAMiB,WAAW"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HaneulSignTransactionInput, SignedTransaction } from "./features/haneulSignTransaction.mjs";
|
|
2
|
+
import { HaneulSignAndExecuteTransactionInput, HaneulSignAndExecuteTransactionOutput } from "./features/haneulSignAndExecuteTransaction.mjs";
|
|
3
|
+
import { HaneulWalletFeatures } from "./features/index.mjs";
|
|
4
|
+
import { Wallet as Wallet$1, WalletWithFeatures } from "@wallet-standard/core";
|
|
5
|
+
|
|
6
|
+
//#region src/wallet.d.ts
|
|
7
|
+
declare module '@wallet-standard/core' {
|
|
8
|
+
interface Wallet {
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier of the Wallet.
|
|
11
|
+
*
|
|
12
|
+
* If not provided, the wallet name will be used as the identifier.
|
|
13
|
+
*/
|
|
14
|
+
readonly id?: string;
|
|
15
|
+
}
|
|
16
|
+
interface StandardConnectOutput {
|
|
17
|
+
supportedIntents?: string[];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
declare function signAndExecuteTransaction(wallet: WalletWithFeatures<Partial<HaneulWalletFeatures>>, input: HaneulSignAndExecuteTransactionInput): Promise<HaneulSignAndExecuteTransactionOutput>;
|
|
21
|
+
declare function signTransaction(wallet: WalletWithFeatures<Partial<HaneulWalletFeatures>>, input: HaneulSignTransactionInput): Promise<SignedTransaction>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { type Wallet$1 as Wallet, signAndExecuteTransaction, signTransaction };
|
|
24
|
+
//# sourceMappingURL=wallet.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.mts","names":[],"sources":["../src/wallet.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAY6B;;;IAAA,SAAA,EAAA,CAAA,EAAA,MAAA;EAAA;EAmBP,UAAA,qBAAyB,CAAA;IACX,gBAAA,CAAA,EAAA,MAAA,EAAA;EAAR;;AACgB,iBAFtB,yBAAA,CAEsB,MAAA,EADnC,kBACmC,CADhB,OACgB,CADR,oBACQ,CAAA,CAAA,EAAA,KAAA,EAApC,oCAAoC,CAAA,EAAA,OAAA,CAAA,qCAAA,CAAA;AAAA,iBA0CtB,eAAA,CA1CsB,MAAA,EA2CnC,kBA3CmC,CA2ChB,OA3CgB,CA2CR,oBA3CQ,CAAA,CAAA,EAAA,KAAA,EA4CpC,0BA5CoC,CAAA,EA4CV,OA5CU,CA4CV,iBAAA,CA5CU"}
|
package/dist/wallet.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { bcs } from "@haneullabs/haneul/bcs";
|
|
2
|
+
import { Transaction } from "@haneullabs/haneul/transactions";
|
|
3
|
+
import { fromBase64, toBase64 } from "@haneullabs/haneul/utils";
|
|
4
|
+
|
|
5
|
+
//#region src/wallet.ts
|
|
6
|
+
async function signAndExecuteTransaction(wallet, input) {
|
|
7
|
+
if (wallet.features["haneul:signAndExecuteTransaction"]) return wallet.features["haneul:signAndExecuteTransaction"].signAndExecuteTransaction(input);
|
|
8
|
+
if (!wallet.features["haneul:signAndExecuteTransactionBlock"]) throw new Error(`Provided wallet (${wallet.name}) does not support the signAndExecuteTransaction feature.`);
|
|
9
|
+
const { signAndExecuteTransactionBlock } = wallet.features["haneul:signAndExecuteTransactionBlock"];
|
|
10
|
+
const transactionBlock = Transaction.from(await input.transaction.toJSON());
|
|
11
|
+
const { digest, rawEffects, rawTransaction } = await signAndExecuteTransactionBlock({
|
|
12
|
+
account: input.account,
|
|
13
|
+
chain: input.chain,
|
|
14
|
+
transactionBlock,
|
|
15
|
+
options: {
|
|
16
|
+
showRawEffects: true,
|
|
17
|
+
showRawInput: true
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const [{ txSignatures: [signature], intentMessage: { value: bcsTransaction } }] = bcs.SenderSignedData.parse(fromBase64(rawTransaction));
|
|
21
|
+
return {
|
|
22
|
+
digest,
|
|
23
|
+
signature,
|
|
24
|
+
bytes: bcs.TransactionData.serialize(bcsTransaction).toBase64(),
|
|
25
|
+
effects: toBase64(new Uint8Array(rawEffects))
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function signTransaction(wallet, input) {
|
|
29
|
+
if (wallet.features["haneul:signTransaction"]) return wallet.features["haneul:signTransaction"].signTransaction(input);
|
|
30
|
+
if (!wallet.features["haneul:signTransactionBlock"]) throw new Error(`Provided wallet (${wallet.name}) does not support the signTransaction feature.`);
|
|
31
|
+
const { signTransactionBlock } = wallet.features["haneul:signTransactionBlock"];
|
|
32
|
+
const { transactionBlockBytes, signature } = await signTransactionBlock({
|
|
33
|
+
transactionBlock: Transaction.from(await input.transaction.toJSON()),
|
|
34
|
+
account: input.account,
|
|
35
|
+
chain: input.chain
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
bytes: transactionBlockBytes,
|
|
39
|
+
signature
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { signAndExecuteTransaction, signTransaction };
|
|
45
|
+
//# sourceMappingURL=wallet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.mjs","names":[],"sources":["../src/wallet.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@haneullabs/haneul/bcs';\nimport { Transaction } from '@haneullabs/haneul/transactions';\nimport { fromBase64, toBase64 } from '@haneullabs/haneul/utils';\nimport type { WalletWithFeatures } from '@wallet-standard/core';\n\nimport type {\n\tHaneulSignAndExecuteTransactionInput,\n\tHaneulSignTransactionInput,\n\tHaneulWalletFeatures,\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<HaneulWalletFeatures>>,\n\tinput: HaneulSignAndExecuteTransactionInput,\n) {\n\tif (wallet.features['haneul:signAndExecuteTransaction']) {\n\t\treturn wallet.features['haneul:signAndExecuteTransaction'].signAndExecuteTransaction(input);\n\t}\n\n\tif (!wallet.features['haneul: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['haneul:signAndExecuteTransactionBlock'];\n\n\tconst transactionBlock = Transaction.from(await input.transaction.toJSON());\n\tconst { digest, rawEffects, rawTransaction } = await signAndExecuteTransactionBlock({\n\t\taccount: input.account,\n\t\tchain: input.chain,\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(fromBase64(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: toBase64(new Uint8Array(rawEffects!)),\n\t};\n}\n\nexport async function signTransaction(\n\twallet: WalletWithFeatures<Partial<HaneulWalletFeatures>>,\n\tinput: HaneulSignTransactionInput,\n) {\n\tif (wallet.features['haneul:signTransaction']) {\n\t\treturn wallet.features['haneul:signTransaction'].signTransaction(input);\n\t}\n\n\tif (!wallet.features['haneul: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['haneul:signTransactionBlock'];\n\n\tconst transaction = Transaction.from(await input.transaction.toJSON());\n\tconst { transactionBlockBytes, signature } = await signTransactionBlock({\n\t\ttransactionBlock: transaction,\n\t\taccount: input.account,\n\t\tchain: input.chain,\n\t});\n\n\treturn { bytes: transactionBlockBytes, signature };\n}\n"],"mappings":";;;;;AA+BA,eAAsB,0BACrB,QACA,OACC;AACD,KAAI,OAAO,SAAS,oCACnB,QAAO,OAAO,SAAS,oCAAoC,0BAA0B,MAAM;AAG5F,KAAI,CAAC,OAAO,SAAS,yCACpB,OAAM,IAAI,MACT,oBAAoB,OAAO,KAAK,2DAChC;CAGF,MAAM,EAAE,mCAAmC,OAAO,SAAS;CAE3D,MAAM,mBAAmB,YAAY,KAAK,MAAM,MAAM,YAAY,QAAQ,CAAC;CAC3E,MAAM,EAAE,QAAQ,YAAY,mBAAmB,MAAM,+BAA+B;EACnF,SAAS,MAAM;EACf,OAAO,MAAM;EACb;EACA,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd;EACD,CAAC;CAEF,MAAM,CACL,EACC,cAAc,CAAC,YACf,eAAe,EAAE,OAAO,sBAEtB,IAAI,iBAAiB,MAAM,WAAW,eAAgB,CAAC;AAI3D,QAAO;EACN;EACA;EACA,OALa,IAAI,gBAAgB,UAAU,eAAe,CAAC,UAAU;EAMrE,SAAS,SAAS,IAAI,WAAW,WAAY,CAAC;EAC9C;;AAGF,eAAsB,gBACrB,QACA,OACC;AACD,KAAI,OAAO,SAAS,0BACnB,QAAO,OAAO,SAAS,0BAA0B,gBAAgB,MAAM;AAGxE,KAAI,CAAC,OAAO,SAAS,+BACpB,OAAM,IAAI,MACT,oBAAoB,OAAO,KAAK,iDAChC;CAGF,MAAM,EAAE,yBAAyB,OAAO,SAAS;CAGjD,MAAM,EAAE,uBAAuB,cAAc,MAAM,qBAAqB;EACvE,kBAFmB,YAAY,KAAK,MAAM,MAAM,YAAY,QAAQ,CAAC;EAGrE,SAAS,MAAM;EACf,OAAO,MAAM;EACb,CAAC;AAEF,QAAO;EAAE,OAAO;EAAuB;EAAW"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haneullabs/wallet-standard",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "A suite of standard utilities for implementing wallets based on the Wallet Standard.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"author": "Haneul Labs <build@
|
|
7
|
-
"type": "
|
|
8
|
-
"main": "./dist/
|
|
9
|
-
"
|
|
10
|
-
"types": "./dist/cjs/index.d.ts",
|
|
6
|
+
"author": "Haneul Labs <build@haneul-labs.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
11
10
|
"exports": {
|
|
12
11
|
".": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"sideEffects": false,
|
|
@@ -22,29 +22,31 @@
|
|
|
22
22
|
],
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/GeunhwaJeong/
|
|
25
|
+
"url": "git+https://github.com/GeunhwaJeong/ts-sdks.git"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/GeunhwaJeong/
|
|
28
|
+
"url": "https://github.com/GeunhwaJeong/ts-sdks/issues/new"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@wallet-standard/core": "1.1.1"
|
|
32
|
-
"@haneullabs/haneul": "0.1.0"
|
|
31
|
+
"@wallet-standard/core": "1.1.1"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"typescript": "^5.9.3",
|
|
36
|
-
"typescript-json-schema": "^0.67.
|
|
37
|
-
"@haneullabs/
|
|
35
|
+
"typescript-json-schema": "^0.67.1",
|
|
36
|
+
"@haneullabs/haneul": "2.4.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@haneullabs/haneul": "*"
|
|
38
40
|
},
|
|
39
41
|
"scripts": {
|
|
40
42
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
|
41
|
-
"build": "
|
|
43
|
+
"build": "rm -rf dist && tsc --noEmit && tsdown",
|
|
42
44
|
"prettier:check": "prettier -c --ignore-unknown .",
|
|
43
45
|
"prettier:fix": "prettier -w --ignore-unknown .",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"lint": "pnpm run
|
|
47
|
-
"lint:fix": "pnpm run
|
|
46
|
+
"oxlint:check": "oxlint .",
|
|
47
|
+
"oxlint:fix": "oxlint --fix",
|
|
48
|
+
"lint": "pnpm run oxlint:check && pnpm run prettier:check",
|
|
49
|
+
"lint:fix": "pnpm run oxlint:fix && pnpm run prettier:fix",
|
|
48
50
|
"json-schema": "typescript-json-schema src/types.ts SerializedTransactionDataV2 --required --strictNullChecks > serialized-transaction-data-v2.schema.json && prettier -w serialized-transaction-data-v2.schema.json"
|
|
49
51
|
}
|
|
50
52
|
}
|
package/src/chains.ts
CHANGED
|
@@ -10,7 +10,7 @@ export const HANEUL_DEVNET_CHAIN = 'haneul:devnet';
|
|
|
10
10
|
export const HANEUL_TESTNET_CHAIN = 'haneul:testnet';
|
|
11
11
|
|
|
12
12
|
/** Haneul Localnet */
|
|
13
|
-
export const
|
|
13
|
+
export const SUI_LOCALNET_CHAIN = 'haneul:localnet';
|
|
14
14
|
|
|
15
15
|
/** Haneul Mainnet */
|
|
16
16
|
export const HANEUL_MAINNET_CHAIN = 'haneul:mainnet';
|
|
@@ -18,7 +18,7 @@ export const HANEUL_MAINNET_CHAIN = 'haneul:mainnet';
|
|
|
18
18
|
export const HANEUL_CHAINS = [
|
|
19
19
|
HANEUL_DEVNET_CHAIN,
|
|
20
20
|
HANEUL_TESTNET_CHAIN,
|
|
21
|
-
|
|
21
|
+
SUI_LOCALNET_CHAIN,
|
|
22
22
|
HANEUL_MAINNET_CHAIN,
|
|
23
23
|
] as const;
|
|
24
24
|
|
|
@@ -28,6 +28,6 @@ export type HaneulChain = (typeof HANEUL_CHAINS)[number];
|
|
|
28
28
|
* Utility that returns whether or not a chain identifier is a valid Haneul chain.
|
|
29
29
|
* @param chain a chain identifier in the form of `${string}:{$string}`
|
|
30
30
|
*/
|
|
31
|
-
export function
|
|
31
|
+
export function isSuiChain(chain: IdentifierString): chain is HaneulChain {
|
|
32
32
|
return HANEUL_CHAINS.includes(chain as HaneulChain);
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
export const HaneulGetCapabilities = '
|
|
4
|
+
export const HaneulGetCapabilities = 'haneul:getCapabilities';
|
|
5
5
|
|
|
6
6
|
/** The latest API version of the getCapabilities API. */
|
|
7
7
|
export type HaneulGetCapabilitiesVersion = '1.0.0';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { SignedTransaction, HaneulSignTransactionInput } from './haneulSignTransaction.js';
|
|
5
5
|
|
|
6
6
|
/** Name of the feature. */
|
|
7
|
-
export const HaneulSignAndExecuteTransaction = '
|
|
7
|
+
export const HaneulSignAndExecuteTransaction = 'haneul:signAndExecuteTransaction';
|
|
8
8
|
|
|
9
9
|
/** The latest API version of the signAndExecuteTransactionBlock API. */
|
|
10
10
|
export type HaneulSignAndExecuteTransactionVersion = '2.0.0';
|
|
@@ -5,18 +5,18 @@ import type {
|
|
|
5
5
|
ExecuteTransactionRequestType,
|
|
6
6
|
HaneulTransactionBlockResponse,
|
|
7
7
|
HaneulTransactionBlockResponseOptions,
|
|
8
|
-
} from '@haneullabs/haneul/
|
|
8
|
+
} from '@haneullabs/haneul/jsonRpc';
|
|
9
9
|
|
|
10
10
|
import type { HaneulSignTransactionBlockInput } from './haneulSignTransactionBlock.js';
|
|
11
11
|
|
|
12
12
|
/** Name of the feature. */
|
|
13
|
-
export const HaneulSignAndExecuteTransactionBlock = '
|
|
13
|
+
export const HaneulSignAndExecuteTransactionBlock = 'haneul:signAndExecuteTransactionBlock';
|
|
14
14
|
|
|
15
15
|
/** The latest API version of the signAndExecuteTransactionBlock API. */
|
|
16
16
|
export type HaneulSignAndExecuteTransactionBlockVersion = '1.0.0';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @deprecated Use `
|
|
19
|
+
* @deprecated Use `haneul:signAndExecuteTransaction` instead.
|
|
20
20
|
*
|
|
21
21
|
* A Wallet Standard feature for signing a transaction, and submitting it to the
|
|
22
22
|
* network. The wallet is expected to submit the transaction to the network via RPC,
|
|
@@ -27,12 +27,12 @@ export type HaneulSignAndExecuteTransactionBlockFeature = {
|
|
|
27
27
|
[HaneulSignAndExecuteTransactionBlock]: {
|
|
28
28
|
/** Version of the feature API. */
|
|
29
29
|
version: HaneulSignAndExecuteTransactionBlockVersion;
|
|
30
|
-
/** @deprecated Use `
|
|
30
|
+
/** @deprecated Use `haneul:signAndExecuteTransaction` instead. */
|
|
31
31
|
signAndExecuteTransactionBlock: HaneulSignAndExecuteTransactionBlockMethod;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
/** @deprecated Use `
|
|
35
|
+
/** @deprecated Use `haneul:signAndExecuteTransaction` instead. */
|
|
36
36
|
export type HaneulSignAndExecuteTransactionBlockMethod = (
|
|
37
37
|
input: HaneulSignAndExecuteTransactionBlockInput,
|
|
38
38
|
) => Promise<HaneulSignAndExecuteTransactionBlockOutput>;
|
|
@@ -5,13 +5,13 @@ import type { WalletAccount } from '@wallet-standard/core';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Name of the feature.
|
|
8
|
-
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
8
|
+
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature
|
|
9
9
|
**/
|
|
10
|
-
export const HaneulSignMessage = '
|
|
10
|
+
export const HaneulSignMessage = 'haneul:signMessage';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The latest API version of the signMessage API.
|
|
14
|
-
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
14
|
+
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature
|
|
15
15
|
*/
|
|
16
16
|
export type HaneulSignMessageVersion = '1.0.0';
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ export type HaneulSignMessageVersion = '1.0.0';
|
|
|
19
19
|
* A Wallet Standard feature for signing a personal message, and returning the
|
|
20
20
|
* message bytes that were signed, and message signature.
|
|
21
21
|
*
|
|
22
|
-
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
22
|
+
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature
|
|
23
23
|
*/
|
|
24
24
|
export type HaneulSignMessageFeature = {
|
|
25
25
|
/** Namespace for the feature. */
|
|
@@ -30,12 +30,12 @@ export type HaneulSignMessageFeature = {
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
/** @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
33
|
+
/** @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature */
|
|
34
34
|
export type HaneulSignMessageMethod = (input: HaneulSignMessageInput) => Promise<HaneulSignMessageOutput>;
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Input for signing messages.
|
|
38
|
-
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
38
|
+
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature
|
|
39
39
|
*/
|
|
40
40
|
export interface HaneulSignMessageInput {
|
|
41
41
|
message: Uint8Array;
|
|
@@ -44,7 +44,7 @@ export interface HaneulSignMessageInput {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Output of signing messages.
|
|
47
|
-
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `
|
|
47
|
+
* @deprecated Wallets can still implement this method for compatibility, but this has been replaced by the `haneul:signPersonalMessage` feature
|
|
48
48
|
*/
|
|
49
49
|
export interface HaneulSignMessageOutput {
|
|
50
50
|
/** Base64 message bytes. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
5
5
|
|
|
6
6
|
/** Name of the feature. */
|
|
7
|
-
export const HaneulSignPersonalMessage = '
|
|
7
|
+
export const HaneulSignPersonalMessage = 'haneul:signPersonalMessage';
|
|
8
8
|
|
|
9
9
|
/** The latest API version of the signPersonalMessage API. */
|
|
10
10
|
export type HaneulSignPersonalMessageVersion = '1.1.0';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
5
5
|
|
|
6
6
|
/** Name of the feature. */
|
|
7
|
-
export const HaneulSignTransaction = '
|
|
7
|
+
export const HaneulSignTransaction = 'haneul:signTransaction';
|
|
8
8
|
|
|
9
9
|
/** The latest API version of the signTransaction API. */
|
|
10
10
|
export type HaneulSignTransactionVersion = '2.0.0';
|
|
@@ -5,13 +5,13 @@ import type { Transaction } from '@haneullabs/haneul/transactions';
|
|
|
5
5
|
import type { IdentifierString, WalletAccount } from '@wallet-standard/core';
|
|
6
6
|
|
|
7
7
|
/** Name of the feature. */
|
|
8
|
-
export const HaneulSignTransactionBlock = '
|
|
8
|
+
export const HaneulSignTransactionBlock = 'haneul:signTransactionBlock';
|
|
9
9
|
|
|
10
10
|
/** The latest API version of the signTransactionBlock API. */
|
|
11
11
|
export type HaneulSignTransactionBlockVersion = '1.0.0';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @deprecated Use `
|
|
14
|
+
* @deprecated Use `haneul:signTransaction` instead.
|
|
15
15
|
*
|
|
16
16
|
* A Wallet Standard feature for signing a transaction, and returning the
|
|
17
17
|
* serialized transaction and transaction signature.
|
|
@@ -21,12 +21,12 @@ export type HaneulSignTransactionBlockFeature = {
|
|
|
21
21
|
[HaneulSignTransactionBlock]: {
|
|
22
22
|
/** Version of the feature API. */
|
|
23
23
|
version: HaneulSignTransactionBlockVersion;
|
|
24
|
-
/** @deprecated Use `
|
|
24
|
+
/** @deprecated Use `haneul:signTransaction` instead. */
|
|
25
25
|
signTransactionBlock: HaneulSignTransactionBlockMethod;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/** @deprecated Use `
|
|
29
|
+
/** @deprecated Use `haneul:signTransaction` instead. */
|
|
30
30
|
export type HaneulSignTransactionBlockMethod = (
|
|
31
31
|
input: HaneulSignTransactionBlockInput,
|
|
32
32
|
) => Promise<HaneulSignTransactionBlockOutput>;
|
package/src/features/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
WalletWithFeatures,
|
|
10
10
|
} from '@wallet-standard/core';
|
|
11
11
|
|
|
12
|
-
import type { HaneulReportTransactionEffectsFeature } from './haneulReportTransactionEffects.js';
|
|
13
12
|
import type { HaneulSignAndExecuteTransactionFeature } from './haneulSignAndExecuteTransaction.js';
|
|
14
13
|
import type { HaneulSignAndExecuteTransactionBlockFeature } from './haneulSignAndExecuteTransactionBlock.js';
|
|
15
14
|
import type { HaneulSignMessageFeature } from './haneulSignMessage.js';
|
|
@@ -28,7 +27,6 @@ export type HaneulFeatures = Partial<HaneulSignTransactionBlockFeature> &
|
|
|
28
27
|
HaneulSignTransactionFeature &
|
|
29
28
|
// This deprecated feature should be removed once wallets update to the new method:
|
|
30
29
|
Partial<HaneulSignMessageFeature> &
|
|
31
|
-
Partial<HaneulReportTransactionEffectsFeature> &
|
|
32
30
|
Partial<HaneulGetCapabilitiesFeature>;
|
|
33
31
|
|
|
34
32
|
export type HaneulWalletFeatures = StandardConnectFeature &
|
|
@@ -37,7 +35,7 @@ export type HaneulWalletFeatures = StandardConnectFeature &
|
|
|
37
35
|
// Disconnect is an optional feature:
|
|
38
36
|
Partial<StandardDisconnectFeature>;
|
|
39
37
|
|
|
40
|
-
export type
|
|
38
|
+
export type WalletWithSuiFeatures = WalletWithFeatures<HaneulWalletFeatures>;
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
41
|
* Represents a wallet with the absolute minimum feature set required to function in the Haneul ecosystem.
|
|
@@ -57,5 +55,4 @@ export * from './haneulSignTransaction.js';
|
|
|
57
55
|
export * from './haneulSignAndExecuteTransactionBlock.js';
|
|
58
56
|
export * from './haneulSignAndExecuteTransaction.js';
|
|
59
57
|
export * from './haneulSignPersonalMessage.js';
|
|
60
|
-
export * from './haneulReportTransactionEffects.js';
|
|
61
58
|
export * from './haneulGetCapabilities.js';
|
package/src/types.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface GasData {
|
|
|
9
9
|
price: string | number | null;
|
|
10
10
|
/** The owner of the gas coins used to fund the transactions, this is either the sender or the gas sponsor */
|
|
11
11
|
owner: string | null;
|
|
12
|
-
/** The list of
|
|
12
|
+
/** The list of HANEUL coins to fund the transaction */
|
|
13
13
|
payment: { objectId: string; version: string; digest: string }[] | null;
|
|
14
14
|
}
|
|
15
15
|
|
package/src/wallet.ts
CHANGED
|
@@ -33,17 +33,17 @@ export async function signAndExecuteTransaction(
|
|
|
33
33
|
wallet: WalletWithFeatures<Partial<HaneulWalletFeatures>>,
|
|
34
34
|
input: HaneulSignAndExecuteTransactionInput,
|
|
35
35
|
) {
|
|
36
|
-
if (wallet.features['
|
|
37
|
-
return wallet.features['
|
|
36
|
+
if (wallet.features['haneul:signAndExecuteTransaction']) {
|
|
37
|
+
return wallet.features['haneul:signAndExecuteTransaction'].signAndExecuteTransaction(input);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (!wallet.features['
|
|
40
|
+
if (!wallet.features['haneul:signAndExecuteTransactionBlock']) {
|
|
41
41
|
throw new Error(
|
|
42
42
|
`Provided wallet (${wallet.name}) does not support the signAndExecuteTransaction feature.`,
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const { signAndExecuteTransactionBlock } = wallet.features['
|
|
46
|
+
const { signAndExecuteTransactionBlock } = wallet.features['haneul:signAndExecuteTransactionBlock'];
|
|
47
47
|
|
|
48
48
|
const transactionBlock = Transaction.from(await input.transaction.toJSON());
|
|
49
49
|
const { digest, rawEffects, rawTransaction } = await signAndExecuteTransactionBlock({
|
|
@@ -77,17 +77,17 @@ export async function signTransaction(
|
|
|
77
77
|
wallet: WalletWithFeatures<Partial<HaneulWalletFeatures>>,
|
|
78
78
|
input: HaneulSignTransactionInput,
|
|
79
79
|
) {
|
|
80
|
-
if (wallet.features['
|
|
81
|
-
return wallet.features['
|
|
80
|
+
if (wallet.features['haneul:signTransaction']) {
|
|
81
|
+
return wallet.features['haneul:signTransaction'].signTransaction(input);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (!wallet.features['
|
|
84
|
+
if (!wallet.features['haneul:signTransactionBlock']) {
|
|
85
85
|
throw new Error(
|
|
86
86
|
`Provided wallet (${wallet.name}) does not support the signTransaction feature.`,
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const { signTransactionBlock } = wallet.features['
|
|
90
|
+
const { signTransactionBlock } = wallet.features['haneul:signTransactionBlock'];
|
|
91
91
|
|
|
92
92
|
const transaction = Transaction.from(await input.transaction.toJSON());
|
|
93
93
|
const { transactionBlockBytes, signature } = await signTransactionBlock({
|
package/dist/cjs/chains.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IdentifierString } from '@wallet-standard/core';
|
|
2
|
-
/** Haneul Devnet */
|
|
3
|
-
export declare const HANEUL_DEVNET_CHAIN = "haneul:devnet";
|
|
4
|
-
/** Haneul Testnet */
|
|
5
|
-
export declare const HANEUL_TESTNET_CHAIN = "haneul:testnet";
|
|
6
|
-
/** Haneul Localnet */
|
|
7
|
-
export declare const HANEUL_LOCALNET_CHAIN = "haneul:localnet";
|
|
8
|
-
/** Haneul Mainnet */
|
|
9
|
-
export declare const HANEUL_MAINNET_CHAIN = "haneul:mainnet";
|
|
10
|
-
export declare const HANEUL_CHAINS: readonly ["haneul:devnet", "haneul:testnet", "haneul:localnet", "haneul:mainnet"];
|
|
11
|
-
export type HaneulChain = (typeof HANEUL_CHAINS)[number];
|
|
12
|
-
/**
|
|
13
|
-
* Utility that returns whether or not a chain identifier is a valid Haneul chain.
|
|
14
|
-
* @param chain a chain identifier in the form of `${string}:{$string}`
|
|
15
|
-
*/
|
|
16
|
-
export declare function isHaneulChain(chain: IdentifierString): chain is HaneulChain;
|
package/dist/cjs/chains.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var chains_exports = {};
|
|
20
|
-
__export(chains_exports, {
|
|
21
|
-
HANEUL_CHAINS: () => HANEUL_CHAINS,
|
|
22
|
-
HANEUL_DEVNET_CHAIN: () => HANEUL_DEVNET_CHAIN,
|
|
23
|
-
HANEUL_LOCALNET_CHAIN: () => HANEUL_LOCALNET_CHAIN,
|
|
24
|
-
HANEUL_MAINNET_CHAIN: () => HANEUL_MAINNET_CHAIN,
|
|
25
|
-
HANEUL_TESTNET_CHAIN: () => HANEUL_TESTNET_CHAIN,
|
|
26
|
-
isHaneulChain: () => isHaneulChain
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(chains_exports);
|
|
29
|
-
const HANEUL_DEVNET_CHAIN = "haneul:devnet";
|
|
30
|
-
const HANEUL_TESTNET_CHAIN = "haneul:testnet";
|
|
31
|
-
const HANEUL_LOCALNET_CHAIN = "haneul:localnet";
|
|
32
|
-
const HANEUL_MAINNET_CHAIN = "haneul:mainnet";
|
|
33
|
-
const HANEUL_CHAINS = [
|
|
34
|
-
HANEUL_DEVNET_CHAIN,
|
|
35
|
-
HANEUL_TESTNET_CHAIN,
|
|
36
|
-
HANEUL_LOCALNET_CHAIN,
|
|
37
|
-
HANEUL_MAINNET_CHAIN
|
|
38
|
-
];
|
|
39
|
-
function isHaneulChain(chain) {
|
|
40
|
-
return HANEUL_CHAINS.includes(chain);
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=chains.js.map
|