Skip to content

Commit

Permalink
Move contracts to a chain subfolder, leverage absolute paths. Intent …
Browse files Browse the repository at this point in the history
…is to move chain-specific code there
  • Loading branch information
wraitii committed Mar 11, 2022
1 parent 8c123ef commit 43ae803
Show file tree
Hide file tree
Showing 45 changed files with 68 additions and 62 deletions.
2 changes: 0 additions & 2 deletions src/Dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import DebugVue from './components/debug/Debug.vue';
import ShareVue from './components/builder/share/Share.vue';
import GalleryVue from './components/builder/gallery/Gallery.vue';

import { THREE } from './three';

export const Builder = BuilderVue;
export const Admin = AdminVue;
export const Debug = DebugVue;
Expand Down
2 changes: 1 addition & 1 deletion src/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import MetamaskWallet from './wallets/Metamask'
import { IWallet } from './wallets/IWallet';

import { getProvider, setProvider } from './Provider';
import { watchSignerChanges } from './Contracts'
import { watchSignerChanges } from '@/chain/Contracts';

import { legacySetsMgr } from './components/builder/set_browser/LegacySetsMgr';

Expand Down
1 change: 0 additions & 1 deletion src/builder/Briq.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { number } from 'starknet';
import { hexUuid } from '../Uuid';

export class Briq
Expand Down
2 changes: 1 addition & 1 deletion src/builder/ChainBriqs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Briq } from './Briq';
import type IBriqContract from '../contracts/briq';
import type IBriqContract from '../chain/contracts/briq';
import { reactive, watchEffect } from "vue";
import type { Ref } from "vue";
import { ticketing, isOutdated } from "../Async";
Expand Down
2 changes: 1 addition & 1 deletion src/builder/MintProxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reactive } from 'vue'
import type MintContract from '../contracts/mint';
import type MintContract from '../chain/contracts/mint';

import { ticketing, OutdatedPromiseError } from '../Async';

Expand Down
2 changes: 1 addition & 1 deletion src/builder/SetsManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { reactive, WatchStopHandle } from 'vue';
import SetContract from '../contracts/set';
import SetContract from '../chain/contracts/set';
import { SetData } from './SetData';
import { Briq } from './Briq';

Expand Down
2 changes: 1 addition & 1 deletion src/builder/StarknetSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { store } from "../store/Store";

import { setupMintProxy } from './MintProxy'

import contractStore from "../Contracts";
import contractStore from '@/chain/Contracts';

import { watchEffect } from 'vue';
export function setupSync()
Expand Down
2 changes: 1 addition & 1 deletion src/builder/graphics/Builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
RenderPass,
SSAARenderPass,
SAOPass,
} from '../../three';
} from '@/three';

export var camera: THREE.Camera;

Expand Down
5 changes: 2 additions & 3 deletions src/builder/graphics/Materials.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//import * as THREE from 'three';
import { THREE } from '../../three';
import { THREE } from '@/three';

import lightMapTex from '../../assets/lightmap.png'
import lightMapTex from '@/assets/lightmap.png'

import builderSettings from './Settings'

Expand Down
2 changes: 1 addition & 1 deletion src/builder/graphics/PreviewCube.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { THREE, THREE_SETUP } from '../../three';
import { THREE, THREE_SETUP } from '@/three';

var previewCube: THREE.Mesh;
function generatePreviewCube()
Expand Down
2 changes: 1 addition & 1 deletion src/builder/graphics/VoxelWorld.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { number } from 'starknet';
import { THREE } from '../../three';
import { THREE } from '@/three';

import { MaterialByColor } from './Materials';
export default class VoxelWorld {
Expand Down
2 changes: 1 addition & 1 deletion src/builder/inputs/Selection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SetData } from "../SetData";
import type { Briq } from '../Briq';

import { THREE } from '../../three';
import { THREE } from '@/three';

class SelectionRender
{
Expand Down
8 changes: 4 additions & 4 deletions src/builder/inputs/input_states/CopyPaste.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MouseInputState } from './BuilderInputState';
import { store } from '../../../store/Store'
import { store } from '@/store/Store'

import type { HotkeyHandle } from '../../../Hotkeys';
import type { HotkeyHandle } from '@/Hotkeys';

import { SelectionManager, selectionRender } from '../Selection';
import { THREE } from '../../../three';
import { pushMessage } from '../../../Messages';
import { THREE } from '@/three';
import { pushMessage } from '@/Messages';

export class CopyPasteInput extends MouseInputState {
lastClickPos: [number, number, number] | undefined;
Expand Down
6 changes: 3 additions & 3 deletions src/builder/inputs/input_states/Eraser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MouseInputState } from './BuilderInputState';
import { VoxelAlignedSelection } from './Selecting';
import getPreviewCube from '../../graphics/PreviewCube'
import { store } from '../../../store/Store';
import getPreviewCube from '@/builder/graphics/PreviewCube';
import { store } from '@/store/Store';

