-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into jerryliu-sc-77755-k…
…resus-hotfix
- Loading branch information
Showing
46 changed files
with
494 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
# (Thu May 18 2023) | ||
|
||
#### 🐛 Bug Fix | ||
|
||
- `@magic-sdk/[email protected]` | ||
- Add conditional for `useInstead` of `loginWithMagicLink` `createDeprecationWarning` call [#518](https://github.com/magiclabs/magic-js/pull/518) ([@Ariflo](https://github.com/Ariflo)) | ||
|
||
#### Authors: 1 | ||
|
||
- Arian Flores ([@Ariflo](https://github.com/Ariflo)) | ||
|
||
--- | ||
|
||
# (Thu May 18 2023) | ||
|
||
#### 🚀 Enhancement | ||
|
||
- `@magic-ext/[email protected]` | ||
- Add @magic-ext/aptos package [#515](https://github.com/magiclabs/magic-js/pull/515) ([@octave08](https://github.com/octave08)) | ||
|
||
#### Authors: 1 | ||
|
||
- Jay Hwang ([@octave08](https://github.com/octave08)) | ||
|
||
--- | ||
|
||
# (Thu May 11 2023) | ||
|
||
#### 🐛 Bug Fix | ||
|
||
- `@magic-sdk/[email protected]` | ||
- [FIX]: updates for Sardines new API spec [#511](https://github.com/magiclabs/magic-js/pull/511) ([@bengriffin1](https://github.com/bengriffin1)) | ||
- `@magic-sdk/[email protected]` | ||
- update Webview version in README [#510](https://github.com/magiclabs/magic-js/pull/510) ([@am-hernandez](https://github.com/am-hernandez)) | ||
|
||
#### Authors: 2 | ||
|
||
- A.M. Hernandez ([@am-hernandez](https://github.com/am-hernandez)) | ||
- Ben Griffin ([@bengriffin1](https://github.com/bengriffin1)) | ||
|
||
--- | ||
|
||
# (Wed May 10 2023) | ||
|
||
#### 🚀 Enhancement | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/algorand", | ||
"version": "12.1.2", | ||
"version": "12.1.4", | ||
"description": "magic algorand extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
/coverage | ||
/dist | ||
/.eslintrc.js | ||
/jest.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: ['../../../.eslintrc.js'], | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
'*.{ts,tsx}': | ||
- eslint --fix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../../.prettierrc.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# v0.2.0 (Thu May 18 2023) | ||
|
||
#### 🚀 Enhancement | ||
|
||
- Add @magic-ext/aptos package [#515](https://github.com/magiclabs/magic-js/pull/515) ([@octave08](https://github.com/octave08)) | ||
|
||
#### 🐛 Bug Fix | ||
|
||
- Update years of LICENSE ([@octave08](https://github.com/octave08)) | ||
- Simplify error handling ([@octave08](https://github.com/octave08)) | ||
- Refactor signTransation with safe-call ([@octave08](https://github.com/octave08)) | ||
- Remove CHANGELOG.md ([@octave08](https://github.com/octave08)) | ||
- Update error message ([@octave08](https://github.com/octave08)) | ||
- Reset version for @magic-ext/aptos ([@octave08](https://github.com/octave08)) | ||
- Serialize transaction ([@octave08](https://github.com/octave08)) | ||
- Add signTransaction method ([@octave08](https://github.com/octave08)) | ||
- Add chainId to AptosConfig ([@octave08](https://github.com/octave08)) | ||
- clean code ([@octave08](https://github.com/octave08)) | ||
- feat: add more configs ([@octave08](https://github.com/octave08)) | ||
- Init @magic-ext/aptos package ([@octave08](https://github.com/octave08)) | ||
|
||
#### Authors: 1 | ||
|
||
- Jay Hwang ([@octave08](https://github.com/octave08)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-present Magic Labs, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@magic-ext/aptos", | ||
"version": "0.2.1", | ||
"description": "magic aptos extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/magiclabs/magic-js" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"target": "neutral", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/es/index.js", | ||
"types": "./dist/types/index.d.ts", | ||
"jsdelivr": "./dist/extension.js", | ||
"react-native": "./dist/react-native/index.native.js", | ||
"exports": { | ||
"import": "./dist/es/index.mjs", | ||
"require": "./dist/cjs/index.js" | ||
}, | ||
"externals": { | ||
"include": [ | ||
"@magic-sdk/commons" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.4", | ||
"aptos": "^1.8.5" | ||
}, | ||
"peerDependencies": { | ||
"aptos": "^1.8.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { AptosExtension } from './index'; | ||
|
||
export default AptosExtension; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Extension } from '@magic-sdk/commons'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import { BCS } from 'aptos'; | ||
import { AptosConfig, ConfigType, AptosPayloadMethod } from './type'; | ||
|
||
const getDefaultConfig = (nodeUrl: string) => { | ||
if (nodeUrl === 'https://fullnode.mainnet.aptoslabs.com') { | ||
return { | ||
rpcUrl: 'https://aptos-mainnet-rpc.allthatnode.com/v1', | ||
network: 'mainnet', | ||
chainId: 1, | ||
}; | ||
} | ||
|
||
if (nodeUrl === 'https://fullnode.testnet.aptoslabs.com') { | ||
return { | ||
rpcUrl: 'https://aptos-testnet-rpc.allthatnode.com/v1', | ||
network: 'testnet', | ||
chainId: 2, | ||
}; | ||
} | ||
|
||
if (nodeUrl === 'https://fullnode.devnet.aptoslabs.com') { | ||
return { | ||
rpcUrl: '', | ||
network: 'devnet', | ||
chainId: 54, | ||
}; | ||
} | ||
|
||
throw new Error('Invalid nodeUrl'); | ||
}; | ||
|
||
export class AptosExtension extends Extension.Internal<'aptos', any> { | ||
name = 'aptos' as const; | ||
config: ConfigType; | ||
|
||
constructor(public aptosConfig: AptosConfig) { | ||
super(); | ||
|
||
const defaultConfig = getDefaultConfig(aptosConfig.nodeUrl); | ||
|
||
this.config = { | ||
chainType: 'APTOS', | ||
nodeUrl: aptosConfig.nodeUrl, | ||
rpcUrl: aptosConfig.rpcUrl ?? defaultConfig.rpcUrl, | ||
network: aptosConfig.network ?? defaultConfig.network, | ||
chainId: aptosConfig.chainId ?? defaultConfig.chainId, | ||
}; | ||
} | ||
|
||
private serializeRawTranasction = (rawTranasction: any) => { | ||
try { | ||
const s = new BCS.Serializer(); | ||
rawTranasction.serialize(s); | ||
return s.getBytes(); | ||
} catch (e) { | ||
console.error( | ||
'Invalid transaction. Please generate transaction with generateTransaction method of aptos sdk.', | ||
e, | ||
); | ||
throw e; | ||
} | ||
}; | ||
|
||
getAccount = () => { | ||
return this.request<string>(this.utils.createJsonRpcRequestPayload(AptosPayloadMethod.AptosGetAccount, [])); | ||
}; | ||
|
||
signTransaction = (rawTransaction: any) => { | ||
const serialized = this.serializeRawTranasction(rawTransaction); | ||
return this.request<Uint8Array>( | ||
this.utils.createJsonRpcRequestPayload(AptosPayloadMethod.AptosSignTransaction, [serialized]), | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export interface AptosConfig { | ||
nodeUrl: string; | ||
rpcUrl?: string; | ||
network?: string; | ||
chainId?: number; | ||
} | ||
|
||
export interface ConfigType { | ||
rpcUrl: string; | ||
nodeUrl: string; | ||
network: string; | ||
chainType: string; | ||
chainId: number; | ||
} | ||
|
||
export enum AptosPayloadMethod { | ||
AptosGetAccount = 'aptos_getAccount', | ||
AptosSignTransaction = 'aptos_signTransaction', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.settings.json", | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/auth", | ||
"version": "0.2.2", | ||
"version": "0.2.4", | ||
"description": "Magic SDK Extension for the Auth module", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/avalanche", | ||
"version": "12.1.2", | ||
"version": "12.1.4", | ||
"description": "magic avalanche extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/bitcoin", | ||
"version": "12.1.2", | ||
"version": "12.1.4", | ||
"description": "magic bitcoin extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -27,6 +27,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/conflux", | ||
"version": "10.1.2", | ||
"version": "10.1.4", | ||
"description": "magic conflux extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/cosmos", | ||
"version": "12.1.2", | ||
"version": "12.1.4", | ||
"description": "magic cosmos extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/ed25519", | ||
"version": "8.1.2", | ||
"version": "8.1.4", | ||
"description": "magic ed25519 extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -28,6 +28,6 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2" | ||
"@magic-sdk/commons": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@magic-ext/flow", | ||
"version": "12.1.2", | ||
"version": "12.1.4", | ||
"description": "magic flow extension", | ||
"author": "Magic <[email protected]> (https://magic.link/)", | ||
"license": "MIT", | ||
|
@@ -27,7 +27,7 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^13.1.2", | ||
"@magic-sdk/commons": "^13.1.4", | ||
"@onflow/fcl": "0.0.41", | ||
"@onflow/types": "0.0.3" | ||
}, | ||
|
Oops, something went wrong.