@ledgerhq/device-signer-kit-ethereum 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/GetChallengeCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetChallengeCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/GetChallengeCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetChallengeCommand.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideEnumCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideEnumCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideEnumCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideEnumCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideNFTInformationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideNFTInformationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideNFTInformationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideNFTInformationCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideSafeAccountCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideSafeAccountCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideSafeAccountCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideSafeAccountCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideTokenInformationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTokenInformationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideTokenInformationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTokenInformationCommand.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideTransactionInformationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTransactionInformationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideTransactionInformationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTransactionInformationCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideTrustedNameCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTrustedNameCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideTrustedNameCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideTrustedNameCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SendEIP712StructDefinitionCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712StructDefinitionCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SendEIP712StructImplemCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712StructImplemCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SendEIP712StructImplemCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SendEIP712StructImplemCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SetExternalPluginCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SetExternalPluginCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SetExternalPluginCommand.test.js +2 -2
- package/lib/cjs/internal/app-binder/command/SetExternalPluginCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SetPluginCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SetPluginCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SetPluginCommand.test.js +2 -2
- package/lib/cjs/internal/app-binder/command/SetPluginCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SignEIP712Command.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignEIP712Command.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SignEIP712Command.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignEIP712Command.test.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SignPersonalMessageCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignPersonalMessageCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SignPersonalMessageCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignPersonalMessageCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/StartTransactionCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/StartTransactionCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/StartTransactionCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/StartTransactionCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/StoreTransactionCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/StoreTransactionCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/StoreTransactionCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/StoreTransactionCommand.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.js.map +2 -2
- package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.test.js.map +3 -3
- package/lib/cjs/package.json +2 -2
- package/lib/esm/internal/app-binder/command/GetAddressCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/GetAddressCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js.map +2 -2
- package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +2 -2
- package/lib/esm/internal/app-binder/command/GetChallengeCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/GetChallengeCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/GetChallengeCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/GetChallengeCommand.test.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideEnumCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideEnumCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideEnumCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideEnumCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideNFTInformationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideNFTInformationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideNFTInformationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideNFTInformationCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideSafeAccountCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideSafeAccountCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideSafeAccountCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideSafeAccountCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideTokenInformationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTokenInformationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideTokenInformationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTokenInformationCommand.test.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideTransactionInformationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTransactionInformationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideTransactionInformationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTransactionInformationCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideTrustedNameCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTrustedNameCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideTrustedNameCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideTrustedNameCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SendEIP712StructDefinitionCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712StructDefinitionCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SendEIP712StructImplemCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712StructImplemCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SendEIP712StructImplemCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SendEIP712StructImplemCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SetExternalPluginCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SetExternalPluginCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SetExternalPluginCommand.test.js +2 -2
- package/lib/esm/internal/app-binder/command/SetExternalPluginCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SetPluginCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SetPluginCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SetPluginCommand.test.js +2 -2
- package/lib/esm/internal/app-binder/command/SetPluginCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SignEIP712Command.js +1 -1
- package/lib/esm/internal/app-binder/command/SignEIP712Command.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SignEIP712Command.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SignEIP712Command.test.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SignPersonalMessageCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SignPersonalMessageCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SignPersonalMessageCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SignPersonalMessageCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/StartTransactionCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/StartTransactionCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/StartTransactionCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/StartTransactionCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/StoreTransactionCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/StoreTransactionCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/StoreTransactionCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/StoreTransactionCommand.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.js.map +2 -2
- package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.test.js.map +3 -3
- package/lib/esm/package.json +2 -2
- package/lib/types/internal/app-binder/command/GetAddressCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/GetAddressCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/GetChallengeCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/GetChallengeCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideEnumCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideEnumCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideNFTInformationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideNFTInformationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideSafeAccountCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideSafeAccountCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideTokenInformationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideTokenInformationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideTransactionInformationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideTransactionInformationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideTrustedNameCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideTrustedNameCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SendEIP712FilteringCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SendEIP712FilteringCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SendEIP712StructDefinitionCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SendEIP712StructDefinitionCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SendEIP712StructImplemCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SendEIP712StructImplemCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SetExternalPluginCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SetExternalPluginCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SetPluginCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SetPluginCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SignEIP712Command.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SignEIP712Command.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SignPersonalMessageCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SignPersonalMessageCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/StartTransactionCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/StartTransactionCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/StoreTransactionCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/StoreTransactionCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.d.ts +1 -0
- package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n NetworkConfigurationType,\n ProvideNetworkConfigurationCommand,\n type ProvideNetworkConfigurationCommandArgs,\n} from \"./ProvideNetworkConfigurationCommand\";\n\ndescribe(\"ProvideNetworkConfigurationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAIO,gDAEP,SAAS,qCAAsC,IAAM,CACnD,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,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2BAAyB,aAC9C,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
-
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideNetworkConfigurationCommand", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n NetworkConfigurationType,\n ProvideNetworkConfigurationCommand,\n type ProvideNetworkConfigurationCommandArgs,\n} from \"./ProvideNetworkConfigurationCommand\";\n\ndescribe(\"ProvideNetworkConfigurationCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideNetworkConfiguration'\", () => {\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n expect(command.name).toBe(\"provideNetworkConfiguration\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAIO,gDAEP,SAAS,qCAAsC,IAAM,CACnD,SAAS,OAAQ,IAAM,CACrB,GAAG,0CAA2C,IAAM,CAClD,MAAMC,EAAU,IAAI,qCAAmC,CACrD,KAAM,IAAI,WACV,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,CAAC,EACD,OAAOA,EAAQ,IAAI,EAAE,KAAK,6BAA6B,CACzD,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD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C,EALU,IAAI,qCAAmC,CACrD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideNetworkConfigurationCommand", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(o,r)=>{for(var d in r)n(o,d,{get:r[d],enumerable:!0})},A=(o,r,d,
|
|
1
|
+
"use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(o,r)=>{for(var d in r)n(o,d,{get:r[d],enumerable:!0})},A=(o,r,d,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of u(r))!l.call(o,e)&&e!==d&&n(o,e,{get:()=>r[e],enumerable:!(p=i(r,e))||p.enumerable});return o};var C=o=>A(n({},"__esModule",{value:!0}),o);var E={};y(E,{ProvideProxyInfoCommand:()=>f});module.exports=C(E);var t=require("@ledgerhq/device-management-kit"),s=require("@ledgerhq/signer-utils"),m=require("purify-ts"),a=require("./utils/ethAppErrors");class f{constructor(r){this.args=r}name="provideProxyInfo";errorHelper=new s.CommandErrorHelper(a.ETH_APP_ERRORS,a.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:42,p1:this.args.isFirstChunk?1:0,p2:0};return new t.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return m.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,t.CommandResultFactory)({data:void 0}))}}0&&(module.exports={ProvideProxyInfoCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideProxyInfoCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideProxyInfoCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideProxyInfoCommandArgs = {\n /**\n * The proxy info data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideProxyInfoCommand\n implements Command<void, ProvideProxyInfoCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideProxyInfoCommandArgs) {}\n\n getApdu(): Apdu {\n const ProvideProxyInfoArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x2a,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideProxyInfoArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAEb,
|
|
4
|
+
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideProxyInfoCommandArgs = {\n /**\n * The proxy info data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideProxyInfoCommand\n implements Command<void, ProvideProxyInfoCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideProxyInfo\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideProxyInfoCommandArgs) {}\n\n getApdu(): Apdu {\n const ProvideProxyInfoArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x2a,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideProxyInfoArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAEb,CAOE,YAA6BM,EAAmC,CAAnC,UAAAA,CAAoC,CANxD,KAAO,mBACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAIA,SAAgB,CACd,MAAMC,EAAwC,CAC5C,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,CACN,EAEA,OAAO,IAAI,cAAYA,CAAoB,EACxC,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideProxyInfoCommand_exports", "__export", "ProvideProxyInfoCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "ProvideProxyInfoArgs", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=require("@ledgerhq/device-management-kit"),s=require("./utils/ethAppErrors"),t=require("./ProvideProxyInfoCommand");describe("ProvideProxyInfoCommand",()=>{describe("name",()=>{it("should be 'provideProxyInfo'",()=>{const e=new t.ProvideProxyInfoCommand({data:new Uint8Array,isFirstChunk:!0});expect(e.name).toBe("provideProxyInfo")})}),describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const e={data:Uint8Array.from([1,2,3]),isFirstChunk:!0},r=new t.ProvideProxyInfoCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,42,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const e={data:Uint8Array.from([4,5,6]),isFirstChunk:!1},r=new t.ProvideProxyInfoCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,42,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},r=new t.ProvideProxyInfoCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);if((0,n.isSuccessCommandResult)(r))throw new Error("Expected an error");expect(r.error).toBeDefined(),expect(r.error).toBeInstanceOf(s.EthAppCommandError)}),it("should return a success result if the response status code is valid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},r=new t.ProvideProxyInfoCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);expect((0,n.isSuccessCommandResult)(r)).toBe(!0)})})});
|
|
2
2
|
//# sourceMappingURL=ProvideProxyInfoCommand.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideProxyInfoCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideProxyInfoCommand,\n type ProvideProxyInfoCommandArgs,\n} from \"./ProvideProxyInfoCommand\";\n\ndescribe(\"ProvideProxyInfoCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,qCAEP,SAAS,0BAA2B,IAAM,CACxC,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAoC,CACxC,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,0BAAwBD,CAAI,EAC3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAAoC,CACxC,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,0BAAwBD,CAAI,EAC3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,0BAAwB,CAC1C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,0BAAwB,CAC1C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
-
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideProxyInfoCommand", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideProxyInfoCommand,\n type ProvideProxyInfoCommandArgs,\n} from \"./ProvideProxyInfoCommand\";\n\ndescribe(\"ProvideProxyInfoCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideProxyInfo'\", () => {\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n });\n expect(command.name).toBe(\"provideProxyInfo\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,qCAEP,SAAS,0BAA2B,IAAM,CACxC,SAAS,OAAQ,IAAM,CACrB,GAAG,+BAAgC,IAAM,CACvC,MAAMC,EAAU,IAAI,0BAAwB,CAC1C,KAAM,IAAI,WACV,aAAc,EAChB,CAAC,EACD,OAAOA,EAAQ,IAAI,EAAE,KAAK,kBAAkB,CAC9C,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAoC,CACxC,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,0BAAwBD,CAAI,EAC3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAAoC,CACxC,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,0BAAwBD,CAAI,EAC3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,0BAAwB,CAC1C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,0BAAwB,CAC1C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideProxyInfoCommand", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var E=(o,r)=>{for(var e in r)s(o,e,{get:r[e],enumerable:!0})},
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var E=(o,r)=>{for(var e in r)s(o,e,{get:r[e],enumerable:!0})},y=(o,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of l(r))!A.call(o,t)&&t!==e&&s(o,t,{get:()=>r[t],enumerable:!(n=u(r,t))||n.enumerable});return o};var C=o=>y(s({},"__esModule",{value:!0}),o);var c={};E(c,{ProvideSafeAccountCommand:()=>R,ProvideSafeAccountCommandType:()=>i});module.exports=C(c);var a=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),m=require("purify-ts"),d=require("./utils/ethAppErrors"),i=(e=>(e[e.SAFE_DESCRIPTOR=0]="SAFE_DESCRIPTOR",e[e.SIGNER_DESCRIPTOR=1]="SIGNER_DESCRIPTOR",e))(i||{});class R{constructor(r){this.args=r}name="provideSafeAccount";errorHelper=new p.CommandErrorHelper(d.ETH_APP_ERRORS,d.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:54,p1:this.args.isFirstChunk?1:0,p2:this.args.type};return new a.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return m.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,a.CommandResultFactory)({data:void 0}))}}0&&(module.exports={ProvideSafeAccountCommand,ProvideSafeAccountCommandType});
|
|
2
2
|
//# sourceMappingURL=ProvideSafeAccountCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideSafeAccountCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum ProvideSafeAccountCommandType {\n /**\n * The safe descriptor data to provide in chunks\n */\n SAFE_DESCRIPTOR = 0x00,\n /**\n * The signer descriptor data to provide in chunks\n */\n SIGNER_DESCRIPTOR = 0x01,\n}\n\nexport type ProvideSafeAccountCommandArgs = {\n /**\n * The safe account data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n /**\n * The type of the safe account data to provide\n */\n readonly type: ProvideSafeAccountCommandType;\n};\n\nexport class ProvideSafeAccountCommand\n implements Command<void, ProvideSafeAccountCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideSafeAccountCommandArgs) {}\n\n getApdu(): Apdu {\n const ProvideSafeAccountArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x36,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: this.args.type,\n };\n\n return new ApduBuilder(ProvideSafeAccountArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,kCAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAEKL,OAIVA,IAAA,gBAAkB,GAAlB,kBAIAA,IAAA,kBAAoB,GAApB,oBARUA,OAAA,IA0BL,MAAMD,CAEb,
|
|
4
|
+
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum ProvideSafeAccountCommandType {\n /**\n * The safe descriptor data to provide in chunks\n */\n SAFE_DESCRIPTOR = 0x00,\n /**\n * The signer descriptor data to provide in chunks\n */\n SIGNER_DESCRIPTOR = 0x01,\n}\n\nexport type ProvideSafeAccountCommandArgs = {\n /**\n * The safe account data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n /**\n * The type of the safe account data to provide\n */\n readonly type: ProvideSafeAccountCommandType;\n};\n\nexport class ProvideSafeAccountCommand\n implements Command<void, ProvideSafeAccountCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideSafeAccount\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideSafeAccountCommandArgs) {}\n\n getApdu(): Apdu {\n const ProvideSafeAccountArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x36,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: this.args.type,\n };\n\n return new ApduBuilder(ProvideSafeAccountArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,kCAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAEKL,OAIVA,IAAA,gBAAkB,GAAlB,kBAIAA,IAAA,kBAAoB,GAApB,oBARUA,OAAA,IA0BL,MAAMD,CAEb,CAOE,YAA6BO,EAAqC,CAArC,UAAAA,CAAsC,CAN1D,KAAO,qBACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAIA,SAAgB,CACd,MAAMC,EAA0C,CAC9C,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,KAAK,KAAK,IAChB,EAEA,OAAO,IAAI,cAAYA,CAAsB,EAC1C,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideSafeAccountCommand_exports", "__export", "ProvideSafeAccountCommand", "ProvideSafeAccountCommandType", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "ProvideSafeAccountArgs", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=require("@ledgerhq/device-management-kit"),s=require("./utils/ethAppErrors"),t=require("./ProvideSafeAccountCommand");describe("ProvideSafeAccountCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU for the first chunk with SAFE_DESCRIPTOR type",()=>{const
|
|
1
|
+
"use strict";var n=require("@ledgerhq/device-management-kit"),s=require("./utils/ethAppErrors"),t=require("./ProvideSafeAccountCommand");describe("ProvideSafeAccountCommand",()=>{describe("name",()=>{it("should be 'provideSafeAccount'",()=>{const e=new t.ProvideSafeAccountCommand({data:new Uint8Array,isFirstChunk:!0,type:t.ProvideSafeAccountCommandType.SAFE_DESCRIPTOR});expect(e.name).toBe("provideSafeAccount")})}),describe("getApdu",()=>{it("should return the raw APDU for the first chunk with SAFE_DESCRIPTOR type",()=>{const e={data:Uint8Array.from([1,2,3]),isFirstChunk:!0,type:t.ProvideSafeAccountCommandType.SAFE_DESCRIPTOR},r=new t.ProvideSafeAccountCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,54,1,0,3,1,2,3]))}),it("should return the raw APDU for the first chunk with SIGNER_DESCRIPTOR type",()=>{const e={data:Uint8Array.from([1,2,3]),isFirstChunk:!0,type:t.ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR},r=new t.ProvideSafeAccountCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,54,1,1,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk with SAFE_DESCRIPTOR type",()=>{const e={data:Uint8Array.from([4,5,6]),isFirstChunk:!1,type:t.ProvideSafeAccountCommandType.SAFE_DESCRIPTOR},r=new t.ProvideSafeAccountCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,54,0,0,3,4,5,6]))}),it("should return the raw APDU for the subsequent chunk with SIGNER_DESCRIPTOR type",()=>{const e={data:Uint8Array.from([4,5,6]),isFirstChunk:!1,type:t.ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR},r=new t.ProvideSafeAccountCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,54,0,1,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},r=new t.ProvideSafeAccountCommand({data:new Uint8Array(0),isFirstChunk:!0,type:t.ProvideSafeAccountCommandType.SAFE_DESCRIPTOR}).parseResponse(e);if((0,n.isSuccessCommandResult)(r))throw new Error("Expected an error");expect(r.error).toBeDefined(),expect(r.error).toBeInstanceOf(s.EthAppCommandError)}),it("should return a success result if the response status code is valid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},r=new t.ProvideSafeAccountCommand({data:new Uint8Array(0),isFirstChunk:!0,type:t.ProvideSafeAccountCommandType.SAFE_DESCRIPTOR}).parseResponse(e);expect((0,n.isSuccessCommandResult)(r)).toBe(!0)})})});
|
|
2
2
|
//# sourceMappingURL=ProvideSafeAccountCommand.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideSafeAccountCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideSafeAccountCommand,\n type ProvideSafeAccountCommandArgs,\n ProvideSafeAccountCommandType,\n} from \"./ProvideSafeAccountCommand\";\n\ndescribe(\"ProvideSafeAccountCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk with SAFE_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the first chunk with SIGNER_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x01, 0x01, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk with SAFE_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk with SIGNER_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n type: ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x00, 0x01, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n });\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAIO,uCAEP,SAAS,4BAA6B,IAAM,CAC1C,SAAS,UAAW,IAAM,CACxB,GAAG,2EAA4E,IAAM,CAEnF,MAAMC,EAAsC,CAC1C,KAAM,WAAW,KAAK,C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,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,4BAA0B,CAC5C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,KAAM,gCAA8B,eACtC,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,4BAA0B,CAC5C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,KAAM,gCAA8B,eACtC,CAAC,EACsB,cAAcD,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
-
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideSafeAccountCommand", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideSafeAccountCommand,\n type ProvideSafeAccountCommandArgs,\n ProvideSafeAccountCommandType,\n} from \"./ProvideSafeAccountCommand\";\n\ndescribe(\"ProvideSafeAccountCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideSafeAccount'\", () => {\n const command = new ProvideSafeAccountCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n });\n expect(command.name).toBe(\"provideSafeAccount\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk with SAFE_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the first chunk with SIGNER_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x01, 0x01, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk with SAFE_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk with SIGNER_DESCRIPTOR type\", () => {\n // GIVEN\n const args: ProvideSafeAccountCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n type: ProvideSafeAccountCommandType.SIGNER_DESCRIPTOR,\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x36, 0x00, 0x01, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideSafeAccountCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n type: ProvideSafeAccountCommandType.SAFE_DESCRIPTOR,\n });\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAIO,uCAEP,SAAS,4BAA6B,IAAM,CAC1C,SAAS,OAAQ,IAAM,CACrB,GAAG,iCAAkC,IAAM,CACzC,MAAMC,EAAU,IAAI,4BAA0B,CAC5C,KAAM,IAAI,WACV,aAAc,GACd,KAAM,gCAA8B,eACtC,CAAC,EACD,OAAOA,EAAQ,IAAI,EAAE,KAAK,oBAAoB,CA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E,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,4BAA0B,CAC5C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,KAAM,gCAA8B,eACtC,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,4BAA0B,CAC5C,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,KAAM,gCAA8B,eACtC,CAAC,EACsB,cAAcD,CAAQ,EAG7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideSafeAccountCommand", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var C=(o
|
|
1
|
+
"use strict";var m=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var C=(r,o)=>{for(var n in o)m(r,n,{get:o[n],enumerable:!0})},A=(r,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of u(o))!l.call(r,t)&&t!==n&&m(r,t,{get:()=>o[t],enumerable:!(a=i(o,t))||a.enumerable});return r};var y=r=>A(m({},"__esModule",{value:!0}),r);var E={};C(E,{ProvideTokenInformationCommand:()=>f});module.exports=y(E);var e=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),s=require("purify-ts"),d=require("./utils/ethAppErrors");class f{constructor(o){this.args=o}name="provideTokenInformation";errorHelper=new p.CommandErrorHelper(d.ETH_APP_ERRORS,d.EthAppCommandErrorFactory);getApdu(){const o={cla:224,ins:10,p1:0,p2:0};return new e.ApduBuilder(o).addHexaStringToData(this.args.payload).build()}parseResponse(o){return s.Maybe.fromNullable(this.errorHelper.getError(o)).orDefaultLazy(()=>{const a=new e.ApduParser(o).extract8BitUInt()??0;return(0,e.CommandResultFactory)({data:{tokenIndex:a}})})}}0&&(module.exports={ProvideTokenInformationCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideTokenInformationCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTokenInformationCommand.ts"],
|
|
4
|
-
"sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-erc-20-token-information\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTokenInformationCommandArgs = {\n payload: string;\n};\n\nexport type ProvideTokenInformationCommandResponse = {\n tokenIndex: number;\n};\n\nexport class ProvideTokenInformationCommand\n implements\n Command<\n ProvideTokenInformationCommandResponse,\n ProvideTokenInformationCommandArgs,\n EthErrorCodes\n >\n{\n private readonly errorHelper = new CommandErrorHelper<\n ProvideTokenInformationCommandResponse,\n EthErrorCodes\n >(ETH_APP_ERRORS, EthAppCommandErrorFactory);\n\n constructor(private readonly args: ProvideTokenInformationCommandArgs) {}\n\n getApdu(): Apdu {\n const getEthAddressArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x0a,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(getEthAddressArgs)\n .addHexaStringToData(this.args.payload)\n .build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<ProvideTokenInformationCommandResponse, EthErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n const tokenIndex = parser.extract8BitUInt() ?? 0;\n return CommandResultFactory({ data: { tokenIndex } });\n });\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EASO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAUA,MAAML,CAOb,
|
|
4
|
+
"sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-erc-20-token-information\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTokenInformationCommandArgs = {\n payload: string;\n};\n\nexport type ProvideTokenInformationCommandResponse = {\n tokenIndex: number;\n};\n\nexport class ProvideTokenInformationCommand\n implements\n Command<\n ProvideTokenInformationCommandResponse,\n ProvideTokenInformationCommandArgs,\n EthErrorCodes\n >\n{\n readonly name = \"provideTokenInformation\";\n private readonly errorHelper = new CommandErrorHelper<\n ProvideTokenInformationCommandResponse,\n EthErrorCodes\n >(ETH_APP_ERRORS, EthAppCommandErrorFactory);\n\n constructor(private readonly args: ProvideTokenInformationCommandArgs) {}\n\n getApdu(): Apdu {\n const getEthAddressArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x0a,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(getEthAddressArgs)\n .addHexaStringToData(this.args.payload)\n .build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<ProvideTokenInformationCommandResponse, EthErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n const tokenIndex = parser.extract8BitUInt() ?? 0;\n return CommandResultFactory({ data: { tokenIndex } });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EASO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAUA,MAAML,CAOb,CAOE,YAA6BM,EAA0C,CAA1C,UAAAA,CAA2C,CAN/D,KAAO,0BACC,YAAc,IAAI,qBAGjC,iBAAgB,2BAAyB,EAI3C,SAAgB,CACd,MAAMC,EAAqC,CACzC,IAAK,IACL,IAAK,GACL,GAAI,EACJ,GAAI,CACN,EACA,OAAO,IAAI,cAAYA,CAAiB,EACrC,oBAAoB,KAAK,KAAK,OAAO,EACrC,MAAM,CACX,CAEA,cACEC,EACsE,CACtE,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAQ,CACpC,EAAE,cAAc,IAAM,CAEpB,MAAMC,EADS,IAAI,aAAWD,CAAQ,EACZ,gBAAgB,GAAK,EAC/C,SAAO,wBAAqB,CAAE,KAAM,CAAE,WAAAC,CAAW,CAAE,CAAC,CACtD,CAAC,CACH,CACF",
|
|
6
6
|
"names": ["ProvideTokenInformationCommand_exports", "__export", "ProvideTokenInformationCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "getEthAddressArgs", "response", "tokenIndex"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=require("@ledgerhq/device-management-kit"),a=require("./ProvideTokenInformationCommand");const o="0455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c",t="0455534443a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000006000000013045022100b2e358726e4e6a6752cf344017c0e9d45b9a904120758d45f61b2804f9ad5299022015161ef28d8c4481bd9432c13562def9cce688bcfec896ef244c9a213f106cdd",r=Uint8Array.from([224,10,0,0,103,4,85,83,68,84,218,193,127,149,141,46,229,35,162,32,98,6,153,69,151,193,61,131,30,199,0,0,0,6,0,0,0,1,48,68,2,32,120,198,108,206,163,228,222,219,21,162,78,195,199,131,215,181,130,205,38,13,175,98,253,54,175,233,168,33,42,52,74,237,2,32,22,11,168,193,196,182,168,170,101,101,190,210,6,50,160,145,174,238,183,191,218,198,127,198,88,154,96,49,172,191,81,28]),n=Uint8Array.from([224,10,0,0,104,4,85,83,68,67,160,184,105,145,198,33,139,54,193,209,157,74,46,158,176,206,54,6,235,72,0,0,0,6,0,0,0,1,48,69,2,33,0,178,227,88,114,110,78,106,103,82,207,52,64,23,192,233,212,91,154,144,65,32,117,141,69,246,27,40,4,249,173,82,153,2,32,21,22,30,242,141,140,68,129,189,148,50,193,53,98,222,249,204,230,136,188,254,200,150,239,36,76,154,33,63,16,108,221]);describe("ProvideTokenInformationCommand",()=>{let x;describe("name",()=>{it("should be 'provideTokenInformation'",()=>{x=new a.ProvideTokenInformationCommand({payload:""}),expect(x.name).toBe("provideTokenInformation")})}),describe("getApdu",()=>{it("should return the apdu for usdt payload",()=>{x=new a.ProvideTokenInformationCommand({payload:o});const e=x.getApdu();expect(e.getRawApdu()).toStrictEqual(r)}),it("should return the apdu for usdc payload",()=>{x=new a.ProvideTokenInformationCommand({payload:t});const e=x.getApdu();expect(e.getRawApdu()).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should parse the response",()=>{const e={statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([1])},c=x.parseResponse(e);expect(c).toStrictEqual((0,d.CommandResultFactory)({data:{tokenIndex:1}}))}),it("should return an error if the response is not successful",()=>{const e={statusCode:Uint8Array.from([85,21]),data:new Uint8Array},c=x.parseResponse(e);expect((0,d.isSuccessCommandResult)(c)).toBe(!1)})})});
|
|
2
2
|
//# sourceMappingURL=ProvideTokenInformationCommand.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTokenInformationCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideTokenInformationCommand } from \"./ProvideTokenInformationCommand\";\n\nconst PAYLOAD_USDT =\n \"0455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c\";\n\nconst PAYLOAD_USDC =\n \"0455534443a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000006000000013045022100b2e358726e4e6a6752cf344017c0e9d45b9a904120758d45f61b2804f9ad5299022015161ef28d8c4481bd9432c13562def9cce688bcfec896ef244c9a213f106cdd\";\n\nconst PROVIDE_TOKEN_INFORMATION_APDU_USDT = Uint8Array.from([\n 0xe0, 0x0a, 0x00, 0x00, 0x67, 0x04, 0x55, 0x53, 0x44, 0x54, 0xda, 0xc1, 0x7f,\n 0x95, 0x8d, 0x2e, 0xe5, 0x23, 0xa2, 0x20, 0x62, 0x06, 0x99, 0x45, 0x97, 0xc1,\n 0x3d, 0x83, 0x1e, 0xc7, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x30,\n 0x44, 0x02, 0x20, 0x78, 0xc6, 0x6c, 0xce, 0xa3, 0xe4, 0xde, 0xdb, 0x15, 0xa2,\n 0x4e, 0xc3, 0xc7, 0x83, 0xd7, 0xb5, 0x82, 0xcd, 0x26, 0x0d, 0xaf, 0x62, 0xfd,\n 0x36, 0xaf, 0xe9, 0xa8, 0x21, 0x2a, 0x34, 0x4a, 0xed, 0x02, 0x20, 0x16, 0x0b,\n 0xa8, 0xc1, 0xc4, 0xb6, 0xa8, 0xaa, 0x65, 0x65, 0xbe, 0xd2, 0x06, 0x32, 0xa0,\n 0x91, 0xae, 0xee, 0xb7, 0xbf, 0xda, 0xc6, 0x7f, 0xc6, 0x58, 0x9a, 0x60, 0x31,\n 0xac, 0xbf, 0x51, 0x1c,\n]);\n\nconst PROVIDE_TOKEN_INFORMATION_APDU_USDC = Uint8Array.from([\n 0xe0, 0x0a, 0x00, 0x00, 0x68, 0x04, 0x55, 0x53, 0x44, 0x43, 0xa0, 0xb8, 0x69,\n 0x91, 0xc6, 0x21, 0x8b, 0x36, 0xc1, 0xd1, 0x9d, 0x4a, 0x2e, 0x9e, 0xb0, 0xce,\n 0x36, 0x06, 0xeb, 0x48, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x30,\n 0x45, 0x02, 0x21, 0x00, 0xb2, 0xe3, 0x58, 0x72, 0x6e, 0x4e, 0x6a, 0x67, 0x52,\n 0xcf, 0x34, 0x40, 0x17, 0xc0, 0xe9, 0xd4, 0x5b, 0x9a, 0x90, 0x41, 0x20, 0x75,\n 0x8d, 0x45, 0xf6, 0x1b, 0x28, 0x04, 0xf9, 0xad, 0x52, 0x99, 0x02, 0x20, 0x15,\n 0x16, 0x1e, 0xf2, 0x8d, 0x8c, 0x44, 0x81, 0xbd, 0x94, 0x32, 0xc1, 0x35, 0x62,\n 0xde, 0xf9, 0xcc, 0xe6, 0x88, 0xbc, 0xfe, 0xc8, 0x96, 0xef, 0x24, 0x4c, 0x9a,\n 0x21, 0x3f, 0x10, 0x6c, 0xdd,\n]);\n\ndescribe(\"ProvideTokenInformationCommand\", () => {\n let command: ProvideTokenInformationCommand;\n\n describe(\"getApdu\", () => {\n it(\"should return the apdu for usdt payload\", () => {\n // GIVEN\n command = new ProvideTokenInformationCommand({ payload: PAYLOAD_USDT });\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n PROVIDE_TOKEN_INFORMATION_APDU_USDT,\n );\n });\n\n it(\"should return the apdu for usdc payload\", () => {\n // GIVEN\n command = new ProvideTokenInformationCommand({ payload: PAYLOAD_USDC });\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n PROVIDE_TOKEN_INFORMATION_APDU_USDC,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([0x01]),\n };\n\n // WHEN\n const parsedResponse = command.parseResponse(response);\n\n // THEN\n expect(parsedResponse).toStrictEqual(\n CommandResultFactory({ data: { tokenIndex: 0x01 } }),\n );\n });\n\n it(\"should return an error if the response is not successful\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(isS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AC,CACH,CAAC,CACH,CAAC",
|
|
4
|
+
"sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideTokenInformationCommand } from \"./ProvideTokenInformationCommand\";\n\nconst PAYLOAD_USDT =\n \"0455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c\";\n\nconst PAYLOAD_USDC =\n \"0455534443a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000006000000013045022100b2e358726e4e6a6752cf344017c0e9d45b9a904120758d45f61b2804f9ad5299022015161ef28d8c4481bd9432c13562def9cce688bcfec896ef244c9a213f106cdd\";\n\nconst PROVIDE_TOKEN_INFORMATION_APDU_USDT = Uint8Array.from([\n 0xe0, 0x0a, 0x00, 0x00, 0x67, 0x04, 0x55, 0x53, 0x44, 0x54, 0xda, 0xc1, 0x7f,\n 0x95, 0x8d, 0x2e, 0xe5, 0x23, 0xa2, 0x20, 0x62, 0x06, 0x99, 0x45, 0x97, 0xc1,\n 0x3d, 0x83, 0x1e, 0xc7, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x30,\n 0x44, 0x02, 0x20, 0x78, 0xc6, 0x6c, 0xce, 0xa3, 0xe4, 0xde, 0xdb, 0x15, 0xa2,\n 0x4e, 0xc3, 0xc7, 0x83, 0xd7, 0xb5, 0x82, 0xcd, 0x26, 0x0d, 0xaf, 0x62, 0xfd,\n 0x36, 0xaf, 0xe9, 0xa8, 0x21, 0x2a, 0x34, 0x4a, 0xed, 0x02, 0x20, 0x16, 0x0b,\n 0xa8, 0xc1, 0xc4, 0xb6, 0xa8, 0xaa, 0x65, 0x65, 0xbe, 0xd2, 0x06, 0x32, 0xa0,\n 0x91, 0xae, 0xee, 0xb7, 0xbf, 0xda, 0xc6, 0x7f, 0xc6, 0x58, 0x9a, 0x60, 0x31,\n 0xac, 0xbf, 0x51, 0x1c,\n]);\n\nconst PROVIDE_TOKEN_INFORMATION_APDU_USDC = Uint8Array.from([\n 0xe0, 0x0a, 0x00, 0x00, 0x68, 0x04, 0x55, 0x53, 0x44, 0x43, 0xa0, 0xb8, 0x69,\n 0x91, 0xc6, 0x21, 0x8b, 0x36, 0xc1, 0xd1, 0x9d, 0x4a, 0x2e, 0x9e, 0xb0, 0xce,\n 0x36, 0x06, 0xeb, 0x48, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x30,\n 0x45, 0x02, 0x21, 0x00, 0xb2, 0xe3, 0x58, 0x72, 0x6e, 0x4e, 0x6a, 0x67, 0x52,\n 0xcf, 0x34, 0x40, 0x17, 0xc0, 0xe9, 0xd4, 0x5b, 0x9a, 0x90, 0x41, 0x20, 0x75,\n 0x8d, 0x45, 0xf6, 0x1b, 0x28, 0x04, 0xf9, 0xad, 0x52, 0x99, 0x02, 0x20, 0x15,\n 0x16, 0x1e, 0xf2, 0x8d, 0x8c, 0x44, 0x81, 0xbd, 0x94, 0x32, 0xc1, 0x35, 0x62,\n 0xde, 0xf9, 0xcc, 0xe6, 0x88, 0xbc, 0xfe, 0xc8, 0x96, 0xef, 0x24, 0x4c, 0x9a,\n 0x21, 0x3f, 0x10, 0x6c, 0xdd,\n]);\n\ndescribe(\"ProvideTokenInformationCommand\", () => {\n let command: ProvideTokenInformationCommand;\n\n describe(\"name\", () => {\n it(\"should be 'provideTokenInformation'\", () => {\n command = new ProvideTokenInformationCommand({ payload: \"\" });\n expect(command.name).toBe(\"provideTokenInformation\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the apdu for usdt payload\", () => {\n // GIVEN\n command = new ProvideTokenInformationCommand({ payload: PAYLOAD_USDT });\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n PROVIDE_TOKEN_INFORMATION_APDU_USDT,\n );\n });\n\n it(\"should return the apdu for usdc payload\", () => {\n // GIVEN\n command = new ProvideTokenInformationCommand({ payload: PAYLOAD_USDC });\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n PROVIDE_TOKEN_INFORMATION_APDU_USDC,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([0x01]),\n };\n\n // WHEN\n const parsedResponse = command.parseResponse(response);\n\n // THEN\n expect(parsedResponse).toStrictEqual(\n CommandResultFactory({ data: { tokenIndex: 0x01 } }),\n );\n });\n\n it(\"should return an error if the response is not successful\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAA+C,4CAE/C,MAAMC,EACJ,iNAEIC,EACJ,mNAEIC,EAAsC,WAAW,KAAK,CAC1D,IAAM,GAAM,EAAM,EAAM,IAAM,EAAM,GAAM,GAAM,GAAM,GAAM,IAAM,IAAM,IACxE,IAAM,IAAM,GAAM,IAAM,GAAM,IAAM,GAAM,GAAM,EAAM,IAAM,GAAM,IAAM,IACxE,GAAM,IAAM,GAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GACxE,GAAM,EAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IACxE,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,GAAM,IAAM,GAAM,IACxE,GAAM,IAAM,IAAM,IAAM,GAAM,GAAM,GAAM,GAAM,IAAM,EAAM,GAAM,GAAM,GACxE,IAAM,IAAM,IAAM,I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,EAAK,WAAW,CAAC,EAAE,cACxBH,CACF,CACF,CAAC,EAED,GAAG,0CAA2C,IAAM,CAElDE,EAAU,IAAI,iCAA+B,CAAE,QAASH,CAAa,CAAC,EAGtE,MAAMI,EAAOD,EAAQ,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxBF,CACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,4BAA6B,IAAM,CAEpC,MAAMG,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,WAAW,KAAK,CAAC,CAAI,CAAC,CAC9B,EAGMC,EAAiBH,EAAQ,cAAcE,CAAQ,EAGrD,OAAOC,CAAc,EAAE,iBACrB,wBAAqB,CAAE,KAAM,CAAE,WAAY,CAAK,CAAE,CAAC,CACrD,CACF,CAAC,EAED,GAAG,2DAA4D,IAAM,CAEnE,MAAMD,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,GAAM,EAAI,CAAC,EACxC,KAAM,IAAI,UACZ,EAGME,EAASJ,EAAQ,cAAcE,CAAQ,EAG7C,UAAO,0BAAuBE,CAAM,CAAC,EAAE,KAAK,EAAK,CACnD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["import_device_management_kit", "import_ProvideTokenInformationCommand", "PAYLOAD_USDT", "PAYLOAD_USDC", "PROVIDE_TOKEN_INFORMATION_APDU_USDT", "PROVIDE_TOKEN_INFORMATION_APDU_USDC", "command", "apdu", "response", "parsedResponse", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},A=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of l(r))!u.call(e,o)&&o!==t&&a(e,o,{get:()=>r[o],enumerable:!(n=m(r,o))||n.enumerable});return e};var C=e=>A(a({},"__esModule",{value:!0}),e);var E={};c(E,{ProvideTransactionFieldDescriptionCommand:()=>y});module.exports=C(E);var d=require("@ledgerhq/device-management-kit"),s=require("@ledgerhq/signer-utils"),p=require("purify-ts"),i=require("./utils/ethAppErrors");class y{constructor(r){this.args=r}name="provideTransactionFieldDescription";errorHelper=new s.CommandErrorHelper(i.ETH_APP_ERRORS,i.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:40,p1:this.args.isFirstChunk?1:0,p2:0};return new d.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return p.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,d.CommandResultFactory)({data:void 0}))}}0&&(module.exports={ProvideTransactionFieldDescriptionCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideTransactionFieldDescriptionCommand.js.map
|
package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.ts"],
|
|
4
|
-
"sourcesContent": ["//https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#tx-field-description\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTransactionFieldDescriptionCommandArgs = {\n /**\n * The field description data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideTransactionFieldDescriptionCommand\n implements\n Command<void, ProvideTransactionFieldDescriptionCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(\n private readonly args: ProvideTransactionFieldDescriptionCommandArgs,\n ) {}\n\n getApdu(): Apdu {\n const ProvideTransactionFieldDescriptionArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x28,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideTransactionFieldDescriptionArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAGb,
|
|
4
|
+
"sourcesContent": ["//https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#tx-field-description\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTransactionFieldDescriptionCommandArgs = {\n /**\n * The field description data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideTransactionFieldDescriptionCommand\n implements\n Command<void, ProvideTransactionFieldDescriptionCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideTransactionFieldDescription\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(\n private readonly args: ProvideTransactionFieldDescriptionCommandArgs,\n ) {}\n\n getApdu(): Apdu {\n const ProvideTransactionFieldDescriptionArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x28,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideTransactionFieldDescriptionArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAGb,CAOE,YACmBM,EACjB,CADiB,UAAAA,CAChB,CARM,KAAO,qCACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAMA,SAAgB,CACd,MAAMC,EAA0D,CAC9D,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,CACN,EAEA,OAAO,IAAI,cAAYA,CAAsC,EAC1D,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideTransactionFieldDescriptionCommand_exports", "__export", "ProvideTransactionFieldDescriptionCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "ProvideTransactionFieldDescriptionArgs", "response"]
|
|
7
7
|
}
|
package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=require("@ledgerhq/device-management-kit"),o=require("./utils/ethAppErrors"),t=require("./ProvideTransactionFieldDescriptionCommand");describe("ProvideTransactionFieldDescriptionCommand",()=>{describe("name",()=>{it("should be 'provideTransactionFieldDescription'",()=>{const r=new t.ProvideTransactionFieldDescriptionCommand({data:new Uint8Array,isFirstChunk:!0});expect(r.name).toBe("provideTransactionFieldDescription")})}),describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const r={data:Uint8Array.from([1,2,3]),isFirstChunk:!0},e=new t.ProvideTransactionFieldDescriptionCommand(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,40,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const r={data:Uint8Array.from([4,5,6]),isFirstChunk:!1},e=new t.ProvideTransactionFieldDescriptionCommand(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,40,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},e=new t.ProvideTransactionFieldDescriptionCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(r);if((0,n.isSuccessCommandResult)(e))throw new Error("Expected an error");expect(e.error).toBeDefined(),expect(e.error).toBeInstanceOf(o.EthAppCommandError)}),it("should return a success result if the response status code is valid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},e=new t.ProvideTransactionFieldDescriptionCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(r);if((0,n.isSuccessCommandResult)(e))expect(e.data).toBeUndefined();else throw new Error("Expected a success result")})})});
|
|
2
2
|
//# sourceMappingURL=ProvideTransactionFieldDescriptionCommand.test.js.map
|
package/lib/cjs/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideTransactionFieldDescriptionCommand,\n type ProvideTransactionFieldDescriptionCommandArgs,\n} from \"./ProvideTransactionFieldDescriptionCommand\";\n\ndescribe(\"ProvideTransactionFieldDescriptionCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideTransactionFieldDescriptionCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x28, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideTransactionFieldDescriptionCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x28, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,uDAEP,SAAS,4CAA6C,IAAM,CAC1D,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAsD,CAC1D,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,4CAA0CD,CAAI,EAC7C,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAAsD,CAC1D,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,4CAA0CD,CAAI,EAC7C,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,4CAA0C,CAC5D,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,4CAA0C,CAC5D,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
-
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideTransactionFieldDescriptionCommand", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideTransactionFieldDescriptionCommand,\n type ProvideTransactionFieldDescriptionCommandArgs,\n} from \"./ProvideTransactionFieldDescriptionCommand\";\n\ndescribe(\"ProvideTransactionFieldDescriptionCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideTransactionFieldDescription'\", () => {\n const command = new ProvideTransactionFieldDescriptionCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n });\n expect(command.name).toBe(\"provideTransactionFieldDescription\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideTransactionFieldDescriptionCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x28, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideTransactionFieldDescriptionCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x28, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideTransactionFieldDescriptionCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,uDAEP,SAAS,4CAA6C,IAAM,CAC1D,SAAS,OAAQ,IAAM,CACrB,GAAG,iDAAkD,IAAM,CACzD,MAAMC,EAAU,IAAI,4CAA0C,CAC5D,KAAM,IAAI,WACV,aAAc,EAChB,CAAC,EACD,OAAOA,EAAQ,IAAI,EAAE,KAAK,oCAAoC,CAChE,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAsD,CAC1D,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,4CAA0CD,CAAI,EAC7C,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAAsD,CAC1D,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,4CAA0CD,CAAI,EAC7C,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,4CAA0C,CAC5D,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,4CAA0C,CAC5D,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideTransactionFieldDescriptionCommand", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(o,r)=>{for(var a in r)d(o,a,{get:r[a],enumerable:!0})},C=(o,r,a,
|
|
1
|
+
"use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(o,r)=>{for(var a in r)d(o,a,{get:r[a],enumerable:!0})},C=(o,r,a,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of u(r))!l.call(o,e)&&e!==a&&d(o,e,{get:()=>r[e],enumerable:!(i=p(r,e))||i.enumerable});return o};var y=o=>C(d({},"__esModule",{value:!0}),o);var E={};A(E,{ProvideTransactionInformationCommand:()=>f});module.exports=y(E);var n=require("@ledgerhq/device-management-kit"),s=require("@ledgerhq/signer-utils"),m=require("purify-ts"),t=require("./utils/ethAppErrors");class f{constructor(r){this.args=r}name="provideTransactionInformation";errorHelper=new s.CommandErrorHelper(t.ETH_APP_ERRORS,t.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:38,p1:this.args.isFirstChunk?1:0,p2:0};return new n.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return m.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,n.CommandResultFactory)({data:void 0}))}}0&&(module.exports={ProvideTransactionInformationCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideTransactionInformationCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTransactionInformationCommand.ts"],
|
|
4
|
-
"sourcesContent": ["// https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#transaction-info\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTransactionInformationCommandArgs = {\n /**\n * The transaction information to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideTransactionInformationCommand\n implements\n Command<void, ProvideTransactionInformationCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(\n private readonly args: ProvideTransactionInformationCommandArgs,\n ) {}\n\n getApdu(): Apdu {\n const ProvideTransactionInformationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x26,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideTransactionInformationArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAGb,
|
|
4
|
+
"sourcesContent": ["// https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#transaction-info\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTransactionInformationCommandArgs = {\n /**\n * The transaction information to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideTransactionInformationCommand\n implements\n Command<void, ProvideTransactionInformationCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideTransactionInformation\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(\n private readonly args: ProvideTransactionInformationCommandArgs,\n ) {}\n\n getApdu(): Apdu {\n const ProvideTransactionInformationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x26,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideTransactionInformationArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAaA,MAAML,CAGb,CAOE,YACmBM,EACjB,CADiB,UAAAA,CAChB,CARM,KAAO,gCACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAMA,SAAgB,CACd,MAAMC,EAAqD,CACzD,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,CACN,EAEA,OAAO,IAAI,cAAYA,CAAiC,EACrD,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideTransactionInformationCommand_exports", "__export", "ProvideTransactionInformationCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "ProvideTransactionInformationArgs", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var o=require("@ledgerhq/device-management-kit"),s=require("./utils/ethAppErrors"),t=require("./ProvideTransactionInformationCommand");describe("ProvideTransactionInformationCommand",()=>{describe("name",()=>{it("should be 'provideTransactionInformation'",()=>{const e=new t.ProvideTransactionInformationCommand({data:new Uint8Array,isFirstChunk:!0});expect(e.name).toBe("provideTransactionInformation")})}),describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const e={data:Uint8Array.from([1,2,3]),isFirstChunk:!0},r=new t.ProvideTransactionInformationCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,38,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const e={data:Uint8Array.from([4,5,6]),isFirstChunk:!1},r=new t.ProvideTransactionInformationCommand(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,38,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},r=new t.ProvideTransactionInformationCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);if((0,o.isSuccessCommandResult)(r))throw new Error("Expected an error");expect(r.error).toBeDefined(),expect(r.error).toBeInstanceOf(s.EthAppCommandError)}),it("should return a success result if the response status code is valid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},r=new t.ProvideTransactionInformationCommand({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);if((0,o.isSuccessCommandResult)(r))expect(r.data).toBeUndefined();else throw new Error("Expected a success result")})})});
|
|
2
2
|
//# sourceMappingURL=ProvideTransactionInformationCommand.test.js.map
|
package/lib/cjs/internal/app-binder/command/ProvideTransactionInformationCommand.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTransactionInformationCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideTransactionInformationCommand,\n type ProvideTransactionInformationCommandArgs,\n} from \"./ProvideTransactionInformationCommand\";\n\ndescribe(\"ProvideTransactionInformationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideTransactionInformationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x26, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideTransactionInformationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x26, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,kDAEP,SAAS,uCAAwC,IAAM,CACrD,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAiD,CACrD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,uCAAqCD,CAAI,EACxC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAAiD,CACrD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,EAChB,EAIMC,EADU,IAAI,uCAAqCD,CAAI,EACxC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,uCAAqC,CACvD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMC,EAJU,IAAI,uCAAqC,CACvD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
-
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideTransactionInformationCommand", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideTransactionInformationCommand,\n type ProvideTransactionInformationCommandArgs,\n} from \"./ProvideTransactionInformationCommand\";\n\ndescribe(\"ProvideTransactionInformationCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideTransactionInformation'\", () => {\n const command = new ProvideTransactionInformationCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n });\n expect(command.name).toBe(\"provideTransactionInformation\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideTransactionInformationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x26, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideTransactionInformationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x26, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideTransactionInformationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAGO,kDAEP,SAAS,uCAAwC,IAAM,CACrD,SAAS,OAAQ,IAAM,CACrB,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAU,IAAI,uCAAqC,CACvD,KAAM,IAAI,WACV,aAAc,EAChB,CAAC,EACD,OAAOA,EAAQ,IAAI,EAAE,KAAK,+BAA+B,CAC3D,CAAC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,uCAAqC,CACvD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,EAChB,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideTransactionInformationCommand", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(e,r)=>{for(var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(e,r)=>{for(var d in r)s(e,d,{get:r[d],enumerable:!0})},C=(e,r,d,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of i(r))!l.call(e,o)&&o!==d&&s(e,o,{get:()=>r[o],enumerable:!(m=u(r,o))||m.enumerable});return e};var E=e=>C(s({},"__esModule",{value:!0}),e);var h={};A(h,{PAYLOAD_LENGTH_BYTES:()=>y,ProvideTrustedNameCommand:()=>g});module.exports=E(h);var t=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),n=require("purify-ts"),a=require("./utils/ethAppErrors");const y=2;class g{constructor(r){this.args=r}name="provideTrustedName";errorHelper=new p.CommandErrorHelper(a.ETH_APP_ERRORS,a.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:34,p1:this.args.isFirstChunk?1:0,p2:0};return new t.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return n.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,t.CommandResultFactory)({data:void 0}))}}0&&(module.exports={PAYLOAD_LENGTH_BYTES,ProvideTrustedNameCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideTrustedNameCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTrustedNameCommand.ts"],
|
|
4
|
-
"sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-trusted-name\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTrustedNameCommandArgs = {\n data: Uint8Array;\n isFirstChunk: boolean;\n};\n\n/**\n * The length of the payload will take 2 bytes in the APDU.\n */\nexport const PAYLOAD_LENGTH_BYTES = 2;\n\n/**\n * The command that provides a chunk of the trusted name to the device.\n */\nexport class ProvideTrustedNameCommand\n implements Command<void, ProvideTrustedNameCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideTrustedNameCommandArgs) {}\n\n getApdu(): Apdu {\n const apduBuilderArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x22,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(apduBuilderArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,8BAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAUA,MAAMN,EAAuB,EAK7B,MAAMC,CAEb,
|
|
4
|
+
"sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-trusted-name\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideTrustedNameCommandArgs = {\n data: Uint8Array;\n isFirstChunk: boolean;\n};\n\n/**\n * The length of the payload will take 2 bytes in the APDU.\n */\nexport const PAYLOAD_LENGTH_BYTES = 2;\n\n/**\n * The command that provides a chunk of the trusted name to the device.\n */\nexport class ProvideTrustedNameCommand\n implements Command<void, ProvideTrustedNameCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideTrustedName\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideTrustedNameCommandArgs) {}\n\n getApdu(): Apdu {\n const apduBuilderArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x22,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(apduBuilderArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,8BAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAUA,MAAMN,EAAuB,EAK7B,MAAMC,CAEb,CAOE,YAA6BM,EAAqC,CAArC,UAAAA,CAAsC,CAN1D,KAAO,qBACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAIA,SAAgB,CACd,MAAMC,EAAmC,CACvC,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,CACN,EAEA,OAAO,IAAI,cAAYA,CAAe,EACnC,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideTrustedNameCommand_exports", "__export", "PAYLOAD_LENGTH_BYTES", "ProvideTrustedNameCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "apduBuilderArgs", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("@ledgerhq/device-management-kit"),t=require("./ProvideTrustedNameCommand");const n=Uint8Array.from([224,34,1,0,8,0,6,76,101,100,103,101,114]);describe("ProvideTrustedNameCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU",()=>{const e={data:n.slice(5),isFirstChunk:!0},s=new t.ProvideTrustedNameCommand(e).getApdu();expect(s.getRawApdu()).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Buffer.from([]),statusCode:Buffer.from([106,128])},s=new t.ProvideTrustedNameCommand({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect((0,r.isSuccessCommandResult)(s)).toBe(!1)}),it("should return success if the response status code is correct",()=>{const e={data:Buffer.from([]),statusCode:Buffer.from([144,0])},s=new t.ProvideTrustedNameCommand({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect((0,r.isSuccessCommandResult)(s)).toBe(!0)})})});
|
|
1
|
+
"use strict";var r=require("@ledgerhq/device-management-kit"),t=require("./ProvideTrustedNameCommand");const n=Uint8Array.from([224,34,1,0,8,0,6,76,101,100,103,101,114]);describe("ProvideTrustedNameCommand",()=>{describe("name",()=>{it("should be 'provideTrustedName'",()=>{const e=new t.ProvideTrustedNameCommand({data:new Uint8Array,isFirstChunk:!0});expect(e.name).toBe("provideTrustedName")})}),describe("getApdu",()=>{it("should return the raw APDU",()=>{const e={data:n.slice(5),isFirstChunk:!0},s=new t.ProvideTrustedNameCommand(e).getApdu();expect(s.getRawApdu()).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Buffer.from([]),statusCode:Buffer.from([106,128])},s=new t.ProvideTrustedNameCommand({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect((0,r.isSuccessCommandResult)(s)).toBe(!1)}),it("should return success if the response status code is correct",()=>{const e={data:Buffer.from([]),statusCode:Buffer.from([144,0])},s=new t.ProvideTrustedNameCommand({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect((0,r.isSuccessCommandResult)(s)).toBe(!0)})})});
|
|
2
2
|
//# sourceMappingURL=ProvideTrustedNameCommand.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideTrustedNameCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n ProvideTrustedNameCommand,\n type ProvideTrustedNameCommandArgs,\n} from \"./ProvideTrustedNameCommand\";\n\nconst FIRST_CHUNK_APDU = Uint8Array.from([\n 0xe0, 0x22, 0x01, 0x00, 0x08, 0x00, 0x06, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72,\n]);\n\ndescribe(\"ProvideTrustedNameCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU\", () => {\n // GIVEN\n const args: ProvideTrustedNameCommandArgs = {\n data: FIRST_CHUNK_APDU.slice(5),\n isFirstChunk: true,\n };\n // WHEN\n const command = new ProvideTrustedNameCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(FIRST_CHUNK_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Buffer.from([]),\n statusCode: Buffer.from([0x6a, 0x80]), // Invalid status code\n };\n // WHEN\n const command = new ProvideTrustedNameCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should return success if the response status code is correct\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Buffer.from([]),\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n };\n // WHEN\n const command = new ProvideTrustedNameCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAGO,uCAEP,MAAMC,EAAmB,WAAW,KAAK,CACvC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAC1E,CAAC,EAED,SAAS,4BAA6B,IAAM,CAC1C,SAAS,UAAW,IAAM,CACxB,GAAG,6BAA8B,IAAM,CAErC,MAAMC,EAAsC,CAC1C,
|
|
6
|
-
"names": ["import_device_management_kit", "import_ProvideTrustedNameCommand", "FIRST_CHUNK_APDU", "args", "apdu", "response", "result"]
|
|
4
|
+
"sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n ProvideTrustedNameCommand,\n type ProvideTrustedNameCommandArgs,\n} from \"./ProvideTrustedNameCommand\";\n\nconst FIRST_CHUNK_APDU = Uint8Array.from([\n 0xe0, 0x22, 0x01, 0x00, 0x08, 0x00, 0x06, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72,\n]);\n\ndescribe(\"ProvideTrustedNameCommand\", () => {\n describe(\"name\", () => {\n it(\"should be 'provideTrustedName'\", () => {\n const command = new ProvideTrustedNameCommand({\n data: new Uint8Array(),\n isFirstChunk: true,\n });\n expect(command.name).toBe(\"provideTrustedName\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU\", () => {\n // GIVEN\n const args: ProvideTrustedNameCommandArgs = {\n data: FIRST_CHUNK_APDU.slice(5),\n isFirstChunk: true,\n };\n // WHEN\n const command = new ProvideTrustedNameCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(FIRST_CHUNK_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Buffer.from([]),\n statusCode: Buffer.from([0x6a, 0x80]), // Invalid status code\n };\n // WHEN\n const command = new ProvideTrustedNameCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should return success if the response status code is correct\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Buffer.from([]),\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n };\n // WHEN\n const command = new ProvideTrustedNameCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\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,cAAcD,CAAQ,EAE7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_device_management_kit", "import_ProvideTrustedNameCommand", "FIRST_CHUNK_APDU", "command", "args", "apdu", "response", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var d in r)p(e,d,{get:r[d],enumerable:!0})},y=(e,r,d,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of l(r))!u.call(e,o)&&o!==d&&p(e,o,{get:()=>r[o],enumerable:!(s=i(r,o))||s.enumerable});return e};var A=e=>y(p({},"__esModule",{value:!0}),e);var E={};C(E,{ProvideWeb3CheckCommand:()=>h});module.exports=A(E);var a=require("@ledgerhq/device-management-kit"),m=require("@ledgerhq/signer-utils"),n=require("purify-ts"),t=require("../../app-binder/command/utils/ethAppErrors");class h{constructor(r){this.args=r}name="provideWeb3Check";errorHelper=new m.CommandErrorHelper(t.ETH_APP_ERRORS,t.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:50,p1:0,p2:this.args.isFirstChunk?1:0};return new a.ApduBuilder(r).addBufferToData(this.args.payload).build()}parseResponse(r){return n.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,a.CommandResultFactory)({data:void 0}))}}0&&(module.exports={ProvideWeb3CheckCommand});
|
|
2
2
|
//# sourceMappingURL=ProvideWeb3CheckCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/ProvideWeb3CheckCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nexport type ProvideWeb3CheckCommandArgs = {\n readonly payload: Uint8Array;\n readonly isFirstChunk: boolean;\n};\n\n/**\n * The command that provides a chunk of the trusted name to the device.\n */\nexport class ProvideWeb3CheckCommand\n implements Command<void, ProvideWeb3CheckCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideWeb3CheckCommandArgs) {}\n\n getApdu(): Apdu {\n const apduBuilderArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x32,\n p1: 0x00,\n p2: this.args.isFirstChunk ? 0x01 : 0x00,\n };\n\n return new ApduBuilder(apduBuilderArgs)\n .addBufferToData(this.args.payload)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,2DAUA,MAAML,CAEb,
|
|
4
|
+
"sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nexport type ProvideWeb3CheckCommandArgs = {\n readonly payload: Uint8Array;\n readonly isFirstChunk: boolean;\n};\n\n/**\n * The command that provides a chunk of the trusted name to the device.\n */\nexport class ProvideWeb3CheckCommand\n implements Command<void, ProvideWeb3CheckCommandArgs, EthErrorCodes>\n{\n readonly name = \"provideWeb3Check\";\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideWeb3CheckCommandArgs) {}\n\n getApdu(): Apdu {\n const apduBuilderArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x32,\n p1: 0x00,\n p2: this.args.isFirstChunk ? 0x01 : 0x00,\n };\n\n return new ApduBuilder(apduBuilderArgs)\n .addBufferToData(this.args.payload)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,2DAUA,MAAML,CAEb,CAOE,YAA6BM,EAAmC,CAAnC,UAAAA,CAAoC,CANxD,KAAO,mBACC,YAAc,IAAI,qBACjC,iBACA,2BACF,EAIA,SAAgB,CACd,MAAMC,EAAmC,CACvC,IAAK,IACL,IAAK,GACL,GAAI,EACJ,GAAI,KAAK,KAAK,aAAe,EAAO,CACtC,EAEA,OAAO,IAAI,cAAYA,CAAe,EACnC,gBAAgB,KAAK,KAAK,OAAO,EACjC,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
|
|
6
6
|
"names": ["ProvideWeb3CheckCommand_exports", "__export", "ProvideWeb3CheckCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "apduBuilderArgs", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("@ledgerhq/device-management-kit"),a=require("../../app-binder/command/ProvideWeb3CheckCommand");describe("ProvideWeb3CheckCommand",()=>{describe("name",()=>{it("should be 'provideWeb3Check'",()=>{const r=new a.ProvideWeb3CheckCommand({payload:new Uint8Array,isFirstChunk:!0});expect(r.name).toBe("provideWeb3Check")})}),describe("getApdu",()=>{it("should return the raw APDU",()=>{const r={payload:(0,t.hexaStringToBuffer)("0x010203"),isFirstChunk:!0},e=new a.ProvideWeb3CheckCommand(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,50,0,1,3,1,2,3]))}),it("should return the raw APDU for next chunk",()=>{const r={payload:(0,t.hexaStringToBuffer)("0x010203"),isFirstChunk:!1},e=new a.ProvideWeb3CheckCommand(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,50,0,0,3,1,2,3]))})}),describe("parseResponse",()=>{it("should return undefined",()=>{const r={payload:(0,t.hexaStringToBuffer)("0x010203"),isFirstChunk:!0},s={statusCode:Uint8Array.from([144,0]),data:new Uint8Array([])},e=new a.ProvideWeb3CheckCommand(r).parseResponse(s);(0,t.isSuccessCommandResult)(e)?expect(e.data).toBeUndefined():assert.fail("Expected a success")}),it("should return an error if the device is locked",()=>{const r={payload:(0,t.hexaStringToBuffer)("0x010203"),isFirstChunk:!0},s={statusCode:Uint8Array.from([85,21]),data:new Uint8Array},e=new a.ProvideWeb3CheckCommand(r).parseResponse(s);(0,t.isSuccessCommandResult)(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"5515",message:"Device is locked."}))}),it("should return an error if data is invalid",()=>{const r={payload:(0,t.hexaStringToBuffer)("0x010203"),isFirstChunk:!0},s={statusCode:Uint8Array.from([106,128]),data:new Uint8Array},e=new a.ProvideWeb3CheckCommand(r).parseResponse(s);(0,t.isSuccessCommandResult)(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"6a80",message:"Invalid data"}))})})});
|
|
2
2
|
//# sourceMappingURL=ProvideWeb3CheckCommand.test.js.map
|