@solana-mobile/mobile-wallet-adapter-walletlib 1.4.2 → 1.4.4

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.
@@ -135,7 +135,8 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
135
135
  walletName: String,
136
136
  config: String,
137
137
  promise: Promise,
138
- ) = launch {
138
+ ) {
139
+ launch {
139
140
  // Get the intent that started this activity
140
141
  val intent = reactContext.getCurrentActivity()?.intent
141
142
  if (intent == null) {
@@ -193,6 +194,7 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
193
194
 
194
195
  promise.resolve(scenarioId)
195
196
  Log.d(TAG, "scenario created: $walletName")
197
+ }
196
198
  }
197
199
 
198
200
  /* Generic Request functions */
@@ -205,7 +207,8 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
205
207
  }
206
208
 
207
209
  @ReactMethod
208
- fun resolve(requestJson: String, responseJson: String) = launch {
210
+ fun resolve(requestJson: String, responseJson: String) {
211
+ launch {
209
212
  val completedRequest =
210
213
  json.decodeFromString(
211
214
  MobileWalletAdapterRequestSerializer,
@@ -409,6 +412,7 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
409
412
  else -> completeWithInvalidResponse()
410
413
  }
411
414
  }
415
+ }
412
416
  }
413
417
 
414
418
  private fun checkSessionId(sessionId: String, doIfValid: (() -> Unit)) =
@@ -467,10 +471,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
467
471
  request.request
468
472
  .identityName,
469
473
  request.request.identityUri
470
- .toString(),
474
+ ?.toString(),
471
475
  request.request
472
476
  .iconRelativeUri
473
- .toString(),
477
+ ?.toString(),
474
478
  request.request.features
475
479
  ?.asList(),
476
480
  request.request.addresses
@@ -486,10 +490,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
486
490
  request.request
487
491
  .identityName,
488
492
  request.request.identityUri
489
- .toString(),
493
+ ?.toString(),
490
494
  request.request
491
495
  .iconRelativeUri
492
- .toString(),
496
+ ?.toString(),
493
497
  request.request
494
498
  .authorizationScope
495
499
  )
@@ -501,10 +505,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
501
505
  request.request
502
506
  .identityName,
503
507
  request.request.identityUri
504
- .toString(),
508
+ ?.toString(),
505
509
  request.request
506
510
  .iconRelativeUri
507
- .toString(),
511
+ ?.toString(),
508
512
  request.request
509
513
  .authorizationScope
510
514
  )
@@ -516,10 +520,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
516
520
  request.request
517
521
  .identityName,
518
522
  request.request.identityUri
519
- .toString(),
523
+ ?.toString(),
520
524
  request.request
521
525
  .iconRelativeUri
522
- .toString(),
526
+ ?.toString(),
523
527
  request.request
524
528
  .authorizationScope,
525
529
  request.request.payloads
@@ -533,10 +537,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
533
537
  request.request
534
538
  .identityName,
535
539
  request.request.identityUri
536
- .toString(),
540
+ ?.toString(),
537
541
  request.request
538
542
  .iconRelativeUri
539
- .toString(),
543
+ ?.toString(),
540
544
  request.request
541
545
  .authorizationScope,
542
546
  request.request.payloads
