Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(station)!: multi chain support #374

Merged
merged 24 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fb2e49f
feat(station)!: add asset repository (#335)
olaszakos Sep 3, 2024
f2f84d6
feat(station): asset crud operations (#340)
olaszakos Sep 12, 2024
7e9731b
feat(wallet): add asset managament UI (#352)
olaszakos Sep 23, 2024
8c31320
feat(station)!: refactor asset related data models (#357)
olaszakos Oct 4, 2024
b92d550
feat(station): add ICRC-1 support (#378)
olaszakos Oct 10, 2024
61af39a
Merge branch 'main' into multi-chain-support
olaszakos Oct 10, 2024
a1b8d78
fix merge errors
olaszakos Oct 10, 2024
ba10edc
feat(wallet): update frontend with new asset account data models (#388)
olaszakos Oct 24, 2024
e9e81d3
Merge branch 'main' into multi-chain-support
olaszakos Oct 24, 2024
b983c2b
fix type error
olaszakos Oct 24, 2024
b98a528
Merge branch 'main' into multi-chain-support
olaszakos Oct 31, 2024
ffbfad6
feat(station)!: migrate to new model (#408)
olaszakos Oct 31, 2024
fcb98d1
fix(station): address multi chain review comments (#412)
olaszakos Nov 5, 2024
a9efabc
feat(wallet): multi chain frontend extras (#413)
olaszakos Nov 7, 2024
f1346e4
fix(station): hardening validation (#420)
olaszakos Nov 19, 2024
4b15d44
Merge branch 'main' into multi-chain-support
olaszakos Nov 21, 2024
95b91af
Merge branch 'main' into multi-chain-support
olaszakos Nov 21, 2024
6d0a053
fix problems after merge
olaszakos Nov 21, 2024
94cb1d6
persist canbench
olaszakos Nov 21, 2024
f928e12
fix(station): Make DR sync + logging more efficient (#432)
olaszakos Nov 21, 2024
d00177b
perf(station): make concurrent balance queries more efficient (#440)
olaszakos Nov 26, 2024
d118b3d
docs(station): update glossary (#435)
olaszakos Nov 26, 2024
c6bde2f
fix account comment
olaszakos Nov 26, 2024
9c033d6
Merge branch 'main' into multi-chain-support
olaszakos Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ jobs:
name: 'ic-icp-index-canister'
- canister: 'cmc'
name: 'cycles-minting-canister'
- canister: 'icrc1_ledger'
name: 'ic-icrc1-ledger'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
Expand Down
48 changes: 46 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ ic-cdk = "0.16.0"
ic-cdk-macros = "0.16.0"
ic-cdk-timers = "0.9.0"
ic-ledger-types = "0.12.0"
ic-stable-structures = "0.6.4"
ic-stable-structures = "0.6.6"
icrc-ledger-types = "0.1.6"
ic-utils = "0.38"
itertools = "0.13.0"
lazy_static = "1.4.0"
Expand Down
4 changes: 3 additions & 1 deletion apps/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
"@dfinity/agent": "1.4.0",
"@dfinity/auth-client": "1.4.0",
"@dfinity/candid": "1.4.0",
"@dfinity/didc": "0.0.2",
"@dfinity/identity": "1.4.0",
"@dfinity/principal": "1.4.0",
"@dfinity/ledger-icrc": "2.3.3",
"@dfinity/utils": "2.3.1",
"@dfinity/didc": "0.0.2",
"@mdi/font": "7.4.47",
"@mdi/js": "7.4.47",
"buffer": "6.0.3",
Expand Down
20 changes: 20 additions & 0 deletions apps/wallet/src/components/ShortenedAddress.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template>
<TextOverflow
v-if="format === AddressFormat.ICRC1"
:text="address"
:overflow-position="shortenIcrc1Address"
></TextOverflow>

<TextOverflow v-else :text="address" :max-length="32"></TextOverflow>
</template>

<script setup lang="ts">
import { AddressFormat } from '~/types/chain.types';
import TextOverflow from './TextOverflow.vue';
import { shortenIcrc1Address } from '~/utils/asset.utils';

defineProps<{
address: string;
format: AddressFormat | string | undefined;
}>();
</script>
22 changes: 13 additions & 9 deletions apps/wallet/src/components/TextOverflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const props = withDefaults(
text: string;
maxLength?: number;
overflowText?: string;
overflowPosition?: 'start' | 'middle' | 'end';
overflowPosition?: 'start' | 'middle' | 'end' | ((input: string) => string);
}>(),
{
maxLength: 18,
Expand All @@ -40,15 +40,19 @@ const truncatedText = computed(() => {
}`;
}

const overflowLengthStart = Math.ceil(props.overflowText.length / 2);
const overflowLengthEnd = Math.floor(props.overflowText.length / 2);
const start = Math.ceil((props.maxLength - 1) / 2) - overflowLengthStart;
const end = Math.floor((props.maxLength - 1) / 2) - overflowLengthEnd;
if (props.overflowPosition === 'middle') {
const overflowLengthStart = Math.ceil(props.overflowText.length / 2);
const overflowLengthEnd = Math.floor(props.overflowText.length / 2);
const start = Math.ceil((props.maxLength - 1) / 2) - overflowLengthStart;
const end = Math.floor((props.maxLength - 1) / 2) - overflowLengthEnd;

return `${props.text.slice(0, start)}${props.overflowText}${props.text.slice(
props.text.length - end,
props.text.length,
)}`;
return `${props.text.slice(0, start)}${props.overflowText}${props.text.slice(
props.text.length - end,
props.text.length,
)}`;
}

return props.overflowPosition(props.text);
});

const handleCopy = (event: ClipboardEvent): void => {
Expand Down
21 changes: 21 additions & 0 deletions apps/wallet/src/components/accounts/AccountAssetsCell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
{{ assetNames.join(', ') }}
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { useStationStore } from '~/stores/station.store';

const props = defineProps<{
assetIds: string[];
}>();

const station = useStationStore();

const assetNames = computed(() => {
return props.assetIds.map(
id =>
station.configuration.details.supported_assets.find(token => token.id === id)?.symbol || id,
);
});
</script>
4 changes: 2 additions & 2 deletions apps/wallet/src/components/accounts/AccountSetupDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ const saveChangesToExistingAccount = async (accountId: UUID): Promise<Request> =
changes.configs_permission = [
assertAndReturn(wizard.value.permission.configuration, 'update_access'),
];
changes.change_assets = [];

return station.service.editAccount(changes as EditAccountOperationInput);
};

const createNewAccount = async (): Promise<Request> => {
const changes: Partial<AddAccountOperationInput> = {};
changes.assets = assertAndReturn(wizard.value.configuration.assets, 'assets');
changes.name = assertAndReturn(wizard.value.configuration.name, 'name');
changes.blockchain = assertAndReturn(wizard.value.configuration.blockchain, 'blockchain');
changes.standard = assertAndReturn(wizard.value.configuration.standard, 'standard');
changes.configs_request_policy = wizard.value.request_policy.configurationRule
? [wizard.value.request_policy.configurationRule]
: [];
Expand Down
65 changes: 65 additions & 0 deletions apps/wallet/src/components/accounts/AddAccountAssetBtn.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<template>
<VBtn
v-bind="$attrs"
:size="props.size.value"
:variant="props.variant.value"
:icon="props.icon.value && !props.text.value"
:color="props.color.value"
@click="open = true"
>
<VIcon v-if="props.icon.value" :icon="props.icon.value" />
<slot name="default">
<span v-if="props.text">{{ props.text.value }}</span>
</slot>
<VIcon v-if="props.appendIcon.value" :icon="props.appendIcon.value" />
</VBtn>

<AddAccountAssetDialog
:account="props.account.value"
:open="open"
:readonly="props.readonly.value"
@update:open="
openEvent => {
open = openEvent;

emit('opened', openEvent);
}
"
/>
</template>
<script lang="ts" setup>
import { ref, toRefs } from 'vue';
import { VBtn } from 'vuetify/components';
import { Account } from '~/generated/station/station.did';
import AddAccountAssetDialog from './AddAccountAssetDialog.vue';

const input = withDefaults(
defineProps<{
account: Account;
icon?: string;
text?: string;
size?: 'x-small' | 'small' | 'default' | 'medium' | 'large' | 'x-large';
variant?: 'flat' | 'text' | 'outlined' | 'elevated';
color?: string;
readonly?: boolean;
appendIcon?: string;
}>(),
{
icon: undefined,
text: undefined,
size: 'default',
variant: 'elevated',
color: 'primary',
readonly: false,
appendIcon: undefined,
},
);

const open = ref(false);

const emit = defineEmits<{
(event: 'opened', payload: boolean): void;
}>();

const props = toRefs(input);
</script>
Loading