import { THREE } from '../../../three';
import { THREE } from '@/three';

export class EraserInput extends MouseInputState
{
Expand Down
18 changes: 9 additions & 9 deletions src/builder/inputs/input_states/Inspect.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { MouseInputState } from './BuilderInputState';
import { store } from '../../../store/Store';
import type { SetData } from '../../SetData';
import type { Briq } from '../../Briq';
import { store } from '@/store/Store';
import type { SetData } from '@/builder/SetData';
import type { Briq } from '@/builder/Briq';
import { selectionRender } from '../Selection';
import getPreviewCube from '../../graphics/PreviewCube'
import { THREE, BufferGeometryUtils } from '../../../three';
import getPreviewCube from '@/builder/graphics/PreviewCube'
import { THREE, BufferGeometryUtils } from '@/three';

import { camera, inputObjects } from '../../graphics/Builder';

import { featureFlags } from '../../../FeatureFlags';
import { pushMessage } from '../../../Messages';
import { setsManager } from '../../SetsManager';
import type { HotkeyHandle } from '../../../Hotkeys';
import { featureFlags } from '@/FeatureFlags';
import { pushMessage } from '@/Messages';
import { setsManager } from '@/builder/SetsManager';
import type { HotkeyHandle } from '@/Hotkeys';

import { watchEffect, WatchStopHandle } from 'vue';
import { BoxSelection, VoxelAlignedSelection } from './Selecting';
Expand Down
8 changes: 4 additions & 4 deletions src/builder/inputs/input_states/Painter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MouseInputState } from './BuilderInputState';
import getPreviewCube from '../../graphics/PreviewCube'
import getPreviewCube from '@/builder/graphics/PreviewCube'
import { inputStore } from "../InputStore";
import { store } from '../../../store/Store';
import { store } from '@/store/Store';

import type { SetData } from '../../SetData';
import type { SetData } from '@/builder/SetData';

import { THREE } from '../../../three';
import { THREE } from '@/three';
import { VoxelAlignedSelection } from './Selecting';

import { watchEffect } from 'vue';
Expand Down
6 changes: 3 additions & 3 deletions src/builder/inputs/input_states/Placer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MouseInputState } from './BuilderInputState';
import getPreviewCube from '../../graphics/PreviewCube'
import getPreviewCube from '@/builder/graphics/PreviewCube'
import { inputStore } from "../InputStore";
import { store } from '../../../store/Store'
import { store } from '@/store/Store'

import { THREE } from '../../../three';
import { THREE } from '@/three';
import { VoxelAlignedSelection } from './Selecting';

import { watchEffect } from 'vue';
Expand Down
12 changes: 6 additions & 6 deletions src/builder/inputs/input_states/Selecting.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { MouseInputState } from './BuilderInputState';
import { selectionRender } from '../Selection';
import { THREE, SelectionBox as ThreeSelectionBox } from '../../../three';
import getPreviewCube from '../../graphics/PreviewCube';
import { THREE, SelectionBox as ThreeSelectionBox } from '@/three';
import getPreviewCube from '@/builder/graphics/PreviewCube';

import { store } from '../../../store/Store'
import { camera } from '../../graphics/Builder';
import type { HotkeyHandle } from '../../../Hotkeys';
import type { Briq } from '../../Briq';
import { store } from '@/store/Store'
import { camera } from '@/builder/graphics/Builder';
import type { HotkeyHandle } from '@/Hotkeys';
import type { Briq } from '@/builder/Briq';

