Skip to content

Commit

Permalink
Merge pull request #10 from provenance-io/aj/MsgAddMarkerRequest
Browse files Browse the repository at this point in the history
Custom unpack for MsgAddMarkerRequest
  • Loading branch information
webbushka authored Jul 21, 2022
2 parents f487e0d + 8650812 commit c01289e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm ci
- name: Install dependencies
run: npm ci

- name: semantic-release
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/dry-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: dry-run

on:
push:
branches:
- '**'
- '!main'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci

- name: Test build
run: npm run build
15 changes: 15 additions & 0 deletions src/services/message-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import {
BroadcastMode,
BroadcastTxRequest,
} from '../proto/cosmos/tx/v1beta1/service_pb';
import { MsgAddMarkerRequest } from 'proto/provenance/marker/v1/tx_pb';
import { MarkerStatus, MarkerType } from 'proto/provenance/marker/v1/marker_pb';

export type GenericDisplay = { [key: string]: any };

Expand Down Expand Up @@ -326,6 +328,19 @@ export const unpackDisplayObjectFromWalletMessage = (
amount: Number(coin.getAmount()),
})),
};
case 'provenance.marker.v1.MsgAddMarkerRequest':
const getKey = (map: { [key: string]: any }, val: any) =>
Object.keys(map).find((key) => map[key] === val);

return {
typeName: 'MsgAddMarkerRequest',
...(message as MsgAddMarkerRequest).toObject(),
markerType: getKey(
MarkerType,
(message as MsgAddMarkerRequest).getMarkerType()
),
status: getKey(MarkerStatus, (message as MsgAddMarkerRequest).getStatus()),
};
default:
return {
typeName: 'MsgGeneric',
Expand Down

0 comments on commit c01289e

Please sign in to comment.