@rango-dev/signer-sui 0.0.0-experimental-214d73c7-20260922
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 +71 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/signer.d.ts +13 -0
- package/dist/signer.d.ts.map +1 -0
- package/package.json +38 -0
- package/readme.md +3 -0
- package/src/index.ts +1 -0
- package/src/signer.ts +64 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# [0.12.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.11.0...signer-sui@0.12.0) (2026-09-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ship dist and changelog when publishing with npm ([0a8bd5d](https://github.com/rango-exchange/rango-client/commit/0a8bd5d779bd652b6ca7195cda4ce465ba196f0e))
|
|
7
|
+
# [0.11.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.10.0...signer-sui@0.11.0) (2026-08-18)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **signer-sui:** throw SignerError on sign rejection ([46561bd](https://github.com/rango-exchange/rango-client/commit/46561bda59cba4ad50388b5e22a1b44dc25b1d95))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# [0.10.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.9.1...signer-sui@0.10.0) (2026-05-31)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [0.9.1](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.9.0...signer-sui@0.9.1) (2026-05-02)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# [0.9.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.8.0...signer-sui@0.9.0) (2026-04-29)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [0.8.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.7.0...signer-sui@0.8.0) (2025-08-19)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.6.0...signer-sui@0.7.0) (2025-08-05)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.5.0...signer-sui@0.6.0) (2025-07-22)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Reverts
|
|
40
|
+
|
|
41
|
+
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [0.4.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.3.0...signer-sui@0.4.0) (2025-06-09)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [0.3.0](https://github.com/rango-exchange/rango-client/compare/signer-sui@0.2.0...signer-sui@0.3.0) (2025-04-30)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# 0.2.0 (2025-03-11)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* creating a signer package for sui ([de9b976](https://github.com/rango-exchange/rango-client/commit/de9b9764a7474e3ee446da5d28da35c209997580))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var c=Object.defineProperty;var o=(n,r)=>c(n,"name",{value:r,configurable:!0});import{Transaction as u}from"@mysten/sui/transactions";import{SUI_MAINNET_CHAIN as p}from"@mysten/wallet-standard";import{SignerError as d,SignerErrorCode as g}from"rango-types";var t=class{static{o(this,"DefaultSuiSigner")}provider;constructor(r){this.provider=r}async signMessage(){throw d.UnimplementedError("signMessage")}async signAndSendTx(r){let i=u.from(r.unsignedPtbBase64),s=i.getData().sender;if(!s)throw new Error("Your transaction should includes a Sender.");let a=this.provider.accounts.find(e=>e.address===s);if(!a)throw new Error("Your current address on wallet is not matched with what has been set in transaction.");try{return{hash:(await this.provider.features["sui:signAndExecuteTransaction"].signAndExecuteTransaction({account:a,transaction:i,chain:p})).digest}}catch(e){throw new d(g.SEND_TX_ERROR,void 0,e)}}};export{t as DefaultSuiSigner};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/signer.ts"],
|
|
4
|
+
"sourcesContent": ["import type { GenericSigner } from 'rango-types';\nimport type { SuiTransaction } from 'rango-types/mainApi';\n\nimport { Transaction } from '@mysten/sui/transactions';\nimport {\n SUI_MAINNET_CHAIN,\n type SuiFeatures,\n type WalletWithFeatures,\n} from '@mysten/wallet-standard';\nimport { SignerError, SignerErrorCode } from 'rango-types';\n\nexport type SuiWalletStandard = WalletWithFeatures<SuiFeatures>;\n\nexport class DefaultSuiSigner implements GenericSigner<SuiTransaction> {\n private provider: SuiWalletStandard;\n\n constructor(provider: SuiWalletStandard) {\n this.provider = provider;\n }\n\n public async signMessage(): Promise<string> {\n /*\n * TODO: Can be implemented by sui:signPersonalMessage feature.\n * @see https://docs.sui.io/standards/wallet-standard#implementing-features\n */\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: SuiTransaction): Promise<{ hash: string }> {\n const transaction = Transaction.from(tx.unsignedPtbBase64);\n\n // TODO: Double check with team to ensure this assumption is correct\n const senderAddress = transaction.getData().sender;\n if (!senderAddress) {\n throw new Error('Your transaction should includes a Sender.');\n }\n\n const account = this.provider.accounts.find(\n (account) => account.address === senderAddress\n );\n\n if (!account) {\n throw new Error(\n 'Your current address on wallet is not matched with what has been set in transaction.'\n );\n }\n\n try {\n const signed = await this.provider.features[\n 'sui:signAndExecuteTransaction'\n ].signAndExecuteTransaction({\n account,\n transaction,\n chain: SUI_MAINNET_CHAIN,\n });\n\n return {\n hash: signed.digest,\n };\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAGA,OAAS,eAAAA,MAAmB,2BAC5B,OACE,qBAAAC,MAGK,0BACP,OAAS,eAAAC,EAAa,mBAAAC,MAAuB,cAItC,IAAMC,EAAN,KAAgE,CAbvE,MAauE,CAAAC,EAAA,yBAC7D,SAER,YAAYC,EAA6B,CACvC,KAAK,SAAWA,CAClB,CAEA,MAAa,aAA+B,CAK1C,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAA+C,CACjE,IAAMC,EAAcC,EAAY,KAAKF,EAAG,iBAAiB,EAGnDG,EAAgBF,EAAY,QAAQ,EAAE,OAC5C,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,4CAA4C,EAG9D,IAAMC,EAAU,KAAK,SAAS,SAAS,KACpCA,GAAYA,EAAQ,UAAYD,CACnC,EAEA,GAAI,CAACC,EACH,MAAM,IAAI,MACR,sFACF,EAGF,GAAI,CASF,MAAO,CACL,MATa,MAAM,KAAK,SAAS,SACjC,+BACF,EAAE,0BAA0B,CAC1B,QAAAA,EACA,YAAAH,EACA,MAAOI,CACT,CAAC,GAGc,MACf,CACF,OAASC,EAAO,CACd,MAAM,IAAIP,EAAYQ,EAAgB,cAAe,OAAWD,CAAK,CACvE,CACF,CACF",
|
|
6
|
+
"names": ["Transaction", "SUI_MAINNET_CHAIN", "SignerError", "SignerErrorCode", "DefaultSuiSigner", "__name", "provider", "SignerError", "tx", "transaction", "Transaction", "senderAddress", "account", "SUI_MAINNET_CHAIN", "error", "SignerErrorCode"]
|
|
7
|
+
}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GenericSigner } from 'rango-types';
|
|
2
|
+
import type { SuiTransaction } from 'rango-types/mainApi';
|
|
3
|
+
import { type SuiFeatures, type WalletWithFeatures } from '@mysten/wallet-standard';
|
|
4
|
+
export type SuiWalletStandard = WalletWithFeatures<SuiFeatures>;
|
|
5
|
+
export declare class DefaultSuiSigner implements GenericSigner<SuiTransaction> {
|
|
6
|
+
private provider;
|
|
7
|
+
constructor(provider: SuiWalletStandard);
|
|
8
|
+
signMessage(): Promise<string>;
|
|
9
|
+
signAndSendTx(tx: SuiTransaction): Promise<{
|
|
10
|
+
hash: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEhE,qBAAa,gBAAiB,YAAW,aAAa,CAAC,cAAc,CAAC;IACpE,OAAO,CAAC,QAAQ,CAAoB;gBAExB,QAAQ,EAAE,iBAAiB;IAI1B,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAQrC,aAAa,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAmCnE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rango-dev/signer-sui",
|
|
3
|
+
"version": "0.0.0-experimental-214d73c7-20260922",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"typings": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"src",
|
|
15
|
+
"CHANGELOG.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "yarn run rangutopia library build",
|
|
19
|
+
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
|
22
|
+
"lint": "eslint \"**/*.{ts,tsx}\""
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"rango-types": "0.0.0-experimental-009f8a4d-20260921"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@mysten/sui": "^1.21.2",
|
|
29
|
+
"@mysten/wallet-standard": "^0.13.26"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@mysten/sui": "^1.21.2",
|
|
33
|
+
"@mysten/wallet-standard": "^0.13.26"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/readme.md
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DefaultSuiSigner } from './signer.js';
|
package/src/signer.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { GenericSigner } from 'rango-types';
|
|
2
|
+
import type { SuiTransaction } from 'rango-types/mainApi';
|
|
3
|
+
|
|
4
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
import {
|
|
6
|
+
SUI_MAINNET_CHAIN,
|
|
7
|
+
type SuiFeatures,
|
|
8
|
+
type WalletWithFeatures,
|
|
9
|
+
} from '@mysten/wallet-standard';
|
|
10
|
+
import { SignerError, SignerErrorCode } from 'rango-types';
|
|
11
|
+
|
|
12
|
+
export type SuiWalletStandard = WalletWithFeatures<SuiFeatures>;
|
|
13
|
+
|
|
14
|
+
export class DefaultSuiSigner implements GenericSigner<SuiTransaction> {
|
|
15
|
+
private provider: SuiWalletStandard;
|
|
16
|
+
|
|
17
|
+
constructor(provider: SuiWalletStandard) {
|
|
18
|
+
this.provider = provider;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public async signMessage(): Promise<string> {
|
|
22
|
+
/*
|
|
23
|
+
* TODO: Can be implemented by sui:signPersonalMessage feature.
|
|
24
|
+
* @see https://docs.sui.io/standards/wallet-standard#implementing-features
|
|
25
|
+
*/
|
|
26
|
+
throw SignerError.UnimplementedError('signMessage');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async signAndSendTx(tx: SuiTransaction): Promise<{ hash: string }> {
|
|
30
|
+
const transaction = Transaction.from(tx.unsignedPtbBase64);
|
|
31
|
+
|
|
32
|
+
// TODO: Double check with team to ensure this assumption is correct
|
|
33
|
+
const senderAddress = transaction.getData().sender;
|
|
34
|
+
if (!senderAddress) {
|
|
35
|
+
throw new Error('Your transaction should includes a Sender.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const account = this.provider.accounts.find(
|
|
39
|
+
(account) => account.address === senderAddress
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!account) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
'Your current address on wallet is not matched with what has been set in transaction.'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const signed = await this.provider.features[
|
|
50
|
+
'sui:signAndExecuteTransaction'
|
|
51
|
+
].signAndExecuteTransaction({
|
|
52
|
+
account,
|
|
53
|
+
transaction,
|
|
54
|
+
chain: SUI_MAINNET_CHAIN,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
hash: signed.digest,
|
|
59
|
+
};
|
|
60
|
+
} catch (error) {
|
|
61
|
+
throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|