export class BoxSelection extends MouseInputState
{
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts.ts → src/chain/Contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const IMPL = {
}

import { reactive, watchEffect, toRef, ref } from 'vue';
import { logDebug } from './Messages'
import { logDebug } from '../Messages'
const contractStore = reactive({
briq: undefined as undefined | BriqContract,
mint: undefined as undefined | MintContract,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/contracts/set.ts → src/chain/contracts/set.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Provider, Signer } from 'starknet';
import type { SetData } from '../builder/SetData';
import type { SetData } from '../../builder/SetData';
import { getSelectorFromName } from 'starknet/utils/stark';


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Admin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</template>

<script lang="ts">
import contractStore from '../Contracts';
import contractStore from '@/chain/Contracts';
import { messagesStore, pushMessage } from '../Messages'
import { defineComponent } from 'vue';
import type { Provider, Signer } from 'starknet';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Contract.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var names = Object.keys(materialData);
<script lang="ts">
import { defineComponent } from 'vue'
import { adminStore, isOk } from '../Admin'
import contractStore from '../Contracts';
import contractStore from '@/chain/Contracts';
export default defineComponent({
data() {
Expand Down
6 changes: 3 additions & 3 deletions src/components/builder/BlockchainStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import Hotkey from '../generic/Hotkey.vue';
</template>

<script lang="ts">
import contractStore from '@/chain/Contracts';
import { pushModal } from '../Modals.vue';
import WalletSelectorVue from '../WalletSelector.vue';
import { transactionsManager } from '../../builder/Transactions';
import contractStore from '../../Contracts';
import { defineComponent } from "vue";
import { defineComponent } from 'vue';
export default defineComponent({
data() {
return {
Expand Down Expand Up @@ -76,7 +76,7 @@ export default defineComponent({
pushModal(WalletSelectorVue);
},
}
})
});
</script>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/BriqDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<script lang="ts">
import { setsManager } from '../../builder/SetsManager';
import contractStore from '../../Contracts';
import contractStore from '@/chain/Contracts';
import { reportError } from '../../Monitoring';
import { ticketing } from '../../Async';
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/Builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import CursorTooltip from '../generic/CursorTooltip.vue';
import WalletSelectorVue from '../WalletSelector.vue';
import { setsManager, checkForInitialGMSet } from '../../builder/SetsManager';
import contractStore from '../../Contracts';
import contractStore from '@/chain/Contracts';
import { watchEffectAndWait } from '../../Async';
import { setupSync } from '../../builder/StarknetSync';
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/modals/ExportSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import { SetData } from '../../../builder/SetData';
import { transactionsManager, Transaction } from '../../../builder/Transactions';
import contractStore from '../../../Contracts';
import contractStore from '@/chain/Contracts';
import { setsManager } from '../../../builder/SetsManager';
import BriqTable from '../BriqTable.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/modals/MigrateSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { SetData } from '../../../builder/SetData';
import { transactionsManager, Transaction } from '../../../builder/Transactions';
import contractStore from '../../../Contracts';
import contractStore from '@/chain/Contracts';
import { setsManager } from '../../../builder/SetsManager';
import BriqTable from '../BriqTable.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/modals/MintModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { mintProxyStore } from '../../../builder/MintProxy';
import { Transaction, transactionsManager } from '../../../builder/Transactions';
import type { Provider } from 'starknet';
import contractStore from '../../../Contracts';
import contractStore from '@/chain/Contracts';
import { defineComponent } from 'vue';
export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/modals/TransferSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Button from '../../generic/Button.vue';
<script lang="ts">
import { Transaction } from '../../../builder/Transactions';
import contractStore from '../../../Contracts';
import contractStore from '@/chain/Contracts';
import { defineComponent, nextTick, toRef } from 'vue';
export default defineComponent({
Expand Down
4 changes: 2 additions & 2 deletions src/components/builder/set_browser/LegacySetsMgr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SetData } from '../../../builder/SetData';
import { ADDRESSES } from '../../../Contracts';
import { LegacySetContract } from '../../../contracts/set';
import { ADDRESSES } from '@/chain/Contracts';
import { LegacySetContract } from '../../../chain/contracts/set';
import getBaseUrl, { fetchData } from '../../../url';

class LegacySetsMgr
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/set_browser/SetGridItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import TransferSet from '../modals/TransferSet.vue';
import { Transaction, transactionsManager } from '../../../builder/Transactions';
import contractStore from '../../../Contracts';
import contractStore from '@/chain/Contracts';
import { SetData } from '../../../builder/setData';
import { setsManager, SetInfo } from '../../../builder/SetsManager';
Expand Down
2 changes: 1 addition & 1 deletion src/components/builder/share/Share.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import { getProvider, getProviderForNetwork } from '../../../Provider';
import { fetchData } from '../../../url';
import { reportError } from '../../../Monitoring';
import { ticketing } from '../../../Async';
import contractStore, { forceNetwork } from '../../../Contracts';
import contractStore, { forceNetwork } from '@/chain/Contracts';
import builderSettings from '../../../builder/graphics/Settings';
import { defineComponent, watchEffect } from 'vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/debug/Debug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ p {
import type { Provider, CallContractTransaction } from 'starknet';
import { transactionsManager } from '../../builder/Transactions';
import contractStore from '../../Contracts';
import contractStore from '@/chain/Contracts';
import { getStarknetObject } from '../../wallets/ArgentX';
import { ticketing, ignoreOutdated, OutdatedPromiseError } from '../../Async';
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"strict": true,
"incremental": true,
"types": ["vite/client", "@types/jest", "@types/three", "@types/uuid", "vite-svg-loader"],
"paths": {
"@/*": ["./src/*"]
}
}
}
7 changes: 7 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ const injectNpmVersion = () => {
}
};

import path from 'path';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
resolve:{
alias:{
'@' : path.resolve(__dirname, './src'),
},
},
build: {
target: "es2020",
sourcemap: mode === "production",
Expand Down

0 comments on commit 43ae803

Please sign in to comment.