@@ -550,10 +554,10 @@ class SolanaMobileWalletAdapterWalletLibModule(val reactContext: ReactApplicatio
550
554
  request.request
551
555
  .identityName,
552
556
  request.request.identityUri
553
- .toString(),
557
+ ?.toString(),
554
558
  request.request
555
559
  .iconRelativeUri
556
- .toString(),
560
+ ?.toString(),
557
561
  request.request
558
562
  .authorizationScope,
559
563
  request.request.payloads
package/lib/esm/index.js CHANGED
@@ -87,8 +87,9 @@ function initializeScenario(walletName, walletConfig) {
87
87
  const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = "MobileWalletAdapterServiceRequestBridge";
88
88
  function initializeMWAEventListener(handleRequest, handleSessionEvent) {
89
89
  return new NativeEventEmitter().addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
90
- if (isMWARequest(nativeEvent)) handleRequest(nativeEvent);
91
- else if (isMWASessionEvent(nativeEvent)) handleSessionEvent(nativeEvent);
90
+ const event = nativeEvent;
91
+ if (isMWARequest(event)) handleRequest(event);
92
+ else if (isMWASessionEvent(event)) handleSessionEvent(event);
92
93
  else console.warn("Unexpected native event type");
93
94
  });
94
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","LINKING_ERROR"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../src/errors.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useMobileWalletAdapterSession.ts","../../src/useDigitalAssetLinks.ts"],"sourcesContent":["/**\n * Mobile Wallet Adapter Session Events are notifications and events\n * about the underlying session between the wallet and the dApp.\n */\nexport enum MWASessionEventType {\n SessionStartEvent = 'SESSION_START',\n SessionReadyEvent = 'SESSION_READY',\n SessionTerminatedEvent = 'SESSION_TERMINATED',\n SessionServingClientsEvent = 'SESSION_SERVING_CLIENTS',\n SessionServingCompleteEvent = 'SESSION_SERVING_COMPLETE',\n SessionCompleteEvent = 'SESSION_COMPLETE',\n SessionErrorEvent = 'SESSION_ERROR',\n SessionTeardownCompleteEvent = 'SESSION_TEARDOWN_COMPLETE',\n LowPowerNoConnectionEvent = 'LOW_POWER_NO_CONNECTION',\n}\nexport interface IMWASessionEvent {\n __type: MWASessionEventType;\n sessionId: string;\n}\n\nexport type SessionStartEvent = Readonly<{\n __type: MWASessionEventType.SessionStartEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionReadyEvent = Readonly<{\n __type: MWASessionEventType.SessionReadyEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTerminatedEvent = Readonly<{\n __type: MWASessionEventType.SessionTerminatedEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingClientsEvent = Readonly<{\n __type: MWASessionEventType.SessionServingClientsEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionServingCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionErrorEvent = Readonly<{\n __type: MWASessionEventType.SessionErrorEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTeardownCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionTeardownCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type LowPowerNoConnectionEvent = Readonly<{\n __type: MWASessionEventType.LowPowerNoConnectionEvent;\n}> &\n IMWASessionEvent;\n\nexport type MWASessionEvent =\n | SessionStartEvent\n | SessionReadyEvent\n | SessionTerminatedEvent\n | SessionServingClientsEvent\n | SessionServingCompleteEvent\n | SessionCompleteEvent\n | SessionErrorEvent\n | SessionTeardownCompleteEvent\n | LowPowerNoConnectionEvent;\n","import type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype AppIdentity = Readonly<{\n identityUri?: string;\n iconRelativeUri?: string;\n identityName?: string;\n}>;\n\nexport type SignInPayload = Readonly<{\n domain?: string;\n address?: string;\n statement?: string;\n uri?: string;\n version?: string;\n chainId?: string;\n nonce?: string;\n issuedAt?: string;\n expirationTime?: string;\n notBefore?: string;\n requestId?: string;\n resources?: readonly string[];\n}>;\n\nexport type Base64EncodedAddress = string;\nexport type Base64EncodedSignature = string;\ntype Base64EncodedSignedMessage = string;\n\n/**\n * Mobile Wallet Adapter Requests are remote requests coming from\n * the dApp for authorization, signing, and sending services.\n */\n\nexport type MWARequest =\n | SignMessagesRequest\n | SignTransactionsRequest\n | SignAndSendTransactionsRequest\n | AuthorizeDappRequest\n | ReauthorizeDappRequest\n | DeauthorizeDappRequest;\n\nexport enum MWARequestType {\n AuthorizeDappRequest = 'AUTHORIZE_DAPP',\n ReauthorizeDappRequest = 'REAUTHORIZE_DAPP',\n DeauthorizeDappRequest = 'DEAUTHORIZE_DAPP',\n SignMessagesRequest = 'SIGN_MESSAGES',\n SignTransactionsRequest = 'SIGN_TRANSACTIONS',\n SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',\n}\n\ninterface IMWARequest {\n __type: MWARequestType;\n requestId: string;\n sessionId: string;\n}\n\ninterface IVerifiableIdentityRequest {\n chain: string;\n authorizationScope: Uint8Array;\n appIdentity?: AppIdentity;\n}\n\nexport type AuthorizeDappRequest = Readonly<{\n __type: MWARequestType.AuthorizeDappRequest;\n chain: string;\n appIdentity?: AppIdentity;\n features?: IdentifierArray;\n addresses?: [string];\n signInPayload?: SignInPayload;\n}> &\n IMWARequest;\n\nexport type ReauthorizeDappRequest = Readonly<{\n __type: MWARequestType.ReauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type DeauthorizeDappRequest = Readonly<{\n __type: MWARequestType.DeauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignMessagesRequest = Readonly<{\n __type: MWARequestType.SignMessagesRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignTransactionsRequest = Readonly<{\n __type: MWARequestType.SignTransactionsRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignAndSendTransactionsRequest = Readonly<{\n __type: MWARequestType.SignAndSendTransactionsRequest;\n payloads: Uint8Array[];\n minContextSlot?: number;\n commitment?: string;\n skipPreflight?: boolean;\n maxRetries?: number;\n waitForCommitmentToSendNextTransaction?: boolean;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\n/**\n * MWA Request Responses\n */\n\nexport type MWAResponse =\n | AuthorizeDappResponse\n | ReauthorizeDappResponse\n | DeauthorizeDappResponse\n | SignMessagesResponse\n | SignTransactionsResponse\n | SignAndSendTransactionsResponse;\n\n/* Failure Responses */\nexport enum MWARequestFailReason {\n UserDeclined = 'USER_DECLINED',\n TooManyPayloads = 'TOO_MANY_PAYLOADS',\n InvalidSignatures = 'INVALID_SIGNATURES',\n AuthorizationNotValid = 'AUTHORIZATION_NOT_VALID',\n}\n\nexport type UserDeclinedResponse = Readonly<{\n failReason: MWARequestFailReason.UserDeclined;\n}>;\n\nexport type TooManyPayloadsResponse = Readonly<{\n failReason: MWARequestFailReason.TooManyPayloads;\n}>;\n\nexport type AuthorizationNotValidResponse = Readonly<{\n failReason: MWARequestFailReason.AuthorizationNotValid;\n}>;\n\nexport type InvalidSignaturesResponse = Readonly<{\n failReason: MWARequestFailReason.InvalidSignatures;\n valid: boolean[];\n}>;\n\n/* Authorize Dapp */\nexport type AuthorizedAccount = Readonly<{\n publicKey: Uint8Array;\n accountLabel?: string;\n icon?: string;\n chains?: IdentifierArray;\n features?: IdentifierArray;\n}>;\nexport type SignInResult = Readonly<{\n address: Base64EncodedAddress;\n signed_message: Base64EncodedSignedMessage;\n signature: Base64EncodedSignature;\n signature_type?: string;\n}>;\nexport type AuthorizeDappCompleteResponse = Readonly<{\n accounts: Array<AuthorizedAccount>;\n walletUriBase?: string;\n authorizationScope?: Uint8Array;\n signInResult?: SignInResult;\n}>;\nexport type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;\n\n/* Reauthorize Dapp */\nexport type ReauthorizeDappCompleteResponse = Readonly<{\n authorizationScope?: Uint8Array;\n}>;\nexport type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Deauthorize Dapp */\nexport type DeauthorizeDappCompleteResponse = Readonly<{}>;\nexport type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Sign Transactions/Messages */\nexport type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;\nexport type SignPayloadsFailResponse =\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\nexport type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\n\n/* Sign and Send Transaction */\nexport type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[] }>;\nexport type SignAndSendTransactionsResponse =\n | SignAndSendTransactionsCompleteResponse\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;\nexport function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;\nexport function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;\nexport function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;\nexport function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;\nexport function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;\nexport function resolve(request: MWARequest, response: MWAResponse): void {\n SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));\n}\n","export enum SolanaMWAWalletLibErrorCode {\n ERROR_INTENT_DATA_NOT_FOUND = 'ERROR_INTENT_DATA_NOT_FOUND',\n ERROR_SESSION_ALREADY_CREATED = 'ERROR_SESSION_ALREADY_CREATED',\n ERROR_UNSUPPORTED_ASSOCIATION_URI = 'ERROR_UNSUPPORTED_ASSOCIATION_URI',\n ERROR_UNSUPPORTED_ASSOCIATION_TYPE = 'ERROR_UNSUPPORTED_ASSOCIATION_TYPE',\n}\n\nexport class SolanaMWAWalletLibError extends Error {\n code: SolanaMWAWalletLibErrorCode;\n constructor(code: SolanaMWAWalletLibErrorCode, message: string) {\n super(message);\n this.name = 'SolanaMWAWalletLibError';\n this.code = code;\n }\n}\n","import type { TransactionVersion } from '@solana/web3.js';\nimport type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode } from './errors.js';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype ReactNativeError = Error & { code?: string; userInfo?: Record<string, unknown> };\n\nfunction handleError(e: any): never {\n if (e instanceof Error) {\n const { code, message } = e as ReactNativeError;\n if (code && code in SolanaMWAWalletLibErrorCode) {\n throw new SolanaMWAWalletLibError(code as SolanaMWAWalletLibErrorCode, message);\n }\n }\n throw e;\n}\n\nexport type MWASessionId = string;\n\nexport interface MobileWalletAdapterConfig {\n maxTransactionsPerSigningRequest: number;\n maxMessagesPerSigningRequest: number;\n supportedTransactionVersions: Array<TransactionVersion>;\n noConnectionWarningTimeoutMs: number;\n optionalFeatures: IdentifierArray;\n}\n\nexport async function initializeMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n): Promise<MWASessionId> {\n try {\n return await initializeScenario(walletName, config);\n } catch (e) {\n handleError(e);\n }\n}\n\n// Create Scenario and establish session with dapp\nfunction initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig): Promise<MWASessionId> {\n return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));\n}\n","import { EmitterSubscription, NativeEventEmitter } from 'react-native';\n\nimport { MWASessionEvent, MWASessionEventType } from './mwaSessionEvents.js';\nimport { MWARequest, MWARequestType } from './resolve.js';\n\nconst MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';\n\nexport function initializeMWAEventListener(\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n): EmitterSubscription {\n const mwaEventEmitter = new NativeEventEmitter();\n const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {\n if (isMWARequest(nativeEvent)) {\n handleRequest(nativeEvent as MWARequest);\n } else if (isMWASessionEvent(nativeEvent)) {\n handleSessionEvent(nativeEvent as MWASessionEvent);\n } else {\n console.warn('Unexpected native event type');\n }\n });\n\n return listener;\n}\n\nfunction isMWARequest(nativeEvent: any): boolean {\n return Object.values(MWARequestType).includes(nativeEvent.__type);\n}\n\nfunction isMWASessionEvent(nativeEvent: any) {\n return Object.values(MWASessionEventType).includes(nativeEvent.__type);\n}\n","import { useEffect } from 'react';\n\nimport {\n initializeMobileWalletAdapterSession,\n MobileWalletAdapterConfig,\n} from './initializeMobileWalletAdapterSession.js';\nimport { initializeMWAEventListener } from './initializeMWAEventListener.js';\nimport { MWASessionEvent } from './mwaSessionEvents.js';\nimport { MWARequest } from './resolve.js';\n\nexport function useMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n) {\n useEffect(() => {\n async function startSession() {\n try {\n await initializeMobileWalletAdapterSession(walletName, config);\n } catch (e) {\n console.error(e);\n }\n }\n const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);\n startSession();\n return () => {\n listener.remove();\n };\n }, []);\n}\n","import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileDigitalAssetLinks =\n Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks\n ? NativeModules.SolanaMobileDigitalAssetLinks\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\nexport async function getCallingPackage(): Promise<string | undefined> {\n return await SolanaMobileDigitalAssetLinks.getCallingPackage();\n}\n\nexport async function verifyCallingPackage(clientIdentityUri: string) {\n return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);\n}\n\nexport async function getCallingPackageUid() {\n return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();\n}\n\nexport async function getUidForPackage(packageName: string) {\n return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);\n}\n"],"mappings":";;;;;;;AAIA,IAAY,sBAAL,yBAAA,qBAAA;AACH,qBAAA,uBAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,4BAAA;AACA,qBAAA,gCAAA;AACA,qBAAA,iCAAA;AACA,qBAAA,0BAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,kCAAA;AACA,qBAAA,+BAAA;;KACH;;;ACXD,MAAMA,kBACF;AAOJ,MAAMC,uCACF,SAAS,OAAO,aAAa,cAAc,qCACrC,cAAc,qCACd,IAAI,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACAD,gBACT;GAER,CACJ;AAwCX,IAAY,iBAAL,yBAAA,gBAAA;AACH,gBAAA,0BAAA;AACA,gBAAA,4BAAA;AACA,gBAAA,4BAAA;AACA,gBAAA,yBAAA;AACA,gBAAA,6BAAA;AACA,gBAAA,oCAAA;;KACH;AA2ED,IAAY,uBAAL,yBAAA,sBAAA;AACH,sBAAA,kBAAA;AACA,sBAAA,qBAAA;AACA,sBAAA,uBAAA;AACA,sBAAA,2BAAA;;KACH;AA6ED,SAAgB,QAAQ,SAAqB,UAA6B;AACtE,sCAAmC,QAAQ,KAAK,UAAU,QAAQ,EAAE,KAAK,UAAU,SAAS,CAAC;;;;ACtOjG,IAAY,8BAAL,yBAAA,6BAAA;AACH,6BAAA,iCAAA;AACA,6BAAA,mCAAA;AACA,6BAAA,uCAAA;AACA,6BAAA,wCAAA;;KACH;AAED,IAAa,0BAAb,cAA6C,MAAM;CAC/C;CACA,YAAY,MAAmC,SAAiB;AAC5D,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;ACNpB,MAAME,kBACF;AAOJ,MAAM,qCACF,SAAS,OAAO,aAAa,cAAc,qCACrC,cAAc,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I,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACA,cACT;GAER,CACJ;AAEX,eAAsB,oBAAiD;AACnE,QAAO,MAAM,8BAA8B,mBAAmB;;AAGlE,eAAsB,qBAAqB,mBAA2B;AAClE,QAAO,MAAM,8BAA8B,qBAAqB,kBAAkB;;AAGtF,eAAsB,uBAAuB;AACzC,QAAO,MAAM,8BAA8B,sBAAsB;;AAGrE,eAAsB,iBAAiB,aAAqB;AACxD,QAAO,MAAM,8BAA8B,iBAAiB,YAAY"}
1
+ {"version":3,"file":"index.js","names":["LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","LINKING_ERROR"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../src/errors.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useMobileWalletAdapterSession.ts","../../src/useDigitalAssetLinks.ts"],"sourcesContent":["/**\n * Mobile Wallet Adapter Session Events are notifications and events\n * about the underlying session between the wallet and the dApp.\n */\nexport enum MWASessionEventType {\n SessionStartEvent = 'SESSION_START',\n SessionReadyEvent = 'SESSION_READY',\n SessionTerminatedEvent = 'SESSION_TERMINATED',\n SessionServingClientsEvent = 'SESSION_SERVING_CLIENTS',\n SessionServingCompleteEvent = 'SESSION_SERVING_COMPLETE',\n SessionCompleteEvent = 'SESSION_COMPLETE',\n SessionErrorEvent = 'SESSION_ERROR',\n SessionTeardownCompleteEvent = 'SESSION_TEARDOWN_COMPLETE',\n LowPowerNoConnectionEvent = 'LOW_POWER_NO_CONNECTION',\n}\nexport interface IMWASessionEvent {\n __type: MWASessionEventType;\n sessionId: string;\n}\n\nexport type SessionStartEvent = Readonly<{\n __type: MWASessionEventType.SessionStartEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionReadyEvent = Readonly<{\n __type: MWASessionEventType.SessionReadyEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTerminatedEvent = Readonly<{\n __type: MWASessionEventType.SessionTerminatedEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingClientsEvent = Readonly<{\n __type: MWASessionEventType.SessionServingClientsEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionServingCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionErrorEvent = Readonly<{\n __type: MWASessionEventType.SessionErrorEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTeardownCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionTeardownCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type LowPowerNoConnectionEvent = Readonly<{\n __type: MWASessionEventType.LowPowerNoConnectionEvent;\n}> &\n IMWASessionEvent;\n\nexport type MWASessionEvent =\n | SessionStartEvent\n | SessionReadyEvent\n | SessionTerminatedEvent\n | SessionServingClientsEvent\n | SessionServingCompleteEvent\n | SessionCompleteEvent\n | SessionErrorEvent\n | SessionTeardownCompleteEvent\n | LowPowerNoConnectionEvent;\n","import type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype AppIdentity = Readonly<{\n identityUri?: string;\n iconRelativeUri?: string;\n identityName?: string;\n}>;\n\nexport type SignInPayload = Readonly<{\n domain?: string;\n address?: string;\n statement?: string;\n uri?: string;\n version?: string;\n chainId?: string;\n nonce?: string;\n issuedAt?: string;\n expirationTime?: string;\n notBefore?: string;\n requestId?: string;\n resources?: readonly string[];\n}>;\n\nexport type Base64EncodedAddress = string;\nexport type Base64EncodedSignature = string;\ntype Base64EncodedSignedMessage = string;\n\n/**\n * Mobile Wallet Adapter Requests are remote requests coming from\n * the dApp for authorization, signing, and sending services.\n */\n\nexport type MWARequest =\n | SignMessagesRequest\n | SignTransactionsRequest\n | SignAndSendTransactionsRequest\n | AuthorizeDappRequest\n | ReauthorizeDappRequest\n | DeauthorizeDappRequest;\n\nexport enum MWARequestType {\n AuthorizeDappRequest = 'AUTHORIZE_DAPP',\n ReauthorizeDappRequest = 'REAUTHORIZE_DAPP',\n DeauthorizeDappRequest = 'DEAUTHORIZE_DAPP',\n SignMessagesRequest = 'SIGN_MESSAGES',\n SignTransactionsRequest = 'SIGN_TRANSACTIONS',\n SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',\n}\n\ninterface IMWARequest {\n __type: MWARequestType;\n requestId: string;\n sessionId: string;\n}\n\ninterface IVerifiableIdentityRequest {\n chain: string;\n authorizationScope: Uint8Array;\n appIdentity?: AppIdentity;\n}\n\nexport type AuthorizeDappRequest = Readonly<{\n __type: MWARequestType.AuthorizeDappRequest;\n chain: string;\n appIdentity?: AppIdentity;\n features?: IdentifierArray;\n addresses?: [string];\n signInPayload?: SignInPayload;\n}> &\n IMWARequest;\n\nexport type ReauthorizeDappRequest = Readonly<{\n __type: MWARequestType.ReauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type DeauthorizeDappRequest = Readonly<{\n __type: MWARequestType.DeauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignMessagesRequest = Readonly<{\n __type: MWARequestType.SignMessagesRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignTransactionsRequest = Readonly<{\n __type: MWARequestType.SignTransactionsRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignAndSendTransactionsRequest = Readonly<{\n __type: MWARequestType.SignAndSendTransactionsRequest;\n payloads: Uint8Array[];\n minContextSlot?: number;\n commitment?: string;\n skipPreflight?: boolean;\n maxRetries?: number;\n waitForCommitmentToSendNextTransaction?: boolean;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\n/**\n * MWA Request Responses\n */\n\nexport type MWAResponse =\n | AuthorizeDappResponse\n | ReauthorizeDappResponse\n | DeauthorizeDappResponse\n | SignMessagesResponse\n | SignTransactionsResponse\n | SignAndSendTransactionsResponse;\n\n/* Failure Responses */\nexport enum MWARequestFailReason {\n UserDeclined = 'USER_DECLINED',\n TooManyPayloads = 'TOO_MANY_PAYLOADS',\n InvalidSignatures = 'INVALID_SIGNATURES',\n AuthorizationNotValid = 'AUTHORIZATION_NOT_VALID',\n}\n\nexport type UserDeclinedResponse = Readonly<{\n failReason: MWARequestFailReason.UserDeclined;\n}>;\n\nexport type TooManyPayloadsResponse = Readonly<{\n failReason: MWARequestFailReason.TooManyPayloads;\n}>;\n\nexport type AuthorizationNotValidResponse = Readonly<{\n failReason: MWARequestFailReason.AuthorizationNotValid;\n}>;\n\nexport type InvalidSignaturesResponse = Readonly<{\n failReason: MWARequestFailReason.InvalidSignatures;\n valid: boolean[];\n}>;\n\n/* Authorize Dapp */\nexport type AuthorizedAccount = Readonly<{\n publicKey: Uint8Array;\n accountLabel?: string;\n icon?: string;\n chains?: IdentifierArray;\n features?: IdentifierArray;\n}>;\nexport type SignInResult = Readonly<{\n address: Base64EncodedAddress;\n signed_message: Base64EncodedSignedMessage;\n signature: Base64EncodedSignature;\n signature_type?: string;\n}>;\nexport type AuthorizeDappCompleteResponse = Readonly<{\n accounts: Array<AuthorizedAccount>;\n walletUriBase?: string;\n authorizationScope?: Uint8Array;\n signInResult?: SignInResult;\n}>;\nexport type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;\n\n/* Reauthorize Dapp */\nexport type ReauthorizeDappCompleteResponse = Readonly<{\n authorizationScope?: Uint8Array;\n}>;\nexport type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Deauthorize Dapp */\nexport type DeauthorizeDappCompleteResponse = Readonly<Record<string, never>>;\nexport type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Sign Transactions/Messages */\nexport type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;\nexport type SignPayloadsFailResponse =\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\nexport type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\n\n/* Sign and Send Transaction */\nexport type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[] }>;\nexport type SignAndSendTransactionsResponse =\n | SignAndSendTransactionsCompleteResponse\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;\nexport function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;\nexport function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;\nexport function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;\nexport function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;\nexport function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;\nexport function resolve(request: MWARequest, response: MWAResponse): void {\n SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));\n}\n","export enum SolanaMWAWalletLibErrorCode {\n ERROR_INTENT_DATA_NOT_FOUND = 'ERROR_INTENT_DATA_NOT_FOUND',\n ERROR_SESSION_ALREADY_CREATED = 'ERROR_SESSION_ALREADY_CREATED',\n ERROR_UNSUPPORTED_ASSOCIATION_URI = 'ERROR_UNSUPPORTED_ASSOCIATION_URI',\n ERROR_UNSUPPORTED_ASSOCIATION_TYPE = 'ERROR_UNSUPPORTED_ASSOCIATION_TYPE',\n}\n\nexport class SolanaMWAWalletLibError extends Error {\n code: SolanaMWAWalletLibErrorCode;\n constructor(code: SolanaMWAWalletLibErrorCode, message: string) {\n super(message);\n this.name = 'SolanaMWAWalletLibError';\n this.code = code;\n }\n}\n","import type { TransactionVersion } from '@solana/web3.js';\nimport type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode } from './errors.js';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype ReactNativeError = Error & { code?: string; userInfo?: Record<string, unknown> };\n\nfunction handleError(e: unknown): never {\n if (e instanceof Error) {\n const { code, message } = e as ReactNativeError;\n if (code && code in SolanaMWAWalletLibErrorCode) {\n throw new SolanaMWAWalletLibError(code as SolanaMWAWalletLibErrorCode, message);\n }\n }\n throw e;\n}\n\nexport type MWASessionId = string;\n\nexport interface MobileWalletAdapterConfig {\n maxTransactionsPerSigningRequest: number;\n maxMessagesPerSigningRequest: number;\n supportedTransactionVersions: Array<TransactionVersion>;\n noConnectionWarningTimeoutMs: number;\n optionalFeatures: IdentifierArray;\n}\n\nexport async function initializeMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n): Promise<MWASessionId> {\n try {\n return await initializeScenario(walletName, config);\n } catch (e) {\n handleError(e);\n }\n}\n\n// Create Scenario and establish session with dapp\nfunction initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig): Promise<MWASessionId> {\n return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));\n}\n","import { EmitterSubscription, NativeEventEmitter } from 'react-native';\n\nimport { MWASessionEvent, MWASessionEventType } from './mwaSessionEvents.js';\nimport { MWARequest, MWARequestType } from './resolve.js';\n\nconst MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';\ntype NativeMWAEvent = Readonly<{ __type?: unknown }>;\n\nexport function initializeMWAEventListener(\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n): EmitterSubscription {\n const mwaEventEmitter = new NativeEventEmitter();\n const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {\n const event = nativeEvent as NativeMWAEvent;\n if (isMWARequest(event)) {\n handleRequest(event);\n } else if (isMWASessionEvent(event)) {\n handleSessionEvent(event);\n } else {\n console.warn('Unexpected native event type');\n }\n });\n\n return listener;\n}\n\nfunction isMWARequest(nativeEvent: NativeMWAEvent): nativeEvent is MWARequest {\n return Object.values(MWARequestType).includes(nativeEvent.__type as MWARequest['__type']);\n}\n\nfunction isMWASessionEvent(nativeEvent: NativeMWAEvent): nativeEvent is MWASessionEvent {\n return Object.values(MWASessionEventType).includes(nativeEvent.__type as MWASessionEvent['__type']);\n}\n","import { useEffect } from 'react';\n\nimport {\n initializeMobileWalletAdapterSession,\n MobileWalletAdapterConfig,\n} from './initializeMobileWalletAdapterSession.js';\nimport { initializeMWAEventListener } from './initializeMWAEventListener.js';\nimport { MWASessionEvent } from './mwaSessionEvents.js';\nimport { MWARequest } from './resolve.js';\n\nexport function useMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n) {\n useEffect(() => {\n async function startSession() {\n try {\n await initializeMobileWalletAdapterSession(walletName, config);\n } catch (e) {\n console.error(e);\n }\n }\n const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);\n startSession();\n return () => {\n listener.remove();\n };\n }, []);\n}\n","import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileDigitalAssetLinks =\n Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks\n ? NativeModules.SolanaMobileDigitalAssetLinks\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\nexport async function getCallingPackage(): Promise<string | undefined> {\n return await SolanaMobileDigitalAssetLinks.getCallingPackage();\n}\n\nexport async function verifyCallingPackage(clientIdentityUri: string) {\n return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);\n}\n\nexport async function getCallingPackageUid() {\n return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();\n}\n\nexport async function getUidForPackage(packageName: string) {\n return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);\n}\n"],"mappings":";;;;;;;AAIA,IAAY,sBAAL,yBAAA,qBAAA;AACH,qBAAA,uBAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,4BAAA;AACA,qBAAA,gCAAA;AACA,qBAAA,iCAAA;AACA,qBAAA,0BAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,kCAAA;AACA,qBAAA,+BAAA;;KACH;;;ACXD,MAAMA,kBACF;AAOJ,MAAMC,uCACF,SAAS,OAAO,aAAa,cAAc,qCACrC,cAAc,qCACd,IAAI,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACAD,gBACT;GAER,CACJ;AAwCX,IAAY,iBAAL,yBAAA,gBAAA;AACH,gBAAA,0BAAA;AACA,gBAAA,4BAAA;AACA,gBAAA,4BAAA;AACA,gBAAA,yBAAA;AACA,gBAAA,6BAAA;AACA,gBAAA,oCAAA;;KACH;AA2ED,IAAY,uBAAL,yBAAA,sBAAA;AACH,sBAAA,kBAAA;AACA,sBAAA,qBAAA;AACA,sBAAA,uBAAA;AACA,sBAAA,2BAAA;;KACH;AA6ED,SAAgB,QAAQ,SAAqB,UAA6B;AACtE,sCAAmC,QAAQ,KAAK,UAAU,QAAQ,EAAE,KAAK,UAAU,SAAS,CAAC;;;;ACtOjG,IAAY,8BAAL,yBAAA,6BAAA;AACH,6BAAA,iCAAA;AACA,6BAAA,mCAAA;AACA,6BAAA,uCAAA;AACA,6BAAA,wCAAA;;KACH;AAED,IAAa,0BAAb,cAA6C,MAAM;CAC/C;C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AW,2BAA2B,eAAe,mBAAmB;AAC9E,gBAAc;AACd,eAAa;AACT,YAAS,QAAQ;;IAEtB,EAAE,CAAC;;;;AC3BV,MAAM,gBACF;AAOJ,MAAM,gCACF,SAAS,OAAO,aAAa,cAAc,gCACrC,cAAc,gCACd,IAAI,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACA,cACT;GAER,CACJ;AAEX,eAAsB,oBAAiD;AACnE,QAAO,MAAM,8BAA8B,mBAAmB;;AAGlE,eAAsB,qBAAqB,mBAA2B;AAClE,QAAO,MAAM,8BAA8B,qBAAqB,kBAAkB;;AAGtF,eAAsB,uBAAuB;AACzC,QAAO,MAAM,8BAA8B,sBAAsB;;AAGrE,eAAsB,iBAAiB,aAAqB;AACxD,QAAO,MAAM,8BAA8B,iBAAiB,YAAY"}
@@ -87,8 +87,9 @@ function initializeScenario(walletName, walletConfig) {
87
87
  const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = "MobileWalletAdapterServiceRequestBridge";
88
88
  function initializeMWAEventListener(handleRequest, handleSessionEvent) {
89
89
  return new NativeEventEmitter().addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
90
- if (isMWARequest(nativeEvent)) handleRequest(nativeEvent);
91
- else if (isMWASessionEvent(nativeEvent)) handleSessionEvent(nativeEvent);
90
+ const event = nativeEvent;
91
+ if (isMWARequest(event)) handleRequest(event);
92
+ else if (isMWASessionEvent(event)) handleSessionEvent(event);
92
93
  else console.warn("Unexpected native event type");
93
94
  });
94
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","LINKING_ERROR"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../src/errors.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useMobileWalletAdapterSession.ts","../../src/useDigitalAssetLinks.ts"],"sourcesContent":["/**\n * Mobile Wallet Adapter Session Events are notifications and events\n * about the underlying session between the wallet and the dApp.\n */\nexport enum MWASessionEventType {\n SessionStartEvent = 'SESSION_START',\n SessionReadyEvent = 'SESSION_READY',\n SessionTerminatedEvent = 'SESSION_TERMINATED',\n SessionServingClientsEvent = 'SESSION_SERVING_CLIENTS',\n SessionServingCompleteEvent = 'SESSION_SERVING_COMPLETE',\n SessionCompleteEvent = 'SESSION_COMPLETE',\n SessionErrorEvent = 'SESSION_ERROR',\n SessionTeardownCompleteEvent = 'SESSION_TEARDOWN_COMPLETE',\n LowPowerNoConnectionEvent = 'LOW_POWER_NO_CONNECTION',\n}\nexport interface IMWASessionEvent {\n __type: MWASessionEventType;\n sessionId: string;\n}\n\nexport type SessionStartEvent = Readonly<{\n __type: MWASessionEventType.SessionStartEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionReadyEvent = Readonly<{\n __type: MWASessionEventType.SessionReadyEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTerminatedEvent = Readonly<{\n __type: MWASessionEventType.SessionTerminatedEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingClientsEvent = Readonly<{\n __type: MWASessionEventType.SessionServingClientsEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionServingCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionErrorEvent = Readonly<{\n __type: MWASessionEventType.SessionErrorEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTeardownCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionTeardownCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type LowPowerNoConnectionEvent = Readonly<{\n __type: MWASessionEventType.LowPowerNoConnectionEvent;\n}> &\n IMWASessionEvent;\n\nexport type MWASessionEvent =\n | SessionStartEvent\n | SessionReadyEvent\n | SessionTerminatedEvent\n | SessionServingClientsEvent\n | SessionServingCompleteEvent\n | SessionCompleteEvent\n | SessionErrorEvent\n | SessionTeardownCompleteEvent\n | LowPowerNoConnectionEvent;\n","import type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype AppIdentity = Readonly<{\n identityUri?: string;\n iconRelativeUri?: string;\n identityName?: string;\n}>;\n\nexport type SignInPayload = Readonly<{\n domain?: string;\n address?: string;\n statement?: string;\n uri?: string;\n version?: string;\n chainId?: string;\n nonce?: string;\n issuedAt?: string;\n expirationTime?: string;\n notBefore?: string;\n requestId?: string;\n resources?: readonly string[];\n}>;\n\nexport type Base64EncodedAddress = string;\nexport type Base64EncodedSignature = string;\ntype Base64EncodedSignedMessage = string;\n\n/**\n * Mobile Wallet Adapter Requests are remote requests coming from\n * the dApp for authorization, signing, and sending services.\n */\n\nexport type MWARequest =\n | SignMessagesRequest\n | SignTransactionsRequest\n | SignAndSendTransactionsRequest\n | AuthorizeDappRequest\n | ReauthorizeDappRequest\n | DeauthorizeDappRequest;\n\nexport enum MWARequestType {\n AuthorizeDappRequest = 'AUTHORIZE_DAPP',\n ReauthorizeDappRequest = 'REAUTHORIZE_DAPP',\n DeauthorizeDappRequest = 'DEAUTHORIZE_DAPP',\n SignMessagesRequest = 'SIGN_MESSAGES',\n SignTransactionsRequest = 'SIGN_TRANSACTIONS',\n SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',\n}\n\ninterface IMWARequest {\n __type: MWARequestType;\n requestId: string;\n sessionId: string;\n}\n\ninterface IVerifiableIdentityRequest {\n chain: string;\n authorizationScope: Uint8Array;\n appIdentity?: AppIdentity;\n}\n\nexport type AuthorizeDappRequest = Readonly<{\n __type: MWARequestType.AuthorizeDappRequest;\n chain: string;\n appIdentity?: AppIdentity;\n features?: IdentifierArray;\n addresses?: [string];\n signInPayload?: SignInPayload;\n}> &\n IMWARequest;\n\nexport type ReauthorizeDappRequest = Readonly<{\n __type: MWARequestType.ReauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type DeauthorizeDappRequest = Readonly<{\n __type: MWARequestType.DeauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignMessagesRequest = Readonly<{\n __type: MWARequestType.SignMessagesRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignTransactionsRequest = Readonly<{\n __type: MWARequestType.SignTransactionsRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignAndSendTransactionsRequest = Readonly<{\n __type: MWARequestType.SignAndSendTransactionsRequest;\n payloads: Uint8Array[];\n minContextSlot?: number;\n commitment?: string;\n skipPreflight?: boolean;\n maxRetries?: number;\n waitForCommitmentToSendNextTransaction?: boolean;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\n/**\n * MWA Request Responses\n */\n\nexport type MWAResponse =\n | AuthorizeDappResponse\n | ReauthorizeDappResponse\n | DeauthorizeDappResponse\n | SignMessagesResponse\n | SignTransactionsResponse\n | SignAndSendTransactionsResponse;\n\n/* Failure Responses */\nexport enum MWARequestFailReason {\n UserDeclined = 'USER_DECLINED',\n TooManyPayloads = 'TOO_MANY_PAYLOADS',\n InvalidSignatures = 'INVALID_SIGNATURES',\n AuthorizationNotValid = 'AUTHORIZATION_NOT_VALID',\n}\n\nexport type UserDeclinedResponse = Readonly<{\n failReason: MWARequestFailReason.UserDeclined;\n}>;\n\nexport type TooManyPayloadsResponse = Readonly<{\n failReason: MWARequestFailReason.TooManyPayloads;\n}>;\n\nexport type AuthorizationNotValidResponse = Readonly<{\n failReason: MWARequestFailReason.AuthorizationNotValid;\n}>;\n\nexport type InvalidSignaturesResponse = Readonly<{\n failReason: MWARequestFailReason.InvalidSignatures;\n valid: boolean[];\n}>;\n\n/* Authorize Dapp */\nexport type AuthorizedAccount = Readonly<{\n publicKey: Uint8Array;\n accountLabel?: string;\n icon?: string;\n chains?: IdentifierArray;\n features?: IdentifierArray;\n}>;\nexport type SignInResult = Readonly<{\n address: Base64EncodedAddress;\n signed_message: Base64EncodedSignedMessage;\n signature: Base64EncodedSignature;\n signature_type?: string;\n}>;\nexport type AuthorizeDappCompleteResponse = Readonly<{\n accounts: Array<AuthorizedAccount>;\n walletUriBase?: string;\n authorizationScope?: Uint8Array;\n signInResult?: SignInResult;\n}>;\nexport type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;\n\n/* Reauthorize Dapp */\nexport type ReauthorizeDappCompleteResponse = Readonly<{\n authorizationScope?: Uint8Array;\n}>;\nexport type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Deauthorize Dapp */\nexport type DeauthorizeDappCompleteResponse = Readonly<{}>;\nexport type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Sign Transactions/Messages */\nexport type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;\nexport type SignPayloadsFailResponse =\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\nexport type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\n\n/* Sign and Send Transaction */\nexport type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[] }>;\nexport type SignAndSendTransactionsResponse =\n | SignAndSendTransactionsCompleteResponse\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;\nexport function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;\nexport function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;\nexport function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;\nexport function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;\nexport function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;\nexport function resolve(request: MWARequest, response: MWAResponse): void {\n SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));\n}\n","export enum SolanaMWAWalletLibErrorCode {\n ERROR_INTENT_DATA_NOT_FOUND = 'ERROR_INTENT_DATA_NOT_FOUND',\n ERROR_SESSION_ALREADY_CREATED = 'ERROR_SESSION_ALREADY_CREATED',\n ERROR_UNSUPPORTED_ASSOCIATION_URI = 'ERROR_UNSUPPORTED_ASSOCIATION_URI',\n ERROR_UNSUPPORTED_ASSOCIATION_TYPE = 'ERROR_UNSUPPORTED_ASSOCIATION_TYPE',\n}\n\nexport class SolanaMWAWalletLibError extends Error {\n code: SolanaMWAWalletLibErrorCode;\n constructor(code: SolanaMWAWalletLibErrorCode, message: string) {\n super(message);\n this.name = 'SolanaMWAWalletLibError';\n this.code = code;\n }\n}\n","import type { TransactionVersion } from '@solana/web3.js';\nimport type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode } from './errors.js';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype ReactNativeError = Error & { code?: string; userInfo?: Record<string, unknown> };\n\nfunction handleError(e: any): never {\n if (e instanceof Error) {\n const { code, message } = e as ReactNativeError;\n if (code && code in SolanaMWAWalletLibErrorCode) {\n throw new SolanaMWAWalletLibError(code as SolanaMWAWalletLibErrorCode, message);\n }\n }\n throw e;\n}\n\nexport type MWASessionId = string;\n\nexport interface MobileWalletAdapterConfig {\n maxTransactionsPerSigningRequest: number;\n maxMessagesPerSigningRequest: number;\n supportedTransactionVersions: Array<TransactionVersion>;\n noConnectionWarningTimeoutMs: number;\n optionalFeatures: IdentifierArray;\n}\n\nexport async function initializeMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n): Promise<MWASessionId> {\n try {\n return await initializeScenario(walletName, config);\n } catch (e) {\n handleError(e);\n }\n}\n\n// Create Scenario and establish session with dapp\nfunction initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig): Promise<MWASessionId> {\n return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));\n}\n","import { EmitterSubscription, NativeEventEmitter } from 'react-native';\n\nimport { MWASessionEvent, MWASessionEventType } from './mwaSessionEvents.js';\nimport { MWARequest, MWARequestType } from './resolve.js';\n\nconst MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';\n\nexport function initializeMWAEventListener(\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n): EmitterSubscription {\n const mwaEventEmitter = new NativeEventEmitter();\n const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {\n if (isMWARequest(nativeEvent)) {\n handleRequest(nativeEvent as MWARequest);\n } else if (isMWASessionEvent(nativeEvent)) {\n handleSessionEvent(nativeEvent as MWASessionEvent);\n } else {\n console.warn('Unexpected native event type');\n }\n });\n\n return listener;\n}\n\nfunction isMWARequest(nativeEvent: any): boolean {\n return Object.values(MWARequestType).includes(nativeEvent.__type);\n}\n\nfunction isMWASessionEvent(nativeEvent: any) {\n return Object.values(MWASessionEventType).includes(nativeEvent.__type);\n}\n","import { useEffect } from 'react';\n\nimport {\n initializeMobileWalletAdapterSession,\n MobileWalletAdapterConfig,\n} from './initializeMobileWalletAdapterSession.js';\nimport { initializeMWAEventListener } from './initializeMWAEventListener.js';\nimport { MWASessionEvent } from './mwaSessionEvents.js';\nimport { MWARequest } from './resolve.js';\n\nexport function useMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n) {\n useEffect(() => {\n async function startSession() {\n try {\n await initializeMobileWalletAdapterSession(walletName, config);\n } catch (e) {\n console.error(e);\n }\n }\n const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);\n startSession();\n return () => {\n listener.remove();\n };\n }, []);\n}\n","import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileDigitalAssetLinks =\n Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks\n ? NativeModules.SolanaMobileDigitalAssetLinks\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\nexport async function getCallingPackage(): Promise<string | undefined> {\n return await SolanaMobileDigitalAssetLinks.getCallingPackage();\n}\n\nexport async function verifyCallingPackage(clientIdentityUri: string) {\n return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);\n}\n\nexport async function getCallingPackageUid() {\n return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();\n}\n\nexport async function getUidForPackage(packageName: string) {\n return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);\n}\n"],"mappings":";;;;;;;AAIA,IAAY,sBAAL,yBAAA,qBAAA;AACH,qBAAA,uBAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,4BAAA;AACA,qBAAA,gCAAA;AACA,qBAAA,iCAAA;AACA,qBAAA,0BAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,kCAAA;AACA,qBAAA,+BAAA;;KACH;;;ACXD,MAAMA,kBACF;AAOJ,MAAMC,uCACF,SAAS,OAAO,aAAa,cAAc,qCACrC,cAAc,qCACd,IAAI,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACAD,gBACT;GAER,CACJ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BACmB;AAYnB,QAXwB,IAAI,oBAAoB,CACf,YAAY,0CAA0C,gBAAgB;AACnG,MAAI,aAAa,YAAY,CACzB,eAAc,YAA0B;WACjC,kBAAkB,YAAY,CACrC,oBAAmB,YAA+B;MAElD,SAAQ,KAAK,+BAA+B;GAElD;;AAKN,SAAS,aAAa,aAA2B;AAC7C,QAAO,OAAO,OAAO,eAAe,CAAC,SAAS,YAAY,OAAO;;AAGrE,SAAS,kBAAkB,aAAkB;AACzC,QAAO,OAAO,OAAO,oBAAoB,CAAC,SAAS,YAAY,OAAO;;;;ACpB1E,SAAgB,8BACZ,YACA,QACA,eACA,oBACF;AACE,iBAAgB;EACZ,eAAe,eAAe;AAC1B,OAAI;AACA,UAAM,qCAAqC,YAAY,OAAO;YACzD,GAAG;AACR,YAAQ,MAAM,EAAE;;;EAGxB,MAAM,WAAW,2BAA2B,eAAe,mBAAmB;AAC9E,gBAAc;AACd,eAAa;AACT,YAAS,QAAQ;;IAEtB,EAAE,CAAC;;;;AC3BV,MAAM,gBACF;AAOJ,MAAM,gCACF,SAAS,OAAO,aAAa,cAAc,gCACrC,cAAc,gCACd,IAAI,MACA,EAAE,EACF,EACI,MAAM;AACF,OAAM,IAAI,MACN,SAAS,OAAO,YACV,sGACA,cACT;GAER,CACJ;AAEX,eAAsB,oBAAiD;AACnE,QAAO,MAAM,8BAA8B,mBAAmB;;AAGlE,eAAsB,qBAAqB,mBAA2B;AAClE,QAAO,MAAM,8BAA8B,qBAAqB,kBAAkB;;AAGtF,eAAsB,uBAAuB;AACzC,QAAO,MAAM,8BAA8B,sBAAsB;;AAGrE,eAAsB,iBAAiB,aAAqB;AACxD,QAAO,MAAM,8BAA8B,iBAAiB,YAAY"}
1
+ {"version":3,"file":"index.native.js","names":["LINKING_ERROR","SolanaMobileWalletAdapterWalletLib","LINKING_ERROR"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../src/errors.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useMobileWalletAdapterSession.ts","../../src/useDigitalAssetLinks.ts"],"sourcesContent":["/**\n * Mobile Wallet Adapter Session Events are notifications and events\n * about the underlying session between the wallet and the dApp.\n */\nexport enum MWASessionEventType {\n SessionStartEvent = 'SESSION_START',\n SessionReadyEvent = 'SESSION_READY',\n SessionTerminatedEvent = 'SESSION_TERMINATED',\n SessionServingClientsEvent = 'SESSION_SERVING_CLIENTS',\n SessionServingCompleteEvent = 'SESSION_SERVING_COMPLETE',\n SessionCompleteEvent = 'SESSION_COMPLETE',\n SessionErrorEvent = 'SESSION_ERROR',\n SessionTeardownCompleteEvent = 'SESSION_TEARDOWN_COMPLETE',\n LowPowerNoConnectionEvent = 'LOW_POWER_NO_CONNECTION',\n}\nexport interface IMWASessionEvent {\n __type: MWASessionEventType;\n sessionId: string;\n}\n\nexport type SessionStartEvent = Readonly<{\n __type: MWASessionEventType.SessionStartEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionReadyEvent = Readonly<{\n __type: MWASessionEventType.SessionReadyEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTerminatedEvent = Readonly<{\n __type: MWASessionEventType.SessionTerminatedEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingClientsEvent = Readonly<{\n __type: MWASessionEventType.SessionServingClientsEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionServingCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionServingCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionErrorEvent = Readonly<{\n __type: MWASessionEventType.SessionErrorEvent;\n}> &\n IMWASessionEvent;\n\nexport type SessionTeardownCompleteEvent = Readonly<{\n __type: MWASessionEventType.SessionTeardownCompleteEvent;\n}> &\n IMWASessionEvent;\n\nexport type LowPowerNoConnectionEvent = Readonly<{\n __type: MWASessionEventType.LowPowerNoConnectionEvent;\n}> &\n IMWASessionEvent;\n\nexport type MWASessionEvent =\n | SessionStartEvent\n | SessionReadyEvent\n | SessionTerminatedEvent\n | SessionServingClientsEvent\n | SessionServingCompleteEvent\n | SessionCompleteEvent\n | SessionErrorEvent\n | SessionTeardownCompleteEvent\n | LowPowerNoConnectionEvent;\n","import type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype AppIdentity = Readonly<{\n identityUri?: string;\n iconRelativeUri?: string;\n identityName?: string;\n}>;\n\nexport type SignInPayload = Readonly<{\n domain?: string;\n address?: string;\n statement?: string;\n uri?: string;\n version?: string;\n chainId?: string;\n nonce?: string;\n issuedAt?: string;\n expirationTime?: string;\n notBefore?: string;\n requestId?: string;\n resources?: readonly string[];\n}>;\n\nexport type Base64EncodedAddress = string;\nexport type Base64EncodedSignature = string;\ntype Base64EncodedSignedMessage = string;\n\n/**\n * Mobile Wallet Adapter Requests are remote requests coming from\n * the dApp for authorization, signing, and sending services.\n */\n\nexport type MWARequest =\n | SignMessagesRequest\n | SignTransactionsRequest\n | SignAndSendTransactionsRequest\n | AuthorizeDappRequest\n | ReauthorizeDappRequest\n | DeauthorizeDappRequest;\n\nexport enum MWARequestType {\n AuthorizeDappRequest = 'AUTHORIZE_DAPP',\n ReauthorizeDappRequest = 'REAUTHORIZE_DAPP',\n DeauthorizeDappRequest = 'DEAUTHORIZE_DAPP',\n SignMessagesRequest = 'SIGN_MESSAGES',\n SignTransactionsRequest = 'SIGN_TRANSACTIONS',\n SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',\n}\n\ninterface IMWARequest {\n __type: MWARequestType;\n requestId: string;\n sessionId: string;\n}\n\ninterface IVerifiableIdentityRequest {\n chain: string;\n authorizationScope: Uint8Array;\n appIdentity?: AppIdentity;\n}\n\nexport type AuthorizeDappRequest = Readonly<{\n __type: MWARequestType.AuthorizeDappRequest;\n chain: string;\n appIdentity?: AppIdentity;\n features?: IdentifierArray;\n addresses?: [string];\n signInPayload?: SignInPayload;\n}> &\n IMWARequest;\n\nexport type ReauthorizeDappRequest = Readonly<{\n __type: MWARequestType.ReauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type DeauthorizeDappRequest = Readonly<{\n __type: MWARequestType.DeauthorizeDappRequest;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignMessagesRequest = Readonly<{\n __type: MWARequestType.SignMessagesRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignTransactionsRequest = Readonly<{\n __type: MWARequestType.SignTransactionsRequest;\n payloads: Uint8Array[];\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\nexport type SignAndSendTransactionsRequest = Readonly<{\n __type: MWARequestType.SignAndSendTransactionsRequest;\n payloads: Uint8Array[];\n minContextSlot?: number;\n commitment?: string;\n skipPreflight?: boolean;\n maxRetries?: number;\n waitForCommitmentToSendNextTransaction?: boolean;\n}> &\n IMWARequest &\n IVerifiableIdentityRequest;\n\n/**\n * MWA Request Responses\n */\n\nexport type MWAResponse =\n | AuthorizeDappResponse\n | ReauthorizeDappResponse\n | DeauthorizeDappResponse\n | SignMessagesResponse\n | SignTransactionsResponse\n | SignAndSendTransactionsResponse;\n\n/* Failure Responses */\nexport enum MWARequestFailReason {\n UserDeclined = 'USER_DECLINED',\n TooManyPayloads = 'TOO_MANY_PAYLOADS',\n InvalidSignatures = 'INVALID_SIGNATURES',\n AuthorizationNotValid = 'AUTHORIZATION_NOT_VALID',\n}\n\nexport type UserDeclinedResponse = Readonly<{\n failReason: MWARequestFailReason.UserDeclined;\n}>;\n\nexport type TooManyPayloadsResponse = Readonly<{\n failReason: MWARequestFailReason.TooManyPayloads;\n}>;\n\nexport type AuthorizationNotValidResponse = Readonly<{\n failReason: MWARequestFailReason.AuthorizationNotValid;\n}>;\n\nexport type InvalidSignaturesResponse = Readonly<{\n failReason: MWARequestFailReason.InvalidSignatures;\n valid: boolean[];\n}>;\n\n/* Authorize Dapp */\nexport type AuthorizedAccount = Readonly<{\n publicKey: Uint8Array;\n accountLabel?: string;\n icon?: string;\n chains?: IdentifierArray;\n features?: IdentifierArray;\n}>;\nexport type SignInResult = Readonly<{\n address: Base64EncodedAddress;\n signed_message: Base64EncodedSignedMessage;\n signature: Base64EncodedSignature;\n signature_type?: string;\n}>;\nexport type AuthorizeDappCompleteResponse = Readonly<{\n accounts: Array<AuthorizedAccount>;\n walletUriBase?: string;\n authorizationScope?: Uint8Array;\n signInResult?: SignInResult;\n}>;\nexport type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;\n\n/* Reauthorize Dapp */\nexport type ReauthorizeDappCompleteResponse = Readonly<{\n authorizationScope?: Uint8Array;\n}>;\nexport type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Deauthorize Dapp */\nexport type DeauthorizeDappCompleteResponse = Readonly<Record<string, never>>;\nexport type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;\n\n/* Sign Transactions/Messages */\nexport type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;\nexport type SignPayloadsFailResponse =\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\nexport type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;\n\n/* Sign and Send Transaction */\nexport type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[] }>;\nexport type SignAndSendTransactionsResponse =\n | SignAndSendTransactionsCompleteResponse\n | UserDeclinedResponse\n | TooManyPayloadsResponse\n | AuthorizationNotValidResponse\n | InvalidSignaturesResponse;\n\nexport function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;\nexport function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;\nexport function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;\nexport function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;\nexport function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;\nexport function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;\nexport function resolve(request: MWARequest, response: MWAResponse): void {\n SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));\n}\n","export enum SolanaMWAWalletLibErrorCode {\n ERROR_INTENT_DATA_NOT_FOUND = 'ERROR_INTENT_DATA_NOT_FOUND',\n ERROR_SESSION_ALREADY_CREATED = 'ERROR_SESSION_ALREADY_CREATED',\n ERROR_UNSUPPORTED_ASSOCIATION_URI = 'ERROR_UNSUPPORTED_ASSOCIATION_URI',\n ERROR_UNSUPPORTED_ASSOCIATION_TYPE = 'ERROR_UNSUPPORTED_ASSOCIATION_TYPE',\n}\n\nexport class SolanaMWAWalletLibError extends Error {\n code: SolanaMWAWalletLibErrorCode;\n constructor(code: SolanaMWAWalletLibErrorCode, message: string) {\n super(message);\n this.name = 'SolanaMWAWalletLibError';\n this.code = code;\n }\n}\n","import type { TransactionVersion } from '@solana/web3.js';\nimport type { IdentifierArray } from '@wallet-standard/core';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode } from './errors.js';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileWalletAdapterWalletLib =\n Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib\n ? NativeModules.SolanaMobileWalletAdapterWalletLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\ntype ReactNativeError = Error & { code?: string; userInfo?: Record<string, unknown> };\n\nfunction handleError(e: unknown): never {\n if (e instanceof Error) {\n const { code, message } = e as ReactNativeError;\n if (code && code in SolanaMWAWalletLibErrorCode) {\n throw new SolanaMWAWalletLibError(code as SolanaMWAWalletLibErrorCode, message);\n }\n }\n throw e;\n}\n\nexport type MWASessionId = string;\n\nexport interface MobileWalletAdapterConfig {\n maxTransactionsPerSigningRequest: number;\n maxMessagesPerSigningRequest: number;\n supportedTransactionVersions: Array<TransactionVersion>;\n noConnectionWarningTimeoutMs: number;\n optionalFeatures: IdentifierArray;\n}\n\nexport async function initializeMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n): Promise<MWASessionId> {\n try {\n return await initializeScenario(walletName, config);\n } catch (e) {\n handleError(e);\n }\n}\n\n// Create Scenario and establish session with dapp\nfunction initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig): Promise<MWASessionId> {\n return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));\n}\n","import { EmitterSubscription, NativeEventEmitter } from 'react-native';\n\nimport { MWASessionEvent, MWASessionEventType } from './mwaSessionEvents.js';\nimport { MWARequest, MWARequestType } from './resolve.js';\n\nconst MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';\ntype NativeMWAEvent = Readonly<{ __type?: unknown }>;\n\nexport function initializeMWAEventListener(\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n): EmitterSubscription {\n const mwaEventEmitter = new NativeEventEmitter();\n const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {\n const event = nativeEvent as NativeMWAEvent;\n if (isMWARequest(event)) {\n handleRequest(event);\n } else if (isMWASessionEvent(event)) {\n handleSessionEvent(event);\n } else {\n console.warn('Unexpected native event type');\n }\n });\n\n return listener;\n}\n\nfunction isMWARequest(nativeEvent: NativeMWAEvent): nativeEvent is MWARequest {\n return Object.values(MWARequestType).includes(nativeEvent.__type as MWARequest['__type']);\n}\n\nfunction isMWASessionEvent(nativeEvent: NativeMWAEvent): nativeEvent is MWASessionEvent {\n return Object.values(MWASessionEventType).includes(nativeEvent.__type as MWASessionEvent['__type']);\n}\n","import { useEffect } from 'react';\n\nimport {\n initializeMobileWalletAdapterSession,\n MobileWalletAdapterConfig,\n} from './initializeMobileWalletAdapterSession.js';\nimport { initializeMWAEventListener } from './initializeMWAEventListener.js';\nimport { MWASessionEvent } from './mwaSessionEvents.js';\nimport { MWARequest } from './resolve.js';\n\nexport function useMobileWalletAdapterSession(\n walletName: string,\n config: MobileWalletAdapterConfig,\n handleRequest: (request: MWARequest) => void,\n handleSessionEvent: (sessionEvent: MWASessionEvent) => void,\n) {\n useEffect(() => {\n async function startSession() {\n try {\n await initializeMobileWalletAdapterSession(walletName, config);\n } catch (e) {\n console.error(e);\n }\n }\n const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);\n startSession();\n return () => {\n listener.remove();\n };\n }, []);\n}\n","import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \\n\\n` +\n '- You rebuilt the app after installing the package\\n' +\n '- If you are using Lerna workspaces\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\\n' +\n ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SolanaMobileDigitalAssetLinks =\n Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks\n ? NativeModules.SolanaMobileDigitalAssetLinks\n : new Proxy(\n {},\n {\n get() {\n throw new Error(\n Platform.OS !== 'android'\n ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'\n : LINKING_ERROR,\n );\n },\n },\n );\n\nexport async function getCallingPackage(): Promise<string | undefined> {\n return await SolanaMobileDigitalAssetLinks.getCallingPackage();\n}\n\nexport async function verifyCallingPackage(clientIdentityUri: string) {\n return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);\n}\n\nexport async function getCallingPackageUid() {\n return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();\n}\n\nexport async function getUidForPackage(packageName: string) {\n return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);\n}\n"],"mappings":";;;;;;;AAIA,IAAY,sBAAL,yBAAA,qBAAA;AACH,qBAAA,uBAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,4BAAA;AACA,qBAAA,gCAAA;AACA,qBAAA,iCAAA;AACA,qBAAA,0BAAA;AACA,qBAAA,uBAAA;AACA,qBAAA,kCAAA;AACA,qBAAA,+BAAA;;KACH;;;ACXD,MAAMA,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B,YAAY"}
@@ -174,7 +174,7 @@ type ReauthorizeDappCompleteResponse = Readonly<{
174
174
  authorizationScope?: Uint8Array;
175
175
  }>;
176
176
  type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
177
- type DeauthorizeDappCompleteResponse = Readonly<{}>;
177
+ type DeauthorizeDappCompleteResponse = Readonly<Record<string, never>>;
178
178
  type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
179
179
  type SignPayloadsCompleteResponse = Readonly<{
180
180
  signedPayloads: Uint8Array[];
@@ -193,7 +193,7 @@ declare function resolve(request: SignMessagesRequest, response: SignMessagesRes
193
193
  declare function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;
194
194
  declare function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;
195
195
  //#endregion
196
- //#region ../../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@5.6.3_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.d.ts
196
+ //#region ../../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.d.ts
197
197
  type TransactionVersion = 'legacy' | 0;
198
198
  /**
199
199
  * Versioned transaction class
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Buffer","Agent","Agent$1","Struct","constructor","properties","encode","decode","data","decodeUnchecked","Enum","enum","SOLANA_SCHEMA","Function","Map","MAX_SEED_LENGTH","PUBLIC_KEY_LENGTH","PublicKeyInitData","Uint8Array","Array","PublicKeyData","PublicKey","Symbol","toStringTag","Promise","value","unique","default","equals","publicKey","toBase58","toJSON","toBytes","toBuffer","toString","createWithSeed","fromPublicKey","seed","programId","createProgramAddressSync","seeds","createProgramAddress","findProgramAddressSync","findProgramAddress","isOnCurve","pubkeyData","Account","secretKey","Blockhash","BPF_LOADER_DEPRECATED_PROGRAM_ID","EpochSchedule","slotsPerEpoch","leaderScheduleSlotOffset","warmup","firstNormalEpoch","firstNormalSlot","getEpoch","slot","getEpochAndSlotIndex","getFirstSlotInEpoch","epoch","getLastSlotInEpoch","getSlotsInEpoch","_default","globalThis","fetch","FeeCalculator","lamportsPerSignature","NONCE_ACCOUNT_LENGTH","DurableNonce","NonceAccount","authorizedPubkey","nonce","feeCalculator","fromAccountData","buffer","Ed25519SecretKey","Ed25519Keypair","Signer","Keypair","_keypair","keypair","generate","fromSecretKey","skipValidation","options","fromSeed","PACKET_DATA_SIZE","VERSION_PREFIX_MASK","SIGNATURE_LENGTH_IN_BYTES","TransactionExpiredBlockheightExceededError","Error","signature","TransactionExpiredTimeoutError","timeoutSeconds","TransactionExpiredNonceInvalidError","AccountKeysFromLookups","LoadedAddresses","MessageAccountKeys","TransactionInstruction","MessageCompiledInstruction","staticAccountKeys","accountKeysFromLookups","keySegments","get","index","length","compileInstructions","instructions","CompiledInstruction","programIdIndex","accounts","MessageArgs","MessageHeader","header","accountKeys","recentBlockhash","CompileLegacyArgs","payerKey","Message","MessageAddressTableLookup","indexToProgramIds","args","version","compiledInstructions","addressTableLookups","getAccountKeys","compile","isAccountSigner","isAccountWritable","isProgramId","programIds","nonProgramIds","serialize","from","AddressLookupTableState","deactivationSlot","lastExtendedSlot","lastExtendedSlotStartIndex","authority","addresses","AddressLookupTableAccountArgs","key","state","AddressLookupTableAccount","isActive","deserialize","accountData","CreateLookupTableParams","payer","recentSlot","FreezeLookupTableParams","lookupTable","ExtendLookupTableParams","DeactivateLookupTableParams","CloseLookupTableParams","recipient","LookupTableInstructionType","AddressLookupTableInstruction","decodeInstructionType","instruction","decodeCreateLookupTable","decodeExtendLookupTable","decodeCloseLookupTable","decodeFreezeLookupTable","decodeDeactivateLookupTable","AddressLookupTableProgram","createLookupTable","params","freezeLookupTable","extendLookupTable","deactivateLookupTable","closeLookupTable","ComputeBudgetInstruction","ComputeBudgetInstructionType","RequestUnitsParams","RequestHeapFrameParams","SetComputeUnitLimitParams","SetComputeUnitPriceParams","decodeRequestUnits","decodeRequestHeapFrame","decodeSetComputeUnitLimit","decodeSetComputeUnitPrice","units","additionalFee","bytes","microLamports","ComputeBudgetProgram","requestUnits","requestHeapFrame","setComputeUnitLimit","setComputeUnitPrice","CreateEd25519InstructionWithPublicKeyParams","message","instructionIndex","CreateEd25519InstructionWithPrivateKeyParams","privateKey","Ed25519Program","createInstructionWithPublicKey","createInstructionWithPrivateKey","CreateSecp256k1InstructionWithPublicKeyParams","recoveryId","CreateSecp256k1InstructionWithEthAddressParams","ethAddress","CreateSecp256k1InstructionWithPrivateKeyParams","Secp256k1Program","publicKeyToEthAddress","createInstructionWithEthAddress","STAKE_CONFIG_ID","Authorized","staker","withdrawer","Lockup","unixTimestamp","custodian","CreateStakeAccountParams","fromPubkey","stakePubkey","authorized","lockup","lamports","CreateStakeAccountWithSeedParams","basePubkey","InitializeStakeParams","DelegateStakeParams","votePubkey","AuthorizeStakeParams","StakeAuthorizationType","newAuthorizedPubkey","stakeAuthorizationType","custodianPubkey","AuthorizeWithSeedStakeParams","authorityBase","authoritySeed","authorityOwner","SplitStakeParams","splitStakePubkey","SplitStakeWithSeedParams","WithdrawStakeParams","toPubkey","DeactivateStakeParams","MergeStakeParams","sourceStakePubKey","StakeInstruction","StakeInstructionType","decodeInitialize","decodeDelegate","decodeAuthorize","decodeAuthorizeWithSeed","decodeSplit","decodeMerge","decodeWithdraw","decodeDeactivate","StakeAuthorizationLayout","Readonly","Staker","Withdrawer","StakeProgram","Transaction","space","initialize","createAccountWithSeed","createAccount","delegate","authorize","authorizeWithSeed","split","rentExemptReserve","splitWithSeed","merge","withdraw","deactivate","CreateAccountParams","newAccountPubkey","TransferParams","AssignParams","accountPubkey","CreateAccountWithSeedParams","CreateNonceAccountParams","noncePubkey","CreateNonceAccountWithSeedParams","InitializeNonceParams","AdvanceNonceParams","WithdrawNonceParams","AuthorizeNonceParams","AllocateParams","AllocateWithSeedParams","AssignWithSeedParams","TransferWithSeedParams","DecodedTransferInstruction","DecodedTransferWithSeedInstruction","SystemInstruction","SystemInstructionType","decodeCreateAccount","decodeTransfer","decodeTransferWithSeed","decodeAllocate","decodeAllocateWithSeed","decodeAssign","decodeAssignWithSeed","decodeCreateWithSeed","decodeNonceInitialize","decodeNonceAdvance","decodeNonceWithdraw","decodeNonceAuthorize","SystemProgram","transfer","assign","createNonceAccount","nonceInitialize","nonceAdvance","nonceWithdraw","nonceAuthorize","allocate","VoteInit","nodePubkey","authorizedVoter","authorizedWithdrawer","commission","CreateVoteAccountParams","voteInit","InitializeAccountParams","AuthorizeVoteParams","VoteAuthorizationType","voteAuthorizationType","AuthorizeVoteWithSeedParams","currentAuthorityDerivedKeyBasePubkey","currentAuthorityDerivedKeyOwnerPubkey","currentAuthorityDerivedKeySeed","WithdrawFromVoteAccountParams","authorizedWithdrawerPubkey","UpdateValidatorIdentityParams","VoteInstruction","VoteInstructionType","decodeInitializeAccount","VoteAuthorizationLayout","Voter","VoteProgram","initializeAccount","safeWithdraw","currentVoteAccountBalance","rentExemptMinimum","updateValidatorIdentity","MessageV0Args","CompileV0Args","addressLookupTableAccounts","GetAccountKeysArgs","MessageV0","numAccountKeysFromLookups","resolveAddressTableLookups","serializeInstructions","serializeAddressTableLookups","serializedMessage","VersionedMessage","deserializeMessageVersion","numRequiredSignatures","numReadonlySignedAccounts","numReadonlyUnsignedAccounts","accountKey","writableIndexes","readonlyIndexes","accountKeyIndexes","TransactionSignature","TransactionStatus","BLOCKHEIGHT_EXCEEDED","PROCESSED","TIMED_OUT","NONCE_INVALID","AccountMeta","pubkey","isSigner","isWritable","TransactionInstructionCtorFields","keys","SerializeConfig","requireAllSignatures","verifySignatures","opts","SignaturePubkeyPair","TransactionCtorFields_DEPRECATED","NonceInformation","nonceInfo","feePayer","signatures","TransactionCtorFields","TransactionBlockhashCtor","blockhash","lastValidBlockHeight","TransactionNonceCtor","minContextSlot","nonceInstruction","Connection","minNonceContextSlot","add","items","compileMessage","serializeMessage","getEstimatedFee","connection","setSigners","signers","sign","partialSign","addSignature","config","populate","TransactionMessageArgs","DecompileArgs","TransactionMessage","decompile","compileToLegacyMessage","compileToV0Message","TransactionVersion","VersionedTransaction","serializedTransaction","ClientSubscriptionId","TokenAccountsFilter","mint","Context","SendOptions","Commitment","skipPreflight","preflightCommitment","maxRetries","ConfirmOptions","commitment","ConfirmedSignaturesForAddress2Options","before","until","limit","SignaturesForAddressOptions","RpcResponseAndContext","T","context","BlockhashWithExpiryBlockHeight","BlockheightBasedTransactionConfirmationStrategy","BaseTransactionConfirmationStrategy","DurableNonceTransactionConfirmationStrategy","nonceAccountPubkey","nonceValue","AbortSignal","abortSignal","TransactionConfirmationStrategy","Finality","LargestAccountsFilter","GetAccountInfoConfig","DataSlice","dataSlice","GetBalanceConfig","GetBlockConfig","rewards","transactionDetails","GetVersionedBlockConfig","maxSupportedTransactionVersion","GetStakeMinimumDelegationConfig","GetBlockHeightConfig","GetEpochInfoConfig","GetInflationRewardConfig","GetLatestBlockhashConfig","IsBlockhashValidConfig","GetSlotConfig","GetSlotLeaderConfig","GetTransactionConfig","GetVersionedTransactionConfig","GetLargestAccountsConfig","filter","GetSupplyConfig","excludeNonCirculatingAccountsList","SignatureStatusConfig","searchTransactionHistory","ContactInfo","gossip","tpu","rpc","VoteAccountInfo","activatedStake","epochVoteAccount","epochCredits","lastVote","VoteAccountStatus","current","delinquent","InflationGovernor","foundation","foundationTerm","initial","taper","terminal","InflationReward","effectiveSlot","amount","postBalance","RecentPrioritizationFees","prioritizationFee","GetRecentPrioritizationFeesConfig","lockedWritableAccounts","InflationRate","total","validator","EpochInfo","slotIndex","slotsInEpoch","absoluteSlot","blockHeight","transactionCount","LeaderSchedule","address","Version","SimulatedTransactionAccountInfo","executable","owner","rentEpoch","TransactionReturnDataEncoding","TransactionReturnData","SimulateTransactionConfig","sigVerify","replaceRecentBlockhash","encoding","innerInstructions","SimulatedTransactionResponse","TransactionError","ParsedInnerInstruction","err","logs","unitsConsumed","returnData","ParsedInstruction","PartiallyDecodedInstruction","TokenBalance","TokenAmount","accountIndex","uiTokenAmount","ParsedConfirmedTransactionMeta","ParsedTransactionMeta","writable","readonly","fee","preBalances","postBalances","logMessages","preTokenBalances","postTokenBalances","loadedAddresses","computeUnitsConsumed","costUnits","CompiledInnerInstruction","ConfirmedTransactionMeta","TransactionResponse","transaction","meta","blockTime","VersionedTransactionResponse","ConfirmedTransaction","ParsedMessageAccount","signer","source","program","parsed","ParsedAddressTableLookup","ParsedMessage","ParsedTransaction","ParsedConfirmedTransaction","ParsedTransactionWithMeta","BlockResponse","previousBlockhash","parentSlot","transactions","rewardType","AccountsModeBlockResponse","VersionedAccountsModeBlockResponse","NoneModeBlockResponse","VersionedNoneModeBlockResponse","ParsedBlockResponse","ParsedAccountsModeBlockResponse","Omit","Pick","ParsedNoneModeBlockResponse","VersionedBlockResponse","ConfirmedBlock","BlockSignatures","BlockProduction","ReadonlyArray","Record","byIdentity","range","firstSlot","lastSlot","GetBlockProductionConfig","identity","PerfSample","numTransactions","numSlots","samplePeriodSecs","Supply","circulating","nonCirculating","nonCirculatingAccounts","decimals","uiAmount","uiAmountString","TokenAccountBalancePair","AccountBalancePair","SlotUpdate","type","timestamp","parent","stats","numTransactionEntries","numSuccessfulTransactions","numFailedTransactions","maxTransactionsPerEntry","SlotInfo","root","ParsedAccountData","StakeActivationData","active","inactive","offset","MemcmpFilter","memcmp","DataSizeFilter","dataSize","GetProgramAccountsFilter","GetProgramAccountsConfig","filters","withContext","GetProgramAccountsResponse","AccountInfo","account","GetParsedProgramAccountsConfig","GetMultipleAccountsConfig","GetStakeActivationConfig","GetTokenAccountsByOwnerConfig","GetTransactionCountConfig","GetNonceConfig","GetNonceAndContextConfig","AccountSubscriptionConfig","ProgramAccountSubscriptionConfig","KeyedAccountInfo","accountId","accountInfo","AccountChangeCallback","ProgramAccountChangeCallback","keyedAccountInfo","SlotChangeCallback","slotInfo","SlotUpdateCallback","slotUpdate","SignatureResultCallback","SignatureResult","signatureResult","SignatureStatusNotification","result","SignatureReceivedNotification","SignatureSubscriptionCallback","notification","SignatureSubscriptionOptions","enableReceivedNotification","RootChangeCallback","Logs","LogsFilter","LogsCallback","ctx","TransactionConfirmationStatus","SignatureStatus","confirmations","confirmationStatus","ConfirmedSignatureInfo","memo","HttpHeaders","FetchFn","FetchMiddleware","Parameters","info","init","a","ConnectionConfig","httpAgent","wsEndpoint","httpHeaders","fetchMiddleware","disableRetryOnRateLimit","confirmTransactionInitialTimeout","endpoint","commitmentOrConfig","rpcEndpoint","getBalanceAndContext","getBalance","getBlockTime","getMinimumLedgerSlot","getFirstAvailableBlock","getSupply","getTokenSupply","tokenMintAddress","getTokenAccountBalance","tokenAddress","getTokenAccountsByOwner","ownerAddress","getParsedTokenAccountsByOwner","getLargestAccounts","getTokenLargestAccounts","mintAddress","getAccountInfoAndContext","getParsedAccountInfo","getAccountInfo","getMultipleParsedAccounts","publicKeys","rawConfig","getMultipleAccountsInfoAndContext","getMultipleAccountsInfo","getStakeActivation","getProgramAccounts","configOrCommitment","getParsedProgramAccounts","confirmTransaction","strategy","getCancellationPromise","getTransactionConfirmationPromise","confirmTransactionUsingBlockHeightExceedanceStrategy","confirmTransactionUsingDurableNonceStrategy","confirmTransactionUsingLegacyTimeoutStrategy","getClusterNodes","getVoteAccounts","getSlot","getSlotLeader","getSlotLeaders","startSlot","getSignatureStatus","getSignatureStatuses","getTransactionCount","getTotalSupply","getInflationGovernor","getInflationReward","getInflationRate","getEpochInfo","getEpochSchedule","getLeaderSchedule","getMinimumBalanceForRentExemption","dataLength","getRecentBlockhashAndContext","getRecentPerformanceSamples","getFeeCalculatorForBlockhash","getFeeForMessage","getRecentPrioritizationFees","getRecentBlockhash","getLatestBlockhash","getLatestBlockhashAndContext","isBlockhashValid","getVersion","getGenesisHash","getBlock","getParsedBlock","getBlockHeight","getBlockProduction","getTransaction","getParsedTransaction","getParsedTransactions","getTransactions","getConfirmedBlock","getBlocks","endSlot","getBlockSignatures","getConfirmedBlockSignatures","getConfirmedTransaction","getParsedConfirmedTransaction","getParsedConfirmedTransactions","getConfirmedSignaturesForAddress","getConfirmedSignaturesForAddress2","getSignaturesForAddress","getAddressLookupTable","getNonceAndContext","nonceAccount","getNonce","requestAirdrop","to","getStakeMinimumDelegation","simulateTransaction","transactionOrMessage","includeAccounts","sendTransaction","sendRawTransaction","rawTransaction","sendEncodedTransaction","encodedTransaction","onAccountChange","callback","removeAccountChangeListener","clientSubscriptionId","onProgramAccountChange","removeProgramAccountChangeListener","onLogs","removeOnLogsListener","onSlotChange","removeSlotChangeListener","onSlotUpdate","removeSlotUpdateListener","_buildArgs","override","extra","onSignature","onSignatureWithOptions","removeSignatureListener","onRootChange","removeRootChangeListener","BPF_LOADER_PROGRAM_ID","BpfLoader","getMinNumSignatures","load","elf","loaderProgramId","SendTransactionError","action","transactionMessage","transactionLogs","transactionError","getLogs","SolanaJSONRPCErrorCode","JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP","JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE","JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE","JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE","JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY","JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE","JSON_RPC_SERVER_ERROR_SLOT_SKIPPED","JSON_RPC_SERVER_ERROR_NO_SNAPSHOT","JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED","JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX","JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE","JSON_RPC_SCAN_ERROR","JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH","JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET","JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION","JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED","SolanaJSONRPCErrorCodeEnum","SolanaJSONRPCError","code","customMessage","Loader","chunkSize","VALIDATOR_INFO_KEY","Info","name","website","details","iconUrl","keybaseUsername","ValidatorInfo","fromConfigData","VOTE_PROGRAM_ID","Lockout","confirmationCount","EpochCredits","credits","prevCredits","AuthorizedVoter","PriorVoter","epochOfLastAuthorizedSwitch","targetEpoch","BlockTimestamp","VoteAccount","rootSlot","votes","authorizedVoters","priorVoters","lastTimestamp","SYSVAR_CLOCK_PUBKEY","SYSVAR_EPOCH_SCHEDULE_PUBKEY","SYSVAR_INSTRUCTIONS_PUBKEY","SYSVAR_RECENT_BLOCKHASHES_PUBKEY","SYSVAR_RENT_PUBKEY","SYSVAR_REWARDS_PUBKEY","SYSVAR_SLOT_HASHES_PUBKEY","SYSVAR_SLOT_HISTORY_PUBKEY","SYSVAR_STAKE_HISTORY_PUBKEY","Cluster","clusterApiUrl","cluster","tls","sendAndConfirmRawTransaction","confirmationStrategy","sendAndConfirmTransaction","LAMPORTS_PER_SOL"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../../../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@5.6.3_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.d.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/useMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useDigitalAssetLinks.ts","../../src/errors.ts"],"x_google_ignoreList":[2],"mappings":";;;;;;;;aAIY,mBAAA;EACR,iBAAA;EACA,iBAAA;EACA,sBAAA;EACA,0BAAA;EACA,2BAAA;EACA,oBAAA;EACA,iBAAA;EACA,4BAAA;EACA,yBAAA;AAAA;AAAA,UAEa,gBAAA;EACb,MAAA,EAAQ,mBAAA;EACR,SAAA;AAAA;AAAA,KAGQ,iBAAA,GAAoB,QA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AA;AAAA,iBAI9C,oBAAA,CAAA,GAAoB,OAAA;AAAA,iBAIpB,gBAAA,CAAiB,WAAA,WAAmB,OAAA;;;aCtC9C,2BAAA;EACR,2BAAA;EACA,6BAAA;EACA,iCAAA;EACA,kCAAA;AAAA;AAAA,cAGS,uBAAA,SAAgC,KAAA;EACzC,IAAA,EAAM,2BAAA;cACM,IAAA,EAAM,2BAAA,EAA6B,OAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["Buffer","Agent","Agent$1","Struct","constructor","properties","encode","decode","data","decodeUnchecked","Enum","enum","SOLANA_SCHEMA","Function","Map","MAX_SEED_LENGTH","PUBLIC_KEY_LENGTH","PublicKeyInitData","Uint8Array","Array","PublicKeyData","PublicKey","Symbol","toStringTag","Promise","value","unique","default","equals","publicKey","toBase58","toJSON","toBytes","toBuffer","toString","createWithSeed","fromPublicKey","seed","programId","createProgramAddressSync","seeds","createProgramAddress","findProgramAddressSync","findProgramAddress","isOnCurve","pubkeyData","Account","secretKey","Blockhash","BPF_LOADER_DEPRECATED_PROGRAM_ID","EpochSchedule","slotsPerEpoch","leaderScheduleSlotOffset","warmup","firstNormalEpoch","firstNormalSlot","getEpoch","slot","getEpochAndSlotIndex","getFirstSlotInEpoch","epoch","getLastSlotInEpoch","getSlotsInEpoch","_default","globalThis","fetch","FeeCalculator","lamportsPerSignature","NONCE_ACCOUNT_LENGTH","DurableNonce","NonceAccount","authorizedPubkey","nonce","feeCalculator","fromAccountData","buffer","Ed25519SecretKey","Ed25519Keypair","Signer","Keypair","_keypair","keypair","generate","fromSecretKey","skipValidation","options","fromSeed","PACKET_DATA_SIZE","VERSION_PREFIX_MASK","SIGNATURE_LENGTH_IN_BYTES","TransactionExpiredBlockheightExceededError","Error","signature","TransactionExpiredTimeoutError","timeoutSeconds","TransactionExpiredNonceInvalidError","AccountKeysFromLookups","LoadedAddresses","MessageAccountKeys","TransactionInstruction","MessageCompiledInstruction","staticAccountKeys","accountKeysFromLookups","keySegments","get","index","length","compileInstructions","instructions","CompiledInstruction","programIdIndex","accounts","MessageArgs","MessageHeader","header","accountKeys","recentBlockhash","CompileLegacyArgs","payerKey","Message","MessageAddressTableLookup","indexToProgramIds","args","version","compiledInstructions","addressTableLookups","getAccountKeys","compile","isAccountSigner","isAccountWritable","isProgramId","programIds","nonProgramIds","serialize","from","AddressLookupTableState","deactivationSlot","lastExtendedSlot","lastExtendedSlotStartIndex","authority","addresses","AddressLookupTableAccountArgs","key","state","AddressLookupTableAccount","isActive","deserialize","accountData","CreateLookupTableParams","payer","recentSlot","FreezeLookupTableParams","lookupTable","ExtendLookupTableParams","DeactivateLookupTableParams","CloseLookupTableParams","recipient","LookupTableInstructionType","AddressLookupTableInstruction","decodeInstructionType","instruction","decodeCreateLookupTable","decodeExtendLookupTable","decodeCloseLookupTable","decodeFreezeLookupTable","decodeDeactivateLookupTable","AddressLookupTableProgram","createLookupTable","params","freezeLookupTable","extendLookupTable","deactivateLookupTable","closeLookupTable","ComputeBudgetInstruction","ComputeBudgetInstructionType","RequestUnitsParams","RequestHeapFrameParams","SetComputeUnitLimitParams","SetComputeUnitPriceParams","decodeRequestUnits","decodeRequestHeapFrame","decodeSetComputeUnitLimit","decodeSetComputeUnitPrice","units","additionalFee","bytes","microLamports","ComputeBudgetProgram","requestUnits","requestHeapFrame","setComputeUnitLimit","setComputeUnitPrice","CreateEd25519InstructionWithPublicKeyParams","message","instructionIndex","CreateEd25519InstructionWithPrivateKeyParams","privateKey","Ed25519Program","createInstructionWithPublicKey","createInstructionWithPrivateKey","CreateSecp256k1InstructionWithPublicKeyParams","recoveryId","CreateSecp256k1InstructionWithEthAddressParams","ethAddress","CreateSecp256k1InstructionWithPrivateKeyParams","Secp256k1Program","publicKeyToEthAddress","createInstructionWithEthAddress","STAKE_CONFIG_ID","Authorized","staker","withdrawer","Lockup","unixTimestamp","custodian","CreateStakeAccountParams","fromPubkey","stakePubkey","authorized","lockup","lamports","CreateStakeAccountWithSeedParams","basePubkey","InitializeStakeParams","DelegateStakeParams","votePubkey","AuthorizeStakeParams","StakeAuthorizationType","newAuthorizedPubkey","stakeAuthorizationType","custodianPubkey","AuthorizeWithSeedStakeParams","authorityBase","authoritySeed","authorityOwner","SplitStakeParams","splitStakePubkey","SplitStakeWithSeedParams","WithdrawStakeParams","toPubkey","DeactivateStakeParams","MergeStakeParams","sourceStakePubKey","StakeInstruction","StakeInstructionType","decodeInitialize","decodeDelegate","decodeAuthorize","decodeAuthorizeWithSeed","decodeSplit","decodeMerge","decodeWithdraw","decodeDeactivate","StakeAuthorizationLayout","Readonly","Staker","Withdrawer","StakeProgram","Transaction","space","initialize","createAccountWithSeed","createAccount","delegate","authorize","authorizeWithSeed","split","rentExemptReserve","splitWithSeed","merge","withdraw","deactivate","CreateAccountParams","newAccountPubkey","TransferParams","AssignParams","accountPubkey","CreateAccountWithSeedParams","CreateNonceAccountParams","noncePubkey","CreateNonceAccountWithSeedParams","InitializeNonceParams","AdvanceNonceParams","WithdrawNonceParams","AuthorizeNonceParams","AllocateParams","AllocateWithSeedParams","AssignWithSeedParams","TransferWithSeedParams","DecodedTransferInstruction","DecodedTransferWithSeedInstruction","SystemInstruction","SystemInstructionType","decodeCreateAccount","decodeTransfer","decodeTransferWithSeed","decodeAllocate","decodeAllocateWithSeed","decodeAssign","decodeAssignWithSeed","decodeCreateWithSeed","decodeNonceInitialize","decodeNonceAdvance","decodeNonceWithdraw","decodeNonceAuthorize","SystemProgram","transfer","assign","createNonceAccount","nonceInitialize","nonceAdvance","nonceWithdraw","nonceAuthorize","allocate","VoteInit","nodePubkey","authorizedVoter","authorizedWithdrawer","commission","CreateVoteAccountParams","voteInit","InitializeAccountParams","AuthorizeVoteParams","VoteAuthorizationType","voteAuthorizationType","AuthorizeVoteWithSeedParams","currentAuthorityDerivedKeyBasePubkey","currentAuthorityDerivedKeyOwnerPubkey","currentAuthorityDerivedKeySeed","WithdrawFromVoteAccountParams","authorizedWithdrawerPubkey","UpdateValidatorIdentityParams","VoteInstruction","VoteInstructionType","decodeInitializeAccount","VoteAuthorizationLayout","Voter","VoteProgram","initializeAccount","safeWithdraw","currentVoteAccountBalance","rentExemptMinimum","updateValidatorIdentity","MessageV0Args","CompileV0Args","addressLookupTableAccounts","GetAccountKeysArgs","MessageV0","numAccountKeysFromLookups","resolveAddressTableLookups","serializeInstructions","serializeAddressTableLookups","serializedMessage","VersionedMessage","deserializeMessageVersion","numRequiredSignatures","numReadonlySignedAccounts","numReadonlyUnsignedAccounts","accountKey","writableIndexes","readonlyIndexes","accountKeyIndexes","TransactionSignature","TransactionStatus","BLOCKHEIGHT_EXCEEDED","PROCESSED","TIMED_OUT","NONCE_INVALID","AccountMeta","pubkey","isSigner","isWritable","TransactionInstructionCtorFields","keys","SerializeConfig","requireAllSignatures","verifySignatures","opts","SignaturePubkeyPair","TransactionCtorFields_DEPRECATED","NonceInformation","nonceInfo","feePayer","signatures","TransactionCtorFields","TransactionBlockhashCtor","blockhash","lastValidBlockHeight","TransactionNonceCtor","minContextSlot","nonceInstruction","Connection","minNonceContextSlot","add","items","compileMessage","serializeMessage","getEstimatedFee","connection","setSigners","signers","sign","partialSign","addSignature","config","populate","TransactionMessageArgs","DecompileArgs","TransactionMessage","decompile","compileToLegacyMessage","compileToV0Message","TransactionVersion","VersionedTransaction","serializedTransaction","ClientSubscriptionId","TokenAccountsFilter","mint","Context","SendOptions","Commitment","skipPreflight","preflightCommitment","maxRetries","ConfirmOptions","commitment","ConfirmedSignaturesForAddress2Options","before","until","limit","SignaturesForAddressOptions","RpcResponseAndContext","T","context","BlockhashWithExpiryBlockHeight","BlockheightBasedTransactionConfirmationStrategy","BaseTransactionConfirmationStrategy","DurableNonceTransactionConfirmationStrategy","nonceAccountPubkey","nonceValue","AbortSignal","abortSignal","TransactionConfirmationStrategy","Finality","LargestAccountsFilter","GetAccountInfoConfig","DataSlice","dataSlice","GetBalanceConfig","GetBlockConfig","rewards","transactionDetails","GetVersionedBlockConfig","maxSupportedTransactionVersion","GetStakeMinimumDelegationConfig","GetBlockHeightConfig","GetEpochInfoConfig","GetInflationRewardConfig","GetLatestBlockhashConfig","IsBlockhashValidConfig","GetSlotConfig","GetSlotLeaderConfig","GetTransactionConfig","GetVersionedTransactionConfig","GetLargestAccountsConfig","filter","GetSupplyConfig","excludeNonCirculatingAccountsList","SignatureStatusConfig","searchTransactionHistory","ContactInfo","gossip","tpu","rpc","VoteAccountInfo","activatedStake","epochVoteAccount","epochCredits","lastVote","VoteAccountStatus","current","delinquent","InflationGovernor","foundation","foundationTerm","initial","taper","terminal","InflationReward","effectiveSlot","amount","postBalance","RecentPrioritizationFees","prioritizationFee","GetRecentPrioritizationFeesConfig","lockedWritableAccounts","InflationRate","total","validator","EpochInfo","slotIndex","slotsInEpoch","absoluteSlot","blockHeight","transactionCount","LeaderSchedule","address","Version","SimulatedTransactionAccountInfo","executable","owner","rentEpoch","TransactionReturnDataEncoding","TransactionReturnData","SimulateTransactionConfig","sigVerify","replaceRecentBlockhash","encoding","innerInstructions","SimulatedTransactionResponse","TransactionError","ParsedInnerInstruction","err","logs","unitsConsumed","returnData","ParsedInstruction","PartiallyDecodedInstruction","TokenBalance","TokenAmount","accountIndex","uiTokenAmount","ParsedConfirmedTransactionMeta","ParsedTransactionMeta","writable","readonly","fee","preBalances","postBalances","logMessages","preTokenBalances","postTokenBalances","loadedAddresses","computeUnitsConsumed","costUnits","CompiledInnerInstruction","ConfirmedTransactionMeta","TransactionResponse","transaction","meta","blockTime","VersionedTransactionResponse","ConfirmedTransaction","ParsedMessageAccount","signer","source","program","parsed","ParsedAddressTableLookup","ParsedMessage","ParsedTransaction","ParsedConfirmedTransaction","ParsedTransactionWithMeta","BlockResponse","previousBlockhash","parentSlot","transactions","rewardType","AccountsModeBlockResponse","VersionedAccountsModeBlockResponse","NoneModeBlockResponse","VersionedNoneModeBlockResponse","ParsedBlockResponse","ParsedAccountsModeBlockResponse","Omit","Pick","ParsedNoneModeBlockResponse","VersionedBlockResponse","ConfirmedBlock","BlockSignatures","BlockProduction","ReadonlyArray","Record","byIdentity","range","firstSlot","lastSlot","GetBlockProductionConfig","identity","PerfSample","numTransactions","numSlots","samplePeriodSecs","Supply","circulating","nonCirculating","nonCirculatingAccounts","decimals","uiAmount","uiAmountString","TokenAccountBalancePair","AccountBalancePair","SlotUpdate","type","timestamp","parent","stats","numTransactionEntries","numSuccessfulTransactions","numFailedTransactions","maxTransactionsPerEntry","SlotInfo","root","ParsedAccountData","StakeActivationData","active","inactive","offset","MemcmpFilter","memcmp","DataSizeFilter","dataSize","GetProgramAccountsFilter","GetProgramAccountsConfig","filters","withContext","GetProgramAccountsResponse","AccountInfo","account","GetParsedProgramAccountsConfig","GetMultipleAccountsConfig","GetStakeActivationConfig","GetTokenAccountsByOwnerConfig","GetTransactionCountConfig","GetNonceConfig","GetNonceAndContextConfig","AccountSubscriptionConfig","ProgramAccountSubscriptionConfig","KeyedAccountInfo","accountId","accountInfo","AccountChangeCallback","ProgramAccountChangeCallback","keyedAccountInfo","SlotChangeCallback","slotInfo","SlotUpdateCallback","slotUpdate","SignatureResultCallback","SignatureResult","signatureResult","SignatureStatusNotification","result","SignatureReceivedNotification","SignatureSubscriptionCallback","notification","SignatureSubscriptionOptions","enableReceivedNotification","RootChangeCallback","Logs","LogsFilter","LogsCallback","ctx","TransactionConfirmationStatus","SignatureStatus","confirmations","confirmationStatus","ConfirmedSignatureInfo","memo","HttpHeaders","FetchFn","FetchMiddleware","Parameters","info","init","a","ConnectionConfig","httpAgent","wsEndpoint","httpHeaders","fetchMiddleware","disableRetryOnRateLimit","confirmTransactionInitialTimeout","endpoint","commitmentOrConfig","rpcEndpoint","getBalanceAndContext","getBalance","getBlockTime","getMinimumLedgerSlot","getFirstAvailableBlock","getSupply","getTokenSupply","tokenMintAddress","getTokenAccountBalance","tokenAddress","getTokenAccountsByOwner","ownerAddress","getParsedTokenAccountsByOwner","getLargestAccounts","getTokenLargestAccounts","mintAddress","getAccountInfoAndContext","getParsedAccountInfo","getAccountInfo","getMultipleParsedAccounts","publicKeys","rawConfig","getMultipleAccountsInfoAndContext","getMultipleAccountsInfo","getStakeActivation","getProgramAccounts","configOrCommitment","getParsedProgramAccounts","confirmTransaction","strategy","getCancellationPromise","getTransactionConfirmationPromise","confirmTransactionUsingBlockHeightExceedanceStrategy","confirmTransactionUsingDurableNonceStrategy","confirmTransactionUsingLegacyTimeoutStrategy","getClusterNodes","getVoteAccounts","getSlot","getSlotLeader","getSlotLeaders","startSlot","getSignatureStatus","getSignatureStatuses","getTransactionCount","getTotalSupply","getInflationGovernor","getInflationReward","getInflationRate","getEpochInfo","getEpochSchedule","getLeaderSchedule","getMinimumBalanceForRentExemption","dataLength","getRecentBlockhashAndContext","getRecentPerformanceSamples","getFeeCalculatorForBlockhash","getFeeForMessage","getRecentPrioritizationFees","getRecentBlockhash","getLatestBlockhash","getLatestBlockhashAndContext","isBlockhashValid","getVersion","getGenesisHash","getBlock","getParsedBlock","getBlockHeight","getBlockProduction","getTransaction","getParsedTransaction","getParsedTransactions","getTransactions","getConfirmedBlock","getBlocks","endSlot","getBlockSignatures","getConfirmedBlockSignatures","getConfirmedTransaction","getParsedConfirmedTransaction","getParsedConfirmedTransactions","getConfirmedSignaturesForAddress","getConfirmedSignaturesForAddress2","getSignaturesForAddress","getAddressLookupTable","getNonceAndContext","nonceAccount","getNonce","requestAirdrop","to","getStakeMinimumDelegation","simulateTransaction","transactionOrMessage","includeAccounts","sendTransaction","sendRawTransaction","rawTransaction","sendEncodedTransaction","encodedTransaction","onAccountChange","callback","removeAccountChangeListener","clientSubscriptionId","onProgramAccountChange","removeProgramAccountChangeListener","onLogs","removeOnLogsListener","onSlotChange","removeSlotChangeListener","onSlotUpdate","removeSlotUpdateListener","_buildArgs","override","extra","onSignature","onSignatureWithOptions","removeSignatureListener","onRootChange","removeRootChangeListener","BPF_LOADER_PROGRAM_ID","BpfLoader","getMinNumSignatures","load","elf","loaderProgramId","SendTransactionError","action","transactionMessage","transactionLogs","transactionError","getLogs","SolanaJSONRPCErrorCode","JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP","JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE","JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE","JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE","JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY","JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE","JSON_RPC_SERVER_ERROR_SLOT_SKIPPED","JSON_RPC_SERVER_ERROR_NO_SNAPSHOT","JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED","JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX","JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE","JSON_RPC_SCAN_ERROR","JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH","JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET","JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION","JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED","SolanaJSONRPCErrorCodeEnum","SolanaJSONRPCError","code","customMessage","Loader","chunkSize","VALIDATOR_INFO_KEY","Info","name","website","details","iconUrl","keybaseUsername","ValidatorInfo","fromConfigData","VOTE_PROGRAM_ID","Lockout","confirmationCount","EpochCredits","credits","prevCredits","AuthorizedVoter","PriorVoter","epochOfLastAuthorizedSwitch","targetEpoch","BlockTimestamp","VoteAccount","rootSlot","votes","authorizedVoters","priorVoters","lastTimestamp","SYSVAR_CLOCK_PUBKEY","SYSVAR_EPOCH_SCHEDULE_PUBKEY","SYSVAR_INSTRUCTIONS_PUBKEY","SYSVAR_RECENT_BLOCKHASHES_PUBKEY","SYSVAR_RENT_PUBKEY","SYSVAR_REWARDS_PUBKEY","SYSVAR_SLOT_HASHES_PUBKEY","SYSVAR_SLOT_HISTORY_PUBKEY","SYSVAR_STAKE_HISTORY_PUBKEY","Cluster","clusterApiUrl","cluster","tls","sendAndConfirmRawTransaction","confirmationStrategy","sendAndConfirmTransaction","LAMPORTS_PER_SOL"],"sources":["../../src/mwaSessionEvents.ts","../../src/resolve.ts","../../../../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.d.ts","../../src/initializeMobileWalletAdapterSession.ts","../../src/useMobileWalletAdapterSession.ts","../../src/initializeMWAEventListener.ts","../../src/useDigitalAssetLinks.ts","../../src/errors.ts"],"x_google_ignoreList":[2],"mappings":";;;;;;;;aAIY,mBAAA;EACR,iBAAA;EACA,iBAAA;EACA,sBAAA;EACA,0BAAA;EACA,2BAAA;EACA,oBAAA;EACA,iBAAA;EACA,4BAAA;EACA,yBAAA;AAAA;AAAA,UAEa,gBAAA;EACb,MAAA,EAAQ,mBAAA;EACR,SAAA;AAAA;AAAA,KAGQ,iBAAA,GAAoB,QAAA;EAC5B,MAAA,EAAQ,mBAAA,CAAoB,iBAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,iBAAA,GAAoB,QAAA;EAC5B,MAAA,EAAQ,mBAAA,CAAoB,iBAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,sBAAA,GAAyB,QAAA;EACjC,MAAA,EAAQ,mBAAA,CAAoB,sBAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,0BAAA,GAA6B,QAAA;EACrC,MAAA,EAAQ,mBAAA,CAAoB,0BAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,2BAAA,GAA8B,QAAA;EACtC,MAAA,EAAQ,mBAAA,CAAoB,2BAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,oBAAA,GAAuB,QAAA;EAC/B,MAAA,EAAQ,mBAAA,CAAoB,oBAAA;AAAA,KAE5B,gBAAA;AAAA,KAEQ,iBAAA,GAAo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AA,EAAyB,QAAA,EAAU,wBAAA;AAAA,iBACpD,OAAA,CAAQ,OAAA,EAAS,8BAAA,EAAgC,QAAA,EAAU,+BAAA;;;KC4/CtE4Z,kBAAAA;;;;;;KCtrDO,YAAA;AAAA,UAEK,yBAAA;EACb,gCAAA;EACA,4BAAA;EACA,4BAAA,EAA8B,KAAA,CAAM,kBAAA;EACpC,4BAAA;EACA,gBAAA,EAAkB,eAAA;AAAA;AAAA,iBAGA,oCAAA,CAClB,UAAA,UACA,MAAA,EAAQ,yBAAA,GACT,OAAA,CAAQ,YAAA;;;iBC7CK,6BAAA,CACZ,UAAA,UACA,MAAA,EAAQ,yBAAA,EACR,aAAA,GAAgB,OAAA,EAAS,UAAA,WACzB,kBAAA,GAAqB,YAAA,EAAc,eAAA;;;iBCNvB,0BAAA,CACZ,aAAA,GAAgB,OAAA,EAAS,UAAA,WACzB,kBAAA,GAAqB,YAAA,EAAc,eAAA,YACpC,mBAAA;;;iBCemB,iBAAA,CAAA,GAAqB,OAAA;AAAA,iBAIrB,oBAAA,CAAqB,iBAAA,WAAyB,OAAA;AAAA,iBAI9C,oBAAA,CAAA,GAAoB,OAAA;AAAA,iBAIpB,gBAAA,CAAiB,WAAA,WAAmB,OAAA;;;aCtC9C,2BAAA;EACR,2BAAA;EACA,6BAAA;EACA,iCAAA;EACA,kCAAA;AAAA;AAAA,cAGS,uBAAA,SAAgC,KAAA;EACzC,IAAA,EAAM,2BAAA;cACM,IAAA,EAAM,2BAAA,EAA6B,OAAA;AAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solana-mobile/mobile-wallet-adapter-walletlib",
3
3
  "description": "A React Native wrapper of the Solana Mobile, Mobile Wallet Adapter Wallet Library. Wallet apps can use this to handle dapp requests for signing and sending.",
4
- "version": "1.4.2",
4
+ "version": "1.4.4",
5
5
  "author": "Michael Sulistio <mike.sulistio@solanamobile.com>",
6
6
  "repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
7
7
  "license": "Apache-2.0",
@@ -10,18 +10,19 @@
10
10
  "import": "./lib/esm/index.js",
11
11
  "require": "./lib/cjs/index.js"
12
12
  },
13
- "react-native": "./lib/cjs/index.native.js",
13
+ "react-native": "./lib/esm/index.native.js",
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "main": "lib/esm/index",
17
17
  "module": "lib/esm/index",
18
- "react-native": "lib/esm/index",
18
+ "react-native": "lib/esm/index.native",
19
19
  "types": "lib/types/index.d.ts",
20
20
  "type": "module",
21
21
  "files": [
22
- "lib",
23
22
  "android",
24
- "LICENSE"
23
+ "LICENSE",
24
+ "lib",
25
+ "src"
25
26
  ],
26
27
  "sideEffects": false,
27
28
  "publishConfig": {
package/src/errors.ts ADDED
@@ -0,0 +1,15 @@
1
+ export enum SolanaMWAWalletLibErrorCode {
2
+ ERROR_INTENT_DATA_NOT_FOUND = 'ERROR_INTENT_DATA_NOT_FOUND',
3
+ ERROR_SESSION_ALREADY_CREATED = 'ERROR_SESSION_ALREADY_CREATED',
4
+ ERROR_UNSUPPORTED_ASSOCIATION_URI = 'ERROR_UNSUPPORTED_ASSOCIATION_URI',
5
+ ERROR_UNSUPPORTED_ASSOCIATION_TYPE = 'ERROR_UNSUPPORTED_ASSOCIATION_TYPE',
6
+ }
7
+
8
+ export class SolanaMWAWalletLibError extends Error {
9
+ code: SolanaMWAWalletLibErrorCode;
10
+ constructor(code: SolanaMWAWalletLibErrorCode, message: string) {
11
+ super(message);
12
+ this.name = 'SolanaMWAWalletLibError';
13
+ this.code = code;
14
+ }
15
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './mwaSessionEvents.js';
2
+ export * from './resolve.js';
3
+ export * from './useMobileWalletAdapterSession.js';
4
+ export * from './initializeMobileWalletAdapterSession.js';
5
+ export * from './initializeMWAEventListener.js';
6
+ export * from './useDigitalAssetLinks.js';
7
+ export * from './errors.js';
@@ -0,0 +1,34 @@
1
+ import { EmitterSubscription, NativeEventEmitter } from 'react-native';
2
+
3
+ import { MWASessionEvent, MWASessionEventType } from './mwaSessionEvents.js';
4
+ import { MWARequest, MWARequestType } from './resolve.js';
5
+
6
+ const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';
7
+ type NativeMWAEvent = Readonly<{ __type?: unknown }>;
8
+
9
+ export function initializeMWAEventListener(
10
+ handleRequest: (request: MWARequest) => void,
11
+ handleSessionEvent: (sessionEvent: MWASessionEvent) => void,
12
+ ): EmitterSubscription {
13
+ const mwaEventEmitter = new NativeEventEmitter();
14
+ const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
15
+ const event = nativeEvent as NativeMWAEvent;
16
+ if (isMWARequest(event)) {
17
+ handleRequest(event);
18
+ } else if (isMWASessionEvent(event)) {
19
+ handleSessionEvent(event);
20
+ } else {
21
+ console.warn('Unexpected native event type');
22
+ }
23
+ });
24
+
25
+ return listener;
26
+ }
27
+
28
+ function isMWARequest(nativeEvent: NativeMWAEvent): nativeEvent is MWARequest {
29
+ return Object.values(MWARequestType).includes(nativeEvent.__type as MWARequest['__type']);
30
+ }
31
+
32
+ function isMWASessionEvent(nativeEvent: NativeMWAEvent): nativeEvent is MWASessionEvent {
33
+ return Object.values(MWASessionEventType).includes(nativeEvent.__type as MWASessionEvent['__type']);
34
+ }
@@ -0,0 +1,67 @@
1
+ import type { TransactionVersion } from '@solana/web3.js';
2
+ import type { IdentifierArray } from '@wallet-standard/core';
3
+ import { NativeModules, Platform } from 'react-native';
4
+
5
+ import { SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode } from './errors.js';
6
+
7
+ const LINKING_ERROR =
8
+ `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
9
+ '- You rebuilt the app after installing the package\n' +
10
+ '- If you are using Lerna workspaces\n' +
11
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
12
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
13
+ '- You are not using Expo managed workflow\n';
14
+
15
+ const SolanaMobileWalletAdapterWalletLib =
16
+ Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib
17
+ ? NativeModules.SolanaMobileWalletAdapterWalletLib
18
+ : new Proxy(
19
+ {},
20
+ {
21
+ get() {
22
+ throw new Error(
23
+ Platform.OS !== 'android'
24
+ ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
25
+ : LINKING_ERROR,
26
+ );
27
+ },
28
+ },
29
+ );
30
+
31
+ type ReactNativeError = Error & { code?: string; userInfo?: Record<string, unknown> };
32
+
33
+ function handleError(e: unknown): never {
34
+ if (e instanceof Error) {
35
+ const { code, message } = e as ReactNativeError;
36
+ if (code && code in SolanaMWAWalletLibErrorCode) {
37
+ throw new SolanaMWAWalletLibError(code as SolanaMWAWalletLibErrorCode, message);
38
+ }
39
+ }
40
+ throw e;
41
+ }
42
+
43
+ export type MWASessionId = string;
44
+
45
+ export interface MobileWalletAdapterConfig {
46
+ maxTransactionsPerSigningRequest: number;
47
+ maxMessagesPerSigningRequest: number;
48
+ supportedTransactionVersions: Array<TransactionVersion>;
49
+ noConnectionWarningTimeoutMs: number;
50
+ optionalFeatures: IdentifierArray;
51
+ }
52
+
53
+ export async function initializeMobileWalletAdapterSession(
54
+ walletName: string,
55
+ config: MobileWalletAdapterConfig,
56
+ ): Promise<MWASessionId> {
57
+ try {
58
+ return await initializeScenario(walletName, config);
59
+ } catch (e) {
60
+ handleError(e);
61
+ }
62
+ }
63
+
64
+ // Create Scenario and establish session with dapp
65
+ function initializeScenario(walletName: string, walletConfig: MobileWalletAdapterConfig): Promise<MWASessionId> {
66
+ return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));
67
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Mobile Wallet Adapter Session Events are notifications and events
3
+ * about the underlying session between the wallet and the dApp.
4
+ */
5
+ export enum MWASessionEventType {
6
+ SessionStartEvent = 'SESSION_START',
7
+ SessionReadyEvent = 'SESSION_READY',
8
+ SessionTerminatedEvent = 'SESSION_TERMINATED',
9
+ SessionServingClientsEvent = 'SESSION_SERVING_CLIENTS',
10
+ SessionServingCompleteEvent = 'SESSION_SERVING_COMPLETE',
11
+ SessionCompleteEvent = 'SESSION_COMPLETE',
12
+ SessionErrorEvent = 'SESSION_ERROR',
13
+ SessionTeardownCompleteEvent = 'SESSION_TEARDOWN_COMPLETE',
14
+ LowPowerNoConnectionEvent = 'LOW_POWER_NO_CONNECTION',
15
+ }
16
+ export interface IMWASessionEvent {
17
+ __type: MWASessionEventType;
18
+ sessionId: string;
19
+ }
20
+
21
+ export type SessionStartEvent = Readonly<{
22
+ __type: MWASessionEventType.SessionStartEvent;
23
+ }> &
24
+ IMWASessionEvent;
25
+
26
+ export type SessionReadyEvent = Readonly<{
27
+ __type: MWASessionEventType.SessionReadyEvent;
28
+ }> &
29
+ IMWASessionEvent;
30
+
31
+ export type SessionTerminatedEvent = Readonly<{
32
+ __type: MWASessionEventType.SessionTerminatedEvent;
33
+ }> &
34
+ IMWASessionEvent;
35
+
36
+ export type SessionServingClientsEvent = Readonly<{
37
+ __type: MWASessionEventType.SessionServingClientsEvent;
38
+ }> &
39
+ IMWASessionEvent;
40
+
41
+ export type SessionServingCompleteEvent = Readonly<{
42
+ __type: MWASessionEventType.SessionServingCompleteEvent;
43
+ }> &
44
+ IMWASessionEvent;
45
+
46
+ export type SessionCompleteEvent = Readonly<{
47
+ __type: MWASessionEventType.SessionCompleteEvent;
48
+ }> &
49
+ IMWASessionEvent;
50
+
51
+ export type SessionErrorEvent = Readonly<{
52
+ __type: MWASessionEventType.SessionErrorEvent;
53
+ }> &
54
+ IMWASessionEvent;
55
+
56
+ export type SessionTeardownCompleteEvent = Readonly<{
57
+ __type: MWASessionEventType.SessionTeardownCompleteEvent;
58
+ }> &
59
+ IMWASessionEvent;
60
+
61
+ export type LowPowerNoConnectionEvent = Readonly<{
62
+ __type: MWASessionEventType.LowPowerNoConnectionEvent;
63
+ }> &
64
+ IMWASessionEvent;
65
+
66
+ export type MWASessionEvent =
67
+ | SessionStartEvent
68
+ | SessionReadyEvent
69
+ | SessionTerminatedEvent
70
+ | SessionServingClientsEvent
71
+ | SessionServingCompleteEvent
72
+ | SessionCompleteEvent
73
+ | SessionErrorEvent
74
+ | SessionTeardownCompleteEvent
75
+ | LowPowerNoConnectionEvent;
package/src/resolve.ts ADDED
@@ -0,0 +1,232 @@
1
+ import type { IdentifierArray } from '@wallet-standard/core';
2
+ import { NativeModules, Platform } from 'react-native';
3
+
4
+ const LINKING_ERROR =
5
+ `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- If you are using Lerna workspaces\n' +
8
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
9
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
10
+ '- You are not using Expo managed workflow\n';
11
+
12
+ const SolanaMobileWalletAdapterWalletLib =
13
+ Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib
14
+ ? NativeModules.SolanaMobileWalletAdapterWalletLib
15
+ : new Proxy(
16
+ {},
17
+ {
18
+ get() {
19
+ throw new Error(
20
+ Platform.OS !== 'android'
21
+ ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
22
+ : LINKING_ERROR,
23
+ );
24
+ },
25
+ },
26
+ );
27
+
28
+ type AppIdentity = Readonly<{
29
+ identityUri?: string;
30
+ iconRelativeUri?: string;
31
+ identityName?: string;
32
+ }>;
33
+
34
+ export type SignInPayload = Readonly<{
35
+ domain?: string;
36
+ address?: string;
37
+ statement?: string;
38
+ uri?: string;
39
+ version?: string;
40
+ chainId?: string;
41
+ nonce?: string;
42
+ issuedAt?: string;
43
+ expirationTime?: string;
44
+ notBefore?: string;
45
+ requestId?: string;
46
+ resources?: readonly string[];
47
+ }>;
48
+
49
+ export type Base64EncodedAddress = string;
50
+ export type Base64EncodedSignature = string;
51
+ type Base64EncodedSignedMessage = string;
52
+
53
+ /**
54
+ * Mobile Wallet Adapter Requests are remote requests coming from
55
+ * the dApp for authorization, signing, and sending services.
56
+ */
57
+
58
+ export type MWARequest =
59
+ | SignMessagesRequest
60
+ | SignTransactionsRequest
61
+ | SignAndSendTransactionsRequest
62
+ | AuthorizeDappRequest
63
+ | ReauthorizeDappRequest
64
+ | DeauthorizeDappRequest;
65
+
66
+ export enum MWARequestType {
67
+ AuthorizeDappRequest = 'AUTHORIZE_DAPP',
68
+ ReauthorizeDappRequest = 'REAUTHORIZE_DAPP',
69
+ DeauthorizeDappRequest = 'DEAUTHORIZE_DAPP',
70
+ SignMessagesRequest = 'SIGN_MESSAGES',
71
+ SignTransactionsRequest = 'SIGN_TRANSACTIONS',
72
+ SignAndSendTransactionsRequest = 'SIGN_AND_SEND_TRANSACTIONS',
73
+ }
74
+
75
+ interface IMWARequest {
76
+ __type: MWARequestType;
77
+ requestId: string;
78
+ sessionId: string;
79
+ }
80
+
81
+ interface IVerifiableIdentityRequest {
82
+ chain: string;
83
+ authorizationScope: Uint8Array;
84
+ appIdentity?: AppIdentity;
85
+ }
86
+
87
+ export type AuthorizeDappRequest = Readonly<{
88
+ __type: MWARequestType.AuthorizeDappRequest;
89
+ chain: string;
90
+ appIdentity?: AppIdentity;
91
+ features?: IdentifierArray;
92
+ addresses?: [string];
93
+ signInPayload?: SignInPayload;
94
+ }> &
95
+ IMWARequest;
96
+
97
+ export type ReauthorizeDappRequest = Readonly<{
98
+ __type: MWARequestType.ReauthorizeDappRequest;
99
+ }> &
100
+ IMWARequest &
101
+ IVerifiableIdentityRequest;
102
+
103
+ export type DeauthorizeDappRequest = Readonly<{
104
+ __type: MWARequestType.DeauthorizeDappRequest;
105
+ }> &
106
+ IMWARequest &
107
+ IVerifiableIdentityRequest;
108
+
109
+ export type SignMessagesRequest = Readonly<{
110
+ __type: MWARequestType.SignMessagesRequest;
111
+ payloads: Uint8Array[];
112
+ }> &
113
+ IMWARequest &
114
+ IVerifiableIdentityRequest;
115
+
116
+ export type SignTransactionsRequest = Readonly<{
117
+ __type: MWARequestType.SignTransactionsRequest;
118
+ payloads: Uint8Array[];
119
+ }> &
120
+ IMWARequest &
121
+ IVerifiableIdentityRequest;
122
+
123
+ export type SignAndSendTransactionsRequest = Readonly<{
124
+ __type: MWARequestType.SignAndSendTransactionsRequest;
125
+ payloads: Uint8Array[];
126
+ minContextSlot?: number;
127
+ commitment?: string;
128
+ skipPreflight?: boolean;
129
+ maxRetries?: number;
130
+ waitForCommitmentToSendNextTransaction?: boolean;
131
+ }> &
132
+ IMWARequest &
133
+ IVerifiableIdentityRequest;
134
+
135
+ /**
136
+ * MWA Request Responses
137
+ */
138
+
139
+ export type MWAResponse =
140
+ | AuthorizeDappResponse
141
+ | ReauthorizeDappResponse
142
+ | DeauthorizeDappResponse
143
+ | SignMessagesResponse
144
+ | SignTransactionsResponse
145
+ | SignAndSendTransactionsResponse;
146
+
147
+ /* Failure Responses */
148
+ export enum MWARequestFailReason {
149
+ UserDeclined = 'USER_DECLINED',
150
+ TooManyPayloads = 'TOO_MANY_PAYLOADS',
151
+ InvalidSignatures = 'INVALID_SIGNATURES',
152
+ AuthorizationNotValid = 'AUTHORIZATION_NOT_VALID',
153
+ }
154
+
155
+ export type UserDeclinedResponse = Readonly<{
156
+ failReason: MWARequestFailReason.UserDeclined;
157
+ }>;
158
+
159
+ export type TooManyPayloadsResponse = Readonly<{
160
+ failReason: MWARequestFailReason.TooManyPayloads;
161
+ }>;
162
+
163
+ export type AuthorizationNotValidResponse = Readonly<{
164
+ failReason: MWARequestFailReason.AuthorizationNotValid;
165
+ }>;
166
+
167
+ export type InvalidSignaturesResponse = Readonly<{
168
+ failReason: MWARequestFailReason.InvalidSignatures;
169
+ valid: boolean[];
170
+ }>;
171
+
172
+ /* Authorize Dapp */
173
+ export type AuthorizedAccount = Readonly<{
174
+ publicKey: Uint8Array;
175
+ accountLabel?: string;
176
+ icon?: string;
177
+ chains?: IdentifierArray;
178
+ features?: IdentifierArray;
179
+ }>;
180
+ export type SignInResult = Readonly<{
181
+ address: Base64EncodedAddress;
182
+ signed_message: Base64EncodedSignedMessage;
183
+ signature: Base64EncodedSignature;
184
+ signature_type?: string;
185
+ }>;
186
+ export type AuthorizeDappCompleteResponse = Readonly<{
187
+ accounts: Array<AuthorizedAccount>;
188
+ walletUriBase?: string;
189
+ authorizationScope?: Uint8Array;
190
+ signInResult?: SignInResult;
191
+ }>;
192
+ export type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse;
193
+
194
+ /* Reauthorize Dapp */
195
+ export type ReauthorizeDappCompleteResponse = Readonly<{
196
+ authorizationScope?: Uint8Array;
197
+ }>;
198
+ export type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
199
+
200
+ /* Deauthorize Dapp */
201
+ export type DeauthorizeDappCompleteResponse = Readonly<Record<string, never>>;
202
+ export type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse;
203
+
204
+ /* Sign Transactions/Messages */
205
+ export type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[] }>;
206
+ export type SignPayloadsFailResponse =
207
+ | UserDeclinedResponse
208
+ | TooManyPayloadsResponse
209
+ | AuthorizationNotValidResponse
210
+ | InvalidSignaturesResponse;
211
+
212
+ export type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;
213
+ export type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse;
214
+
215
+ /* Sign and Send Transaction */
216
+ export type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[] }>;
217
+ export type SignAndSendTransactionsResponse =
218
+ | SignAndSendTransactionsCompleteResponse
219
+ | UserDeclinedResponse
220
+ | TooManyPayloadsResponse
221
+ | AuthorizationNotValidResponse
222
+ | InvalidSignaturesResponse;
223
+
224
+ export function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void;
225
+ export function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void;
226
+ export function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void;
227
+ export function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void;
228
+ export function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void;
229
+ export function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void;
230
+ export function resolve(request: MWARequest, response: MWAResponse): void {
231
+ SolanaMobileWalletAdapterWalletLib.resolve(JSON.stringify(request), JSON.stringify(response));
232
+ }
@@ -0,0 +1,41 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
5
+ '- You rebuilt the app after installing the package\n' +
6
+ '- If you are using Lerna workspaces\n' +
7
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
8
+ ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
9
+ '- You are not using Expo managed workflow\n';
10
+
11
+ const SolanaMobileDigitalAssetLinks =
12
+ Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks
13
+ ? NativeModules.SolanaMobileDigitalAssetLinks
14
+ : new Proxy(
15
+ {},
16
+ {
17
+ get() {
18
+ throw new Error(
19
+ Platform.OS !== 'android'
20
+ ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
21
+ : LINKING_ERROR,
22
+ );
23
+ },
24
+ },
25
+ );
26
+
27
+ export async function getCallingPackage(): Promise<string | undefined> {
28
+ return await SolanaMobileDigitalAssetLinks.getCallingPackage();
29
+ }
30
+
31
+ export async function verifyCallingPackage(clientIdentityUri: string) {
32
+ return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);
33
+ }
34
+
35
+ export async function getCallingPackageUid() {
36
+ return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();
37
+ }
38
+
39
+ export async function getUidForPackage(packageName: string) {
40
+ return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);
41
+ }
@@ -0,0 +1,31 @@
1
+ import { useEffect } from 'react';
2
+
3
+ import {
4
+ initializeMobileWalletAdapterSession,
5
+ MobileWalletAdapterConfig,
6
+ } from './initializeMobileWalletAdapterSession.js';
7
+ import { initializeMWAEventListener } from './initializeMWAEventListener.js';
8
+ import { MWASessionEvent } from './mwaSessionEvents.js';
9
+ import { MWARequest } from './resolve.js';
10
+
11
+ export function useMobileWalletAdapterSession(
12
+ walletName: string,
13
+ config: MobileWalletAdapterConfig,
14
+ handleRequest: (request: MWARequest) => void,
15
+ handleSessionEvent: (sessionEvent: MWASessionEvent) => void,
16
+ ) {
17
+ useEffect(() => {
18
+ async function startSession() {
19
+ try {
20
+ await initializeMobileWalletAdapterSession(walletName, config);
21
+ } catch (e) {
22
+ console.error(e);
23
+ }
24
+ }
25
+ const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);
26
+ startSession();
27
+ return () => {
28
+ listener.remove();
29
+ };
30
+ }, []);
31
+ }