Skip to content

Commit

Permalink
smitch to webview provider lib
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Aug 3, 2024
1 parent c5d1873 commit a1a3eba
Show file tree
Hide file tree
Showing 27 changed files with 741 additions and 1,134 deletions.
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [0.19.0](https://github.com/elven-js/elven.js/releases/tag/v0.19.0) (2024-08-03)
- replace custom webview provider implementation with the dedicated library (xPortal)
- update dependencies

### [0.18.0](https://github.com/elven-js/elven.js/releases/tag/v0.18.0) (2024-04-28)
- switch to SDK v13
- breaking: `SmartContract` is no longer exported, use `SmartContractTransactionsFactory`
Expand Down
60 changes: 30 additions & 30 deletions build/elven.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/types/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export declare class ElvenJS {
* Main storage
*/
static storage: {
get(key?: string | undefined): any;
get(key?: string): any;
set(key: string, value: string | number): void;
clear(): void;
};
Expand Down
1 change: 0 additions & 1 deletion build/types/network-provider.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="node" />
import { Address } from '@multiversx/sdk-core/out/address';
import { TransactionStatus } from '@multiversx/sdk-network-providers/out/transactionStatus';
import { TransactionReceipt } from '@multiversx/sdk-network-providers/out/transactionReceipt';
Expand Down
2 changes: 1 addition & 1 deletion build/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ExtensionProvider } from '@multiversx/sdk-extension-provider/out/extens
import { Transaction } from '@multiversx/sdk-core/out/transaction';
import { WalletConnectV2Provider } from '@multiversx/sdk-wallet-connect-provider/out/walletConnectV2Provider';
import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider';
import { WebviewProvider } from './webview-provider/webview-provider';
import { WebviewProvider } from '@multiversx/sdk-webview-provider';
import { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts';
import { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse';
export interface InitOptions {
Expand Down
2 changes: 1 addition & 1 deletion build/types/utils/amount.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type AmountArgs = {
* @param decimals
* @returns bigInt
*/
export declare const parseAmount: ({ amount, decimals, }: Omit<AmountArgs, 'rounding'>) => bigint;
export declare const parseAmount: ({ amount, decimals, }: Omit<AmountArgs, "rounding">) => bigint;
/**
* Formats the amount from string (bigInt)
* @param amount
Expand Down
1 change: 0 additions & 1 deletion build/types/webview-provider/base64-utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
* It will probably be replaced with separate library in the future
*/
export declare function isStringBase64(str: string): boolean;
export declare function encodeToBase64(string: string): string;
export declare function decodeBase64(string: string): string;
28 changes: 0 additions & 28 deletions build/types/webview-provider/request-methods.d.ts

This file was deleted.

56 changes: 0 additions & 56 deletions build/types/webview-provider/types.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions build/types/webview-provider/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
* Based on sdk-dapp webview provider implementation
* It will probably be replaced with separate library in the future
*/
import { PlatformsEnum } from './types';
export declare const detectCurrentPlatform: () => PlatformsEnum.ios | PlatformsEnum.reactNative | PlatformsEnum.web;
export declare const getTargetOrigin: () => string;
export declare const isString: (x: any) => boolean;
13 changes: 0 additions & 13 deletions build/types/webview-provider/webview-provider.d.ts

This file was deleted.

69 changes: 69 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* eslint-disable no-redeclare */
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...compat.extends(
'plugin:prettier/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
ElvenJS: 'readonly',
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'commonjs',
},

rules: {
'no-var': 'error',
'prefer-const': 'error',
'no-use-before-define': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-nested-ternary': 'error',

'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],

'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-unused-vars': 'off',

'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
},
],
},
},
];
60 changes: 30 additions & 30 deletions example/elven.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ <h3>Other demos:</h3>
// In case of browser extension provider and xPortal you can also get it from ElvenJS.signMessage return
document.getElementById('button-sign-message').addEventListener('click', async () => {
try {
await ElvenJS.signMessage('Elven Family is awesome!');
await ElvenJS.signMessage('ElvenFamily');
} catch (e) {
throw new Error(e?.message);
}
});
</script>
</body>

</html>
</html>
Loading

0 comments on commit a1a3eba

Please sign in to comment.