diff --git a/.github/workflows/submitBeta.yml b/.github/workflows/submitBeta.yml new file mode 100644 index 0000000000..54627a61f9 --- /dev/null +++ b/.github/workflows/submitBeta.yml @@ -0,0 +1,122 @@ +name: Beta Deployment +on: + workflow_dispatch: + inputs: + release: + description: Release Number + default: "2.0.0" + required: true + version: + description: Beta version + default: "0" + required: true +jobs: + bump-version: + name: Bump Package Version and Submit Extension + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: release/${{ github.event.inputs.release }} + - name: Update manifest.json name + uses: jossef/action-set-json-field@6e6d7e639f24b3955ef682815317b5613ac6ca12 #v1 + with: + file: ./extension/public/static/manifest.json + field: name + value: Freighter BETA + - name: Update manifest.json version_name + uses: jossef/action-set-json-field@6e6d7e639f24b3955ef682815317b5613ac6ca12 #v1 + with: + file: ./extension/public/static/manifest.json + field: version_name + value: ${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }} + - name: Update manifest.json version for Chrome + uses: jossef/action-set-json-field@6e6d7e639f24b3955ef682815317b5613ac6ca12 #v1 + with: + file: ./extension/public/static/manifest.json + field: version + value: ${{ github.event.inputs.release }}.${{ github.event.inputs.version }} + - name: Build extension + uses: actions/setup-node@v1 + with: + node-version: "12" + - run: yarn install && yarn build:freighter-api && yarn build:extension:production + - name: Install zip + uses: montudor/action-zip@c25e01d7489d0274569440a2f0281b4569df16bc #v0.1.1 + - name: Zip extension build + run: zip -qq -r ./build.zip * + working-directory: ./extension/build + # - name: Create GitHub Release + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # tag_name: ${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }} + # release_name: ${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }} + # body: ${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }} + # draft: false + # prerelease: true + # - name: Upload Release Asset + # id: upload-release-asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ./extension/build/build.zip + # asset_name: build-${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }}.zip + # asset_content_type: application/zip + # - name: Update built manifest.json version for Firefox + # uses: jossef/action-set-json-field@6e6d7e639f24b3955ef682815317b5613ac6ca12 #v1 + # with: + # file: ./extension/build/manifest.json + # field: version + # value: ${{ github.event.inputs.release }}beta${{ github.event.inputs.version }} + # - name: Build xpi for Firefox + # id: firefox-build + # uses: kewisch/action-web-ext@20ee9837f7352d4770b93868a0aa59292eb43d8c #v1 + # with: + # cmd: build + # source: ./extension/build + # filename: ${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }}.xpi + # - name: Sign extension for Firefox + # id: firefox-sign + # uses: kewisch/action-web-ext@20ee9837f7352d4770b93868a0aa59292eb43d8c #v1 + # with: + # cmd: sign + # source: ${{ steps.firefox-build.outputs.target }} + # channel: unlisted + # apiKey: ${{ secrets.AMO_SIGN_KEY }} + # apiSecret: ${{ secrets.AMO_SIGN_SECRET }} + # timeout: 1800000 + # - name: Upload Firefox xpi + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ${{ steps.firefox-sign.outputs.target }} + # asset_name: ${{ github.event.inputs.release }}-${{ github.event.inputs.version }}.xpi + # asset_content_type: application/xpi + - name: Submit extension to Chrome + uses: mnao305/chrome-extension-upload@4061bc03cde1feaec8b153654495c88857fb76c3 #v2.2.0 + with: + file-path: ./extension/build/build.zip + extension-id: "kcigoalhjaghfigblagmiopnefgenfjb" + client-id: ${{ secrets.EXTENSION_CLIENT_ID_V2 }} + refresh-token: ${{ secrets.EXTENSION_REFRESH_TOKEN_V2 }} + publish: true + publish-target: trustedTesters + - name: Slack Notification + uses: rtCamp/action-slack-notify@4d4ce0d91186ffe6633a8cda645146d38e88228b #v2 + env: + MSG_MINIMAL: true + SLACK_CHANNEL: proj-freighter + SLACK_COLOR: "#391EDA" + SLACK_ICON: https://github.com/stellar/freighter/blob/master/docs/static/images/logo.png?size=48 + SLACK_MESSAGE: "https://github.com/stellar/freighter/releases/tag/{{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }}" + SLACK_TITLE: Freighter v${{ github.event.inputs.release }}-beta.${{ github.event.inputs.version }} has been submitted for testing! + SLACK_USERNAME: Freighter Administrative Assistant + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/submitExtension.yml b/.github/workflows/submitProduction.yml similarity index 99% rename from .github/workflows/submitExtension.yml rename to .github/workflows/submitProduction.yml index 30436a4a52..b5aaefd7b3 100644 --- a/.github/workflows/submitExtension.yml +++ b/.github/workflows/submitProduction.yml @@ -1,4 +1,4 @@ -name: Submit extension to browser store +name: Production Deployment on: workflow_dispatch: inputs: diff --git a/docs/docs/guide/usingFreighterBrowser.md b/docs/docs/guide/usingFreighterBrowser.md index ad80ec6f62..1b1e733a8c 100644 --- a/docs/docs/guide/usingFreighterBrowser.md +++ b/docs/docs/guide/usingFreighterBrowser.md @@ -65,7 +65,7 @@ const retrievePublicKey = async () => { return publicKey; }; -const result = retrievePublicKey(); +const result = await retrievePublicKey(); ``` ### getNetwork @@ -96,7 +96,7 @@ const retrieveNetwork = async () => { return network; }; -const result = retrieveNetwork(); +const result = await retrieveNetwork(); ``` ### signTransaction @@ -135,7 +135,7 @@ const retrievePublicKey = async () => { return publicKey; }; -const retrievedPublicKey = retrievePublicKey(); +const retrievedPublicKey = await retrievePublicKey(); const userSignTransaction = async (xdr: string, network: string) => { let signedTransaction = ""; @@ -155,7 +155,7 @@ const userSignTransaction = async (xdr: string, network: string) => { }; const xdr = ""; // replace this with an xdr string of the transaction you want to sign -const userSignedTransaction = userSignTransaction(xdr, "TESTNET"); +const userSignedTransaction = await userSignTransaction(xdr, "TESTNET"); ``` freighter-api will return a signed transaction xdr. Below is an example of how you might submit this signed transaction to Horizon using `stellar-sdk` (https://github.com/stellar/js-stellar-sdk): @@ -180,7 +180,7 @@ const userSignTransaction = async (xdr: string, network: string) => { const xdr = ""; // replace this with an xdr string of the transaction you want to sign -const userSignedTransaction = userSignTransaction(xdr, "TESTNET"); +const userSignedTransaction = await userSignTransaction(xdr, "TESTNET"); const SERVER_URL = "https://horizon-testnet.stellar.org"; diff --git a/extension/package.json b/extension/package.json index 6b79517e0e..b484f2b925 100755 --- a/extension/package.json +++ b/extension/package.json @@ -1,6 +1,6 @@ { "name": "extension", - "version": "2.0.0", + "version": "2.1.2", "license": "Apache-2.0", "prettier": "@stellar/prettier-config", "scripts": { diff --git a/extension/public/static/manifest.json b/extension/public/static/manifest.json index 4f069802ce..4b1af5ef92 100644 --- a/extension/public/static/manifest.json +++ b/extension/public/static/manifest.json @@ -1,7 +1,7 @@ { "name": "Freighter", - "version": "2.0.0", - "version_name": "2.0.0", + "version": "2.1.2", + "version_name": "2.1.2", "description": "Freighter is a non-custodial wallet extension that enables you to sign Stellar transactions via your browser.", "browser_specific_settings": { "gecko": { diff --git a/extension/src/popup/components/manageAssets/ManageAssetRows/index.tsx b/extension/src/popup/components/manageAssets/ManageAssetRows/index.tsx index 1adf9c12fc..67e4a61df2 100644 --- a/extension/src/popup/components/manageAssets/ManageAssetRows/index.tsx +++ b/extension/src/popup/components/manageAssets/ManageAssetRows/index.tsx @@ -8,7 +8,12 @@ import { AppDispatch } from "popup/App"; import { emitMetric } from "helpers/metrics"; import { navigateTo } from "popup/helpers/navigate"; -import { getCanonicalFromAsset, formatDomain } from "helpers/stellar"; +import { useNetworkFees } from "popup/helpers/useNetworkFees"; +import { + formatDomain, + getCanonicalFromAsset, + xlmToStroop, +} from "helpers/stellar"; import { PillButton } from "popup/basics/buttons/PillButton"; @@ -53,6 +58,7 @@ export const ManageAssetRows = ({ } = useSelector(transactionSubmissionSelector); const [assetSubmitting, setAssetSubmitting] = useState(""); const dispatch: AppDispatch = useDispatch(); + const { recommendedFee } = useNetworkFees(); const server = new StellarSdk.Server(networkDetails.networkUrl); @@ -68,7 +74,7 @@ export const ManageAssetRows = ({ setAssetSubmitting(canonicalAsset); const transactionXDR = new StellarSdk.TransactionBuilder(sourceAccount, { - fee: StellarSdk.BASE_FEE, + fee: xlmToStroop(recommendedFee).toString(), networkPassphrase: networkDetails.networkPassphrase, }) .addOperation( diff --git a/extension/src/popup/helpers/useNetworkFees.ts b/extension/src/popup/helpers/useNetworkFees.ts index 538c5657a5..9800333128 100644 --- a/extension/src/popup/helpers/useNetworkFees.ts +++ b/extension/src/popup/helpers/useNetworkFees.ts @@ -23,10 +23,10 @@ export const useNetworkFees = () => { try { const server = new StellarSdk.Server(networkUrl); const { - fee_charged: feeCharged, + max_fee: maxFee, ledger_capacity_usage: ledgerCapacityUsage, } = await server.feeStats(); - setRecommendedFee(stroopToXlm(feeCharged.mode).toString()); + setRecommendedFee(stroopToXlm(maxFee.mode).toString()); if (ledgerCapacityUsage > 0.5 && ledgerCapacityUsage <= 0.75) { setNetworkCongestion(NetworkCongestion.MEDIUM); } else if (ledgerCapacityUsage > 0.75) { diff --git a/extension/src/popup/views/Settings/index.tsx b/extension/src/popup/views/Settings/index.tsx index e20270eb7c..a81d618f7d 100644 --- a/extension/src/popup/views/Settings/index.tsx +++ b/extension/src/popup/views/Settings/index.tsx @@ -31,7 +31,7 @@ export const Settings = () => { Settings
{/* TODO: Make this dynamic */} - v2.0.0 + v2.1.2