@rango-dev/provider-slush 0.0.2-next.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.
@@ -0,0 +1,5 @@
1
+ import { type ProviderInfo } from '@rango-dev/wallets-core';
2
+ export declare const WALLET_ID = "slush";
3
+ export declare const WALLET_NAME_IN_WALLET_STANDARD = "Slush";
4
+ export declare const info: ProviderInfo;
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAO5D,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,8BAA8B,UAAU,CAAC;AAEtD,eAAO,MAAM,IAAI,EAAE,YA+BlB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
2
+ import type { SignerFactory } from 'rango-types';
3
+ import { WalletTypes } from '@rango-dev/wallets-shared';
4
+ import { suiWalletInstance } from '../utils.js';
5
+ type Provider = any;
6
+ export declare const config: {
7
+ type: WalletTypes;
8
+ };
9
+ export declare const getInstance: typeof suiWalletInstance;
10
+ export declare const getSigners: (provider: Provider) => Promise<SignerFactory>;
11
+ declare const buildLegacyProvider: () => LegacyProviderInterface;
12
+ export { buildLegacyProvider };
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/legacy/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,KAAK,QAAQ,GAAG,GAAG,CAAC;AAEpB,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,WAAW,0BAAoB,CAAC;AAM7C,eAAO,MAAM,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,aAAa,CAC9D,CAAC;AAMT,QAAA,MAAM,mBAAmB,EAAE,MAAM,uBAM/B,CAAC;AAEH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SignerFactory } from 'rango-types';
2
+ export default function getSigners(): Promise<SignerFactory>;
3
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/legacy/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,wBAA8B,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAOjE"}
package/dist/mod.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const versions: () => import("@rango-dev/wallets-core/utils").VersionedProviders;
2
+ export { versions };
3
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,QAAQ,kEAIF,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/dist/mod.js ADDED
@@ -0,0 +1,2 @@
1
+ var u=Object.defineProperty;var e=(t,o)=>u(t,"name",{value:o,configurable:!0});import{defineVersions as N}from"@rango-dev/wallets-core/utils";import{WalletTypes as b}from"@rango-dev/wallets-shared";import"@mysten/wallet-standard";import{getInstanceOrThrow as g}from"@rango-dev/wallets-core/namespaces/sui";import"@rango-dev/wallets-core";import{TransactionType as f}from"rango-types";var i="slush",r="Slush",c={name:"Slush",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/slush/icon.svg",extensions:{chrome:"https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",edge:"https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",brave:"https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil",homepage:"https://slush.app/download"},properties:[{name:"namespaces",value:{data:[{label:"Sui",value:"Sui",id:"SUI",getSupportedChains:t=>t.filter(o=>o.type===f.SUI)}],selection:"multiple"}}]};function n(){try{return g(r)}catch{return null}}e(n,"suiWalletInstance");import{getInstanceOrThrow as S}from"@rango-dev/wallets-core/namespaces/sui";import{DefaultSignerFactory as h,TransactionType as y}from"rango-types";async function a(){let t=S(r),{DefaultSuiSigner:o}=await import("@rango-dev/signer-sui"),s=new h;return s.registerSigner(y.SUI,new o(t)),s}e(a,"getSigners");var L=b.SLUSH,W={type:L},A=n,E=e(async()=>{throw new Error("not implemented")},"connect"),v=a,T=e(()=>{throw new Error("not implemented")},"getWalletInfo"),l=e(()=>({config:W,getInstance:A,connect:E,getSigners:v,getWalletInfo:T}),"buildLegacyProvider");import{ProviderBuilder as P}from"@rango-dev/wallets-core";import{NamespaceBuilder as w}from"@rango-dev/wallets-core";import{builders as I}from"@rango-dev/wallets-core/namespaces/common";import{actions as _,builders as p}from"@rango-dev/wallets-core/namespaces/sui";var D=p.canEagerConnect().action(_.canEagerConnect({name:r})).build(),F=p.connect({name:r}).build(),x=I.disconnect().before(async()=>{await n()?.features["standard:disconnect"].disconnect()}).build(),m=new w("Sui",i).action(F).action(x).action(D).build();var d=e(()=>new P(i).init(function(t){let[,o]=t.state();n()&&(o("installed",!0),console.debug("[slush] instance detected.",t))}).config("info",c).add("sui",m).build(),"buildProvider");var fe=e(()=>N().version("0.0.0",l()).version("1.0.0",d()).build(),"versions");export{fe as versions};
2
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/mod.ts", "../src/legacy/index.ts", "../src/utils.ts", "../src/constants.ts", "../src/legacy/signer.ts", "../src/provider.ts", "../src/namespaces/sui.ts"],
4
+ "sourcesContent": ["import { defineVersions } from '@rango-dev/wallets-core/utils';\n\nimport { buildLegacyProvider } from './legacy/index.js';\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions()\n .version('0.0.0', buildLegacyProvider())\n .version('1.0.0', buildProvider())\n .build();\n\nexport { versions };\n", "import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';\nimport type { Connect, WalletInfo } from '@rango-dev/wallets-shared';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\n\nimport { WalletTypes } from '@rango-dev/wallets-shared';\n\nimport { suiWalletInstance } from '../utils.js';\n\nimport signer from './signer.js';\n\nconst WALLET = WalletTypes.SLUSH;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Provider = any;\n\nexport const config = {\n type: WALLET,\n};\n\nexport const getInstance = suiWalletInstance;\n\nconst connect: Connect = async () => {\n throw new Error('not implemented');\n};\n\nexport const getSigners: (provider: Provider) => Promise<SignerFactory> =\n signer;\n\nconst getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = () => {\n throw new Error('not implemented');\n};\n\nconst buildLegacyProvider: () => LegacyProviderInterface = () => ({\n config,\n getInstance,\n connect,\n getSigners,\n getWalletInfo,\n});\n\nexport { buildLegacyProvider };\n", "import {\n type StandardConnectFeature,\n type StandardDisconnectFeature,\n type StandardEventsFeature,\n type SuiFeatures,\n type WalletWithFeatures,\n} from '@mysten/wallet-standard';\nimport { getInstanceOrThrow } from '@rango-dev/wallets-core/namespaces/sui';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';\n\ntype SuiWalletStandard = WalletWithFeatures<\n StandardConnectFeature &\n StandardEventsFeature &\n SuiFeatures &\n StandardDisconnectFeature\n>;\n\nexport function suiWalletInstance(): SuiWalletStandard | null {\n try {\n return getInstanceOrThrow(\n WALLET_NAME_IN_WALLET_STANDARD\n ) as SuiWalletStandard;\n } catch {\n return null;\n }\n}\n", "import { type ProviderInfo } from '@rango-dev/wallets-core';\nimport {\n type BlockchainMeta,\n type SuiBlockchainMeta,\n TransactionType,\n} from 'rango-types';\n\nexport const WALLET_ID = 'slush';\nexport const WALLET_NAME_IN_WALLET_STANDARD = 'Slush';\n\nexport const info: ProviderInfo = {\n name: 'Slush',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/slush/icon.svg',\n extensions: {\n chrome:\n 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',\n edge: 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',\n brave:\n 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',\n homepage: 'https://slush.app/download',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n data: [\n {\n label: 'Sui',\n value: 'Sui',\n id: 'SUI',\n getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter(\n (chain): chain is SuiBlockchainMeta =>\n chain.type === TransactionType.SUI\n ),\n },\n ],\n selection: 'multiple',\n },\n },\n ],\n};\n", "import type { SignerFactory } from 'rango-types';\n\nimport { getInstanceOrThrow } from '@rango-dev/wallets-core/namespaces/sui';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\n\nexport default async function getSigners(): Promise<SignerFactory> {\n const suiWalletProvider = getInstanceOrThrow(WALLET_NAME_IN_WALLET_STANDARD);\n\n const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');\n const signers = new DefaultSignerFactory();\n signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiWalletProvider));\n return signers;\n}\n", "import { ProviderBuilder } from '@rango-dev/wallets-core';\n\nimport { info, WALLET_ID } from './constants.js';\nimport { sui } from './namespaces/sui.js';\nimport { suiWalletInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n if (suiWalletInstance()) {\n setState('installed', true);\n console.debug('[slush] instance detected.', context);\n }\n })\n .config('info', info)\n .add('sui', sui)\n .build();\n\nexport { buildProvider };\n", "import type { SuiActions } from '@rango-dev/wallets-core/namespaces/sui';\n\nimport { NamespaceBuilder } from '@rango-dev/wallets-core';\nimport { builders as commonBuilders } from '@rango-dev/wallets-core/namespaces/common';\nimport { actions, builders } from '@rango-dev/wallets-core/namespaces/sui';\n\nimport { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\nimport { suiWalletInstance } from '../utils.js';\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(\n actions.canEagerConnect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n )\n .build();\n\nconst connect = builders\n .connect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SuiActions>()\n /*\n * This addresses a wallet bug where changing accounts within the app\n * and then reconnecting results in a connection to the previously connected account.\n * Explicitly calling `disconnect()` on the wallet instance ensures the wallet\n * itself is disconnected, allowing for a proper connection to the intended account\n * upon subsequent reconnection.\n */\n .before(async () => {\n await suiWalletInstance()?.features['standard:disconnect'].disconnect();\n })\n .build();\n\nconst sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { sui };\n"],
5
+ "mappings": "+EAAA,OAAS,kBAAAA,MAAsB,gCCI/B,OAAS,eAAAC,MAAmB,4BCJ5B,MAMO,0BACP,OAAS,sBAAAC,MAA0B,yCCPnC,MAAkC,0BAClC,OAGE,mBAAAC,MACK,cAEA,IAAMC,EAAY,QACZC,EAAiC,QAEjCC,EAAqB,CAChC,KAAM,QACN,KAAM,sFACN,WAAY,CACV,OACE,yGACF,KAAM,yGACN,MACE,yGACF,SAAU,4BACZ,EACA,WAAY,CACV,CACE,KAAM,aACN,MAAO,CACL,KAAM,CACJ,CACE,MAAO,MACP,MAAO,MACP,GAAI,MACJ,mBAAqBC,GACnBA,EAAe,OACZC,GACCA,EAAM,OAASL,EAAgB,GACnC,CACJ,CACF,EACA,UAAW,UACb,CACF,CACF,CACF,EDvBO,SAASM,GAA8C,CAC5D,GAAI,CACF,OAAOC,EACLC,CACF,CACF,MAAQ,CACN,OAAO,IACT,CACF,CARgBC,EAAAH,EAAA,qBEhBhB,OAAS,sBAAAI,MAA0B,yCACnC,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAIhE,eAAOC,GAA4D,CACjE,IAAMC,EAAoBC,EAAmBC,CAA8B,EAErE,CAAE,iBAAAC,CAAiB,EAAI,KAAM,QAAO,uBAAuB,EAC3DC,EAAU,IAAIC,EACpB,OAAAD,EAAQ,eAAeE,EAAO,IAAK,IAAIH,EAAiBH,CAAiB,CAAC,EACnEI,CACT,CAP8BG,EAAAR,EAAA,cHG9B,IAAMS,EAASC,EAAY,MAKdC,EAAS,CACpB,KAAMF,CACR,EAEaG,EAAcC,EAErBC,EAAmBC,EAAA,SAAY,CACnC,MAAM,IAAI,MAAM,iBAAiB,CACnC,EAFyB,WAIZC,EACXA,EAEIC,EAAkEF,EAAA,IAAM,CAC5E,MAAM,IAAI,MAAM,iBAAiB,CACnC,EAFwE,iBAIlEG,EAAqDH,EAAA,KAAO,CAChE,OAAAJ,EACA,YAAAC,EACA,QAAAE,EACA,WAAAE,EACA,cAAAC,CACF,GAN2D,uBIhC3D,OAAS,mBAAAE,MAAuB,0BCEhC,OAAS,oBAAAC,MAAwB,0BACjC,OAAS,YAAYC,MAAsB,4CAC3C,OAAS,WAAAC,EAAS,YAAAC,MAAgB,yCAKlC,IAAMC,EAAkBC,EACrB,gBAAgB,EAChB,OACCC,EAAQ,gBAAgB,CACtB,KAAMC,CACR,CAAC,CACH,EACC,MAAM,EAEHC,EAAUH,EACb,QAAQ,CACP,KAAME,CACR,CAAC,EACA,MAAM,EAEHE,EAAaC,EAChB,WAAuB,EAQvB,OAAO,SAAY,CAClB,MAAMC,EAAkB,GAAG,SAAS,qBAAqB,EAAE,WAAW,CACxE,CAAC,EACA,MAAM,EAEHC,EAAM,IAAIC,EAA6B,MAAOC,CAAS,EAC1D,OAAON,CAAO,EACd,OAAOC,CAAU,EACjB,OAAOL,CAAe,EACtB,MAAM,EDpCT,IAAMW,EAAgBC,EAAA,IACpB,IAAIC,EAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAAS,CACvB,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EAC/BE,EAAkB,IACpBD,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,6BAA8BD,CAAO,EAEvD,CAAC,EACA,OAAO,OAAQG,CAAI,EACnB,IAAI,MAAOC,CAAG,EACd,MAAM,EAXW,iBLDtB,IAAMC,GAAWC,EAAA,IACfC,EAAe,EACZ,QAAQ,QAASC,EAAoB,CAAC,EACtC,QAAQ,QAASC,EAAc,CAAC,EAChC,MAAM,EAJM",
6
+ "names": ["defineVersions", "WalletTypes", "getInstanceOrThrow", "TransactionType", "WALLET_ID", "WALLET_NAME_IN_WALLET_STANDARD", "info", "allBlockchains", "chain", "suiWalletInstance", "getInstanceOrThrow", "WALLET_NAME_IN_WALLET_STANDARD", "__name", "getInstanceOrThrow", "DefaultSignerFactory", "TxType", "getSigners", "suiWalletProvider", "getInstanceOrThrow", "WALLET_NAME_IN_WALLET_STANDARD", "DefaultSuiSigner", "signers", "DefaultSignerFactory", "TxType", "__name", "WALLET", "WalletTypes", "config", "getInstance", "suiWalletInstance", "connect", "__name", "getSigners", "getWalletInfo", "buildLegacyProvider", "ProviderBuilder", "NamespaceBuilder", "commonBuilders", "actions", "builders", "canEagerConnect", "builders", "actions", "WALLET_NAME_IN_WALLET_STANDARD", "connect", "disconnect", "commonBuilders", "suiWalletInstance", "sui", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "suiWalletInstance", "info", "sui", "versions", "__name", "defineVersions", "buildLegacyProvider", "buildProvider"]
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { SuiActions } from '@rango-dev/wallets-core/namespaces/sui';
2
+ declare const sui: import("@rango-dev/wallets-core").ProxiedNamespace<SuiActions>;
3
+ export { sui };
4
+ //# sourceMappingURL=sui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../src/namespaces/sui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAsCzE,QAAA,MAAM,GAAG,gEAIC,CAAC;AAEX,OAAO,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/constants.ts":{"bytes":1304,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":684,"imports":[{"path":"@mysten/wallet-standard","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/signer.ts":{"bytes":640,"imports":[{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"},{"path":"@rango-dev/signer-sui","kind":"dynamic-import","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/index.ts":{"bytes":1030,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/legacy/signer.ts","kind":"import-statement","original":"./signer.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui.ts":{"bytes":1406,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/common","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/provider.ts":{"bytes":573,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/sui.ts","kind":"import-statement","original":"./namespaces/sui.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/mod.ts":{"bytes":332,"imports":[{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"src/legacy/index.ts","kind":"import-statement","original":"./legacy/index.js"},{"path":"src/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9406},"dist/mod.js":{"imports":[{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"@mysten/wallet-standard","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-sui","kind":"dynamic-import","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/common","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/namespaces/sui","kind":"import-statement","external":true}],"exports":["versions"],"entryPoint":"src/mod.ts","inputs":{"src/mod.ts":{"bytesInOutput":142},"src/legacy/index.ts":{"bytesInOutput":309},"src/utils.ts":{"bytesInOutput":181},"src/constants.ts":{"bytesInOutput":748},"src/legacy/signer.ts":{"bytesInOutput":305},"src/provider.ts":{"bytesInOutput":242},"src/namespaces/sui.ts":{"bytesInOutput":462}},"bytes":2524}}}
@@ -0,0 +1,3 @@
1
+ declare const buildProvider: () => import("@rango-dev/wallets-core").Provider;
2
+ export { buildProvider };
3
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,aAAa,kDAWP,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type StandardConnectFeature, type StandardDisconnectFeature, type StandardEventsFeature, type SuiFeatures, type WalletWithFeatures } from '@mysten/wallet-standard';
2
+ type SuiWalletStandard = WalletWithFeatures<StandardConnectFeature & StandardEventsFeature & SuiFeatures & StandardDisconnectFeature>;
3
+ export declare function suiWalletInstance(): SuiWalletStandard | null;
4
+ export {};
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAKjC,KAAK,iBAAiB,GAAG,kBAAkB,CACzC,sBAAsB,GACpB,qBAAqB,GACrB,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAQ5D"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@rango-dev/provider-slush",
3
+ "version": "0.0.2-next.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "source": "./src/mod.ts",
7
+ "main": "./dist/mod.js",
8
+ "exports": {
9
+ ".": "./dist/mod.js"
10
+ },
11
+ "typings": "dist/mod.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "src"
15
+ ],
16
+ "scripts": {
17
+ "build": "node ../../scripts/build/command.mjs --path wallets/provider-slush --inputs src/mod.ts",
18
+ "ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
19
+ "clean": "rimraf dist",
20
+ "format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
21
+ "lint": "eslint \"**/*.{ts,tsx}\""
22
+ },
23
+ "dependencies": {
24
+ "@mysten/sui": "^1.21.2",
25
+ "@mysten/wallet-standard": "^0.13.26",
26
+ "@rango-dev/signer-sui": "^0.3.1-next.3",
27
+ "@rango-dev/wallets-shared": "^0.44.2-next.12",
28
+ "rango-types": "^0.1.84"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }
package/readme.md ADDED
@@ -0,0 +1,26 @@
1
+ # Slush
2
+ Slush integration for hub.
3
+ [Homepage](https://slush.app/) | [Docs](https://docs.sui.io/standards/wallet-standard)
4
+
5
+ More about implementation status can be found [here](../readme.md).
6
+
7
+ ## Implementation notes/limitation
8
+
9
+ ### Group
10
+
11
+ #### ✅ Sui
12
+ Only supports the Sui blockchain.
13
+
14
+ ### Feature
15
+
16
+ #### ❌ Switch Account
17
+ The wallet does not emit an event when the active account changes, making it difficult to detect account switches programmatically.
18
+
19
+ Regardless of the selected account in the wallet UI, Slush always connects to the first account.
20
+
21
+ #### ❌ Cross Browser
22
+ The wallet is only available on Chrome.
23
+
24
+ ---
25
+
26
+ More wallet information can be found in [wallets readme](../readme.md).
@@ -0,0 +1,42 @@
1
+ import { type ProviderInfo } from '@rango-dev/wallets-core';
2
+ import {
3
+ type BlockchainMeta,
4
+ type SuiBlockchainMeta,
5
+ TransactionType,
6
+ } from 'rango-types';
7
+
8
+ export const WALLET_ID = 'slush';
9
+ export const WALLET_NAME_IN_WALLET_STANDARD = 'Slush';
10
+
11
+ export const info: ProviderInfo = {
12
+ name: 'Slush',
13
+ icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/slush/icon.svg',
14
+ extensions: {
15
+ chrome:
16
+ 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',
17
+ edge: 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',
18
+ brave:
19
+ 'https://chromewebstore.google.com/detail/slush-%E2%80%94-a-sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil',
20
+ homepage: 'https://slush.app/download',
21
+ },
22
+ properties: [
23
+ {
24
+ name: 'namespaces',
25
+ value: {
26
+ data: [
27
+ {
28
+ label: 'Sui',
29
+ value: 'Sui',
30
+ id: 'SUI',
31
+ getSupportedChains: (allBlockchains: BlockchainMeta[]) =>
32
+ allBlockchains.filter(
33
+ (chain): chain is SuiBlockchainMeta =>
34
+ chain.type === TransactionType.SUI
35
+ ),
36
+ },
37
+ ],
38
+ selection: 'multiple',
39
+ },
40
+ },
41
+ ],
42
+ };
@@ -0,0 +1,41 @@
1
+ import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
2
+ import type { Connect, WalletInfo } from '@rango-dev/wallets-shared';
3
+ import type { BlockchainMeta, SignerFactory } from 'rango-types';
4
+
5
+ import { WalletTypes } from '@rango-dev/wallets-shared';
6
+
7
+ import { suiWalletInstance } from '../utils.js';
8
+
9
+ import signer from './signer.js';
10
+
11
+ const WALLET = WalletTypes.SLUSH;
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ type Provider = any;
15
+
16
+ export const config = {
17
+ type: WALLET,
18
+ };
19
+
20
+ export const getInstance = suiWalletInstance;
21
+
22
+ const connect: Connect = async () => {
23
+ throw new Error('not implemented');
24
+ };
25
+
26
+ export const getSigners: (provider: Provider) => Promise<SignerFactory> =
27
+ signer;
28
+
29
+ const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = () => {
30
+ throw new Error('not implemented');
31
+ };
32
+
33
+ const buildLegacyProvider: () => LegacyProviderInterface = () => ({
34
+ config,
35
+ getInstance,
36
+ connect,
37
+ getSigners,
38
+ getWalletInfo,
39
+ });
40
+
41
+ export { buildLegacyProvider };
@@ -0,0 +1,15 @@
1
+ import type { SignerFactory } from 'rango-types';
2
+
3
+ import { getInstanceOrThrow } from '@rango-dev/wallets-core/namespaces/sui';
4
+ import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
5
+
6
+ import { WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';
7
+
8
+ export default async function getSigners(): Promise<SignerFactory> {
9
+ const suiWalletProvider = getInstanceOrThrow(WALLET_NAME_IN_WALLET_STANDARD);
10
+
11
+ const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');
12
+ const signers = new DefaultSignerFactory();
13
+ signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiWalletProvider));
14
+ return signers;
15
+ }
package/src/mod.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineVersions } from '@rango-dev/wallets-core/utils';
2
+
3
+ import { buildLegacyProvider } from './legacy/index.js';
4
+ import { buildProvider } from './provider.js';
5
+
6
+ const versions = () =>
7
+ defineVersions()
8
+ .version('0.0.0', buildLegacyProvider())
9
+ .version('1.0.0', buildProvider())
10
+ .build();
11
+
12
+ export { versions };
@@ -0,0 +1,45 @@
1
+ import type { SuiActions } from '@rango-dev/wallets-core/namespaces/sui';
2
+
3
+ import { NamespaceBuilder } from '@rango-dev/wallets-core';
4
+ import { builders as commonBuilders } from '@rango-dev/wallets-core/namespaces/common';
5
+ import { actions, builders } from '@rango-dev/wallets-core/namespaces/sui';
6
+
7
+ import { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';
8
+ import { suiWalletInstance } from '../utils.js';
9
+
10
+ const canEagerConnect = builders
11
+ .canEagerConnect()
12
+ .action(
13
+ actions.canEagerConnect({
14
+ name: WALLET_NAME_IN_WALLET_STANDARD,
15
+ })
16
+ )
17
+ .build();
18
+
19
+ const connect = builders
20
+ .connect({
21
+ name: WALLET_NAME_IN_WALLET_STANDARD,
22
+ })
23
+ .build();
24
+
25
+ const disconnect = commonBuilders
26
+ .disconnect<SuiActions>()
27
+ /*
28
+ * This addresses a wallet bug where changing accounts within the app
29
+ * and then reconnecting results in a connection to the previously connected account.
30
+ * Explicitly calling `disconnect()` on the wallet instance ensures the wallet
31
+ * itself is disconnected, allowing for a proper connection to the intended account
32
+ * upon subsequent reconnection.
33
+ */
34
+ .before(async () => {
35
+ await suiWalletInstance()?.features['standard:disconnect'].disconnect();
36
+ })
37
+ .build();
38
+
39
+ const sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)
40
+ .action(connect)
41
+ .action(disconnect)
42
+ .action(canEagerConnect)
43
+ .build();
44
+
45
+ export { sui };
@@ -0,0 +1,20 @@
1
+ import { ProviderBuilder } from '@rango-dev/wallets-core';
2
+
3
+ import { info, WALLET_ID } from './constants.js';
4
+ import { sui } from './namespaces/sui.js';
5
+ import { suiWalletInstance } from './utils.js';
6
+
7
+ const buildProvider = () =>
8
+ new ProviderBuilder(WALLET_ID)
9
+ .init(function (context) {
10
+ const [, setState] = context.state();
11
+ if (suiWalletInstance()) {
12
+ setState('installed', true);
13
+ console.debug('[slush] instance detected.', context);
14
+ }
15
+ })
16
+ .config('info', info)
17
+ .add('sui', sui)
18
+ .build();
19
+
20
+ export { buildProvider };
package/src/utils.ts ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ type StandardConnectFeature,
3
+ type StandardDisconnectFeature,
4
+ type StandardEventsFeature,
5
+ type SuiFeatures,
6
+ type WalletWithFeatures,
7
+ } from '@mysten/wallet-standard';
8
+ import { getInstanceOrThrow } from '@rango-dev/wallets-core/namespaces/sui';
9
+
10
+ import { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';
11
+
12
+ type SuiWalletStandard = WalletWithFeatures<
13
+ StandardConnectFeature &
14
+ StandardEventsFeature &
15
+ SuiFeatures &
16
+ StandardDisconnectFeature
17
+ >;
18
+
19
+ export function suiWalletInstance(): SuiWalletStandard | null {
20
+ try {
21
+ return getInstanceOrThrow(
22
+ WALLET_NAME_IN_WALLET_STANDARD
23
+ ) as SuiWalletStandard;
24
+ } catch {
25
+ return null;
26
+ }
27
